OSDN Git Service

Fixes interpretation of attribute lists in the EGL emulation library.
authorPascal Muetschard <pmuetschard@google.com>
Fri, 14 Aug 2015 22:15:05 +0000 (15:15 -0700)
committerbohu <bohu@google.com>
Tue, 20 Oct 2015 17:52:55 +0000 (10:52 -0700)
In a few places, EGL_NONE was incorrectly assumed to be 0. EGL_NONE is
used to indicate the end of the list. By assuming EGL_NONE is 0, the
code would fail to detect the end of the list appropriately.

Bug: 23036813

(cherry picked from commit 6801005a9e9e5741cbc73a98d7282485767d7e96)

Change-Id: I909d48a15a2cebfda93fb165e55821d7b694fa4b

system/egl/egl.cpp

index 86897d4..e9d59ab 100644 (file)
@@ -659,7 +659,7 @@ EGLSurface eglCreatePbufferSurface(EGLDisplay dpy, EGLConfig config, const EGLin
     int32_t h = 0;
     EGLint texFormat = EGL_NO_TEXTURE;
     EGLint texTarget = EGL_NO_TEXTURE;
-    while (attrib_list[0]) {
+    while (attrib_list[0] != EGL_NONE) {
         switch (attrib_list[0]) {
             case EGL_WIDTH:
                 w = attrib_list[1];
@@ -883,7 +883,7 @@ EGLContext eglCreateContext(EGLDisplay dpy, EGLConfig config, EGLContext share_c
     VALIDATE_CONFIG(config, EGL_NO_CONTEXT);
 
     EGLint version = 1; //default
-    while (attrib_list && attrib_list[0]) {
+    while (attrib_list && attrib_list[0] != EGL_NONE) {
         if (attrib_list[0] == EGL_CONTEXT_CLIENT_VERSION) version = attrib_list[1];
         attrib_list+=2;
     }
@@ -1001,7 +1001,7 @@ EGLBoolean eglMakeCurrent(EGLDisplay dpy, EGLSurface draw, EGLSurface read, EGLC
             hostCon->glEncoder()->setClientState(context->getClientState());
             hostCon->glEncoder()->setSharedGroup(context->getSharedGroup());
         }
-    } 
+    }
     else if (tInfo->currentContext) {
         //release ClientState & SharedGroup
         if (tInfo->currentContext->version == 2) {