From: Sangjin Kim Date: Tue, 8 May 2012 05:34:25 +0000 (+0900) Subject: [Title] Error check and viewport bug fix X-Git-Tag: Tizen_Studio_1.3_Release_p2.3.1~1615 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=624ad0a9f2a4e6c9240ffe6079c56807cab8b7f0;p=sdk%2Femulator%2Fqemu.git [Title] Error check and viewport bug fix [Type] bug fix [Module] opengl-es [Priority] [CQ#] [Redmine#] [Problem] [Cause] [Solution] [TestCase] --- diff --git a/tizen/src/hw/gloffscreen_test.c b/tizen/src/hw/gloffscreen_test.c index 887c32b921..a685125d25 100755 --- a/tizen/src/hw/gloffscreen_test.c +++ b/tizen/src/hw/gloffscreen_test.c @@ -111,7 +111,11 @@ int gl_acceleration_capability_check (void) { glo_init(); // new surface context = glo_context_create(bufferFlags, 0); + if (context == NULL) + return 1; surface = glo_surface_create(TX, TY, context); + if (surface == NULL) + return 1; glo_surface_makecurrent(surface); printf("GL VENDOR %s\n", glGetString(GL_VENDOR)); printf("GL RENDERER %s\n", glGetString(GL_RENDERER)); diff --git a/tizen/src/hw/gloffscreen_xcomposite.c b/tizen/src/hw/gloffscreen_xcomposite.c index 446afdf911..f111e9873c 100755 --- a/tizen/src/hw/gloffscreen_xcomposite.c +++ b/tizen/src/hw/gloffscreen_xcomposite.c @@ -470,7 +470,11 @@ static int glo_can_readback(void) { } context = glo_context_create(bufferFlags, 0); + if (context == NULL) + return 1; surface = glo_surface_create(TX, TY, context); + if (surface == NULL) + return 1; glo_surface_makecurrent(surface); diff --git a/tizen/src/hw/opengl_exec.c b/tizen/src/hw/opengl_exec.c index 0aff747ca5..4721199d37 100755 --- a/tizen/src/hw/opengl_exec.c +++ b/tizen/src/hw/opengl_exec.c @@ -521,6 +521,13 @@ static inline void resize_surface(ProcessState *process, QGloSurface *qsurface, // Client doesnt know surface is new - need to MakeCurrent if(process->current_state == qsurface->glstate) { glo_surface_makecurrent(qsurface->surface); + // set the viewport while the window size is changed. It is needed + // especially for the case that glViewport is not explicitly called + // in program. In this case, the viewport is set to incorrectly + // in the first MakeCurrent when the window size is not known. + // It will not impact normal GL programs with glViewport set as + // programmers want. + glViewport (0, 0, w, h); } else { DEBUGF("Error: Surface is not current! %p %p\n", @@ -1008,6 +1015,12 @@ static const char *opengl_strtok(const char *s, int *n, char **saveptr, char *pr s++, (*n)--; } while (*n > 2 && (s[1] != '*' || s[2] != '/')); s++, (*n)--; + s++, (*n)--; + if (*n == 0) { + break; + } + } else { + break; } } } @@ -1023,6 +1036,11 @@ static const char *opengl_strtok(const char *s, int *n, char **saveptr, char *pr ret = malloc(retlen + 1); p = ret; + if (retlen == 0) { + *p = 0; + return; + } + while (retlen > 0) { if (*start == '/' && retlen > 1) { if (start[1] == '/') {