aboutsummaryrefslogtreecommitdiffstats
path: root/legacy/evas/src/lib/canvas/evas_gl.c
diff options
context:
space:
mode:
authorSung Park <sungwoo@gmail.com>2012-06-27 08:19:25 +0000
committerSung Park <sungwoo@gmail.com>2012-06-27 08:19:25 +0000
commit896d489db84f8193bc017dde6bc1ebb260fa1c52 (patch)
tree35633d45e03c11189458fd2105be55b5b6235674 /legacy/evas/src/lib/canvas/evas_gl.c
parentEvil: force -mms-bitfields for all the lib compiled with Evil (diff)
downloadefl-896d489db84f8193bc017dde6bc1ebb260fa1c52.tar.gz
EvasGL: Fixed a few minor bugs.
- Added (w,h) <=0 dimension check for evas_gl_surface_create() - Changed evas_gl_make_current to return error when either surface or context is NULL. Semantically, this was allowed before but it was changed to reflect eglMakeCurrent behavior. - evas_gl_make_current - detached any previously attached buffers before attaching new ones to an FBO during a make_current. - Used dynamic memory for extension string allocation for safety. SVN revision: 72926
Diffstat (limited to 'legacy/evas/src/lib/canvas/evas_gl.c')
-rw-r--r--legacy/evas/src/lib/canvas/evas_gl.c17
1 files changed, 14 insertions, 3 deletions
diff --git a/legacy/evas/src/lib/canvas/evas_gl.c b/legacy/evas/src/lib/canvas/evas_gl.c
index bccab2dd8d..58021dfc09 100644
--- a/legacy/evas/src/lib/canvas/evas_gl.c
+++ b/legacy/evas/src/lib/canvas/evas_gl.c
@@ -100,6 +100,12 @@ evas_gl_surface_create(Evas_GL *evas_gl, Evas_GL_Config *config, int width, int
return NULL;
}
+ if ( (width <= 0) || (height <= 0))
+ {
+ ERR("Invalid surface dimensions: %d, %d", width, height);
+ return NULL;
+ }
+
surf = calloc(1, sizeof(Evas_GL_Surface));
if (!surf) return NULL;
@@ -220,11 +226,16 @@ evas_gl_make_current(Evas_GL *evas_gl, Evas_GL_Surface *surf, Evas_GL_Context *c
MAGIC_CHECK(evas_gl, Evas_GL, MAGIC_EVAS_GL);
return EINA_FALSE;
MAGIC_CHECK_END();
-
- if ((!surf) || (!ctx))
+
+ if ((surf) && (ctx))
+ ret = (Eina_Bool)evas_gl->evas->engine.func->gl_make_current(evas_gl->evas->engine.data.output, surf->data, ctx->data);
+ else if ((!surf) && (!ctx))
ret = (Eina_Bool)evas_gl->evas->engine.func->gl_make_current(evas_gl->evas->engine.data.output, NULL, NULL);
else
- ret = (Eina_Bool)evas_gl->evas->engine.func->gl_make_current(evas_gl->evas->engine.data.output, surf->data, ctx->data);
+ {
+ ERR("Bad match between surface: %p and context: %p", surf, ctx);
+ return EINA_FALSE;
+ }
return ret;
}