summaryrefslogtreecommitdiffstats
path: root/opengl/tests
diff options
context:
space:
mode:
authorAndy McFadden <fadden@android.com>2014-03-12 09:50:15 -0700
committerAndy McFadden <fadden@android.com>2014-03-12 09:50:15 -0700
commit709d7dec790f046ae3f72e7ebe9046977a46ac65 (patch)
treeb63b4d7ff1e56d82227c85637edabd846052def2 /opengl/tests
parentc9ed7d376882ff3c32913473fecd729c804dad0e (diff)
downloadframeworks_native-709d7dec790f046ae3f72e7ebe9046977a46ac65.zip
frameworks_native-709d7dec790f046ae3f72e7ebe9046977a46ac65.tar.gz
frameworks_native-709d7dec790f046ae3f72e7ebe9046977a46ac65.tar.bz2
Adjust for device orientation
When the device is rotated, reverse the width/height values. Change-Id: Idc2b80b1cb96d9379cd94192997580e1ade70bf6
Diffstat (limited to 'opengl/tests')
-rw-r--r--opengl/tests/lib/WindowSurface.cpp13
1 files changed, 12 insertions, 1 deletions
diff --git a/opengl/tests/lib/WindowSurface.cpp b/opengl/tests/lib/WindowSurface.cpp
index 7b57dfd..ff91260 100644
--- a/opengl/tests/lib/WindowSurface.cpp
+++ b/opengl/tests/lib/WindowSurface.cpp
@@ -43,8 +43,19 @@ WindowSurface::WindowSurface() {
return;
}
+ uint32_t width, height;
+ if (mainDpyInfo.orientation != DISPLAY_ORIENTATION_0 &&
+ mainDpyInfo.orientation != DISPLAY_ORIENTATION_180) {
+ // rotated
+ width = mainDpyInfo.h;
+ height = mainDpyInfo.w;
+ } else {
+ width = mainDpyInfo.w;
+ height = mainDpyInfo.h;
+ }
+
sp<SurfaceControl> sc = surfaceComposerClient->createSurface(
- String8("Benchmark"), mainDpyInfo.w, mainDpyInfo.h,
+ String8("Benchmark"), width, height,
PIXEL_FORMAT_RGBA_8888, ISurfaceComposerClient::eOpaque);
if (sc == NULL || !sc->isValid()) {
fprintf(stderr, "Failed to create SurfaceControl\n");