emulator: opengl: ut_renderer usability improvements
This patch provides two useful changes to the ut_renderer unit-test program: 1/ the ability to control the GL window dimensions with two env. variables: ANDROID_WINDOW_WIDTH and ANDROID_WINDOW_HEIGHT 2/ the ability to save/restore the GL window position between GL connections. Both are useful to use ut_renderer in a demo setting, nothing more. Change-Id: I19a8f911ee821ddc4eb6307de12d63600ff696b0
This commit is contained in:
@@ -60,13 +60,30 @@ EGLConfig RendererSurface::getEglConfig(EGLDisplay eglDisplay, SurfaceConfig con
|
||||
|
||||
RendererSurface * RendererSurface::create(EGLDisplay eglDisplay, SurfaceConfig config, NativeWindowing *nw)
|
||||
{
|
||||
int width = 0, height = 0;
|
||||
const char* env;
|
||||
|
||||
env = getenv("ANDROID_WINDOW_WIDTH");
|
||||
if (env && *env) {
|
||||
width = atoi(env);
|
||||
}
|
||||
env = getenv("ANDROID_WINDOW_HEIGHT");
|
||||
if (env && *env) {
|
||||
height = atoi(env);
|
||||
}
|
||||
if (width <= 160)
|
||||
width = DEFAULT_WIDTH;
|
||||
if (height <= 160)
|
||||
height = DEFAULT_HEIGHT;
|
||||
|
||||
printf("%s: Using width=%d height=%d\n", __FUNCTION__, width, height);
|
||||
|
||||
EGLConfig eglConfig = getEglConfig(eglDisplay, config);
|
||||
if (eglConfig == 0) {
|
||||
return NULL;
|
||||
}
|
||||
|
||||
NativeWindowType window = nw->createNativeWindow(nw->getNativeDisplay(), DEFAULT_WIDTH, DEFAULT_HEIGHT);
|
||||
NativeWindowType window = nw->createNativeWindow(nw->getNativeDisplay(), width, height);
|
||||
if (window == 0) {
|
||||
return NULL;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user