emulator:opengl: custom framebuffer sizes
This allows the "emulator_test_renderer" program to use
custom framebuffer sizes. You need to define ANDROID_WINDOW_SIZE
in your environment before launching the test program, e.g.:
export ANDROID_WINDOW_SIZE=640x480
Change-Id: I2559c6e75022762697ed4c4559d6c2ba3f400e8f
diff --git a/tools/emulator/opengl/README b/tools/emulator/opengl/README
index 7147802..bec20c5 100644
--- a/tools/emulator/opengl/README
+++ b/tools/emulator/opengl/README
@@ -24,7 +24,7 @@
files, three types of auto-generated sources:
- sources to encode commands into a byte stream.
- - sources to decide the byte stream into commands.
+ - sources to decode the byte stream into commands.
- sources to wrap normal procedural EGL/GLES calls into context-aware ones.
Modules under the system/ directory corresponds to code that runs on the
diff --git a/tools/emulator/opengl/tests/emulator_test_renderer/main.cpp b/tools/emulator/opengl/tests/emulator_test_renderer/main.cpp
index b0e49cd..cf521d4 100644
--- a/tools/emulator/opengl/tests/emulator_test_renderer/main.cpp
+++ b/tools/emulator/opengl/tests/emulator_test_renderer/main.cpp
@@ -30,8 +30,15 @@
int portNum = 22468;
int winWidth = 320;
int winHeight = 480;
+ int width, height;
+ const char* env = getenv("ANDROID_WINDOW_SIZE");
FBNativeWindowType windowId = NULL;
+ if (env && sscanf(env, "%dx%d", &width, &height) == 2) {
+ winWidth = width;
+ winHeight = height;
+ }
+
//
// Inialize SDL window
//