diff options
author | Sung W. Park <dunamis.park@samsung.com> | 2013-10-24 17:37:22 +0900 |
---|---|---|
committer | Sung W. Park <dunamis.park@samsung.com> | 2013-10-24 17:42:21 +0900 |
commit | 7dc102c55f6de2a9952cf79ffa69b50ab66df4c1 (patch) | |
tree | 990be0bac6c5dc11ac4431fc6b71cd09c51cff08 | |
parent | abec2d03b88657873a864dbd0bb0731442b4384f (diff) |
EvasGL: Fixed direct rendering not clipping issue
Evas GL direct rendering mode didn't properly take into account
the image object's clipping information and clip the region that
it was directly rendering to. Hence there were issues with the
direct rendering region drawing over the objects that are sitting
on top of it.
Also, cleaned up the direct rendering coordinate computation code
and a nasty dependency with image object that should have been
removed a long time ago. Basically the evas-gl engine was directly
accessing the image object data structure for its data when it
really should have just passed along necessary information.
-rw-r--r-- | ChangeLog | 3 | ||||
-rw-r--r-- | src/modules/evas/engines/gl_common/evas_gl_api.c | 231 | ||||
-rw-r--r-- | src/modules/evas/engines/gl_common/evas_gl_core.c | 76 | ||||
-rw-r--r-- | src/modules/evas/engines/gl_common/evas_gl_core.h | 39 | ||||
-rw-r--r-- | src/modules/evas/engines/gl_common/evas_gl_core_private.h | 25 | ||||
-rw-r--r-- | src/modules/evas/engines/gl_x11/evas_engine.c | 33 | ||||
-rw-r--r-- | src/modules/evas/engines/wayland_egl/evas_engine.c | 21 |
7 files changed, 237 insertions, 191 deletions
@@ -1,3 +1,6 @@ +2013-10-24 Sung W. Park (sung_) + * EvasGL: Fixed direct rendering mode not clipping to its clip region. + 2013-10-18 Youngbok Shin * Fixed the textblock format to be drawn according to diff --git a/src/modules/evas/engines/gl_common/evas_gl_api.c b/src/modules/evas/engines/gl_common/evas_gl_api.c index 968f7e10b..6b9354852 100644 --- a/src/modules/evas/engines/gl_common/evas_gl_api.c +++ b/src/modules/evas/engines/gl_common/evas_gl_api.c @@ -20,7 +20,7 @@ void _make_current_check(const char* api) if (!ctx) { - CRIT("\e[1;33m%s\e[m: Current Context NOT SET: GL Call Should NOT Be Called without MakeCurrent!!!", api); + CRIT("\e[1;33m%s\e[m: Current Context NOT SET: GL Call Should NOT Be Called without MakeCurrent!!!", api); } } @@ -157,45 +157,23 @@ _evgl_glReleaseShaderCompiler(void) // returns: objc[4] (nc[4]) tranformed (x, y, width, heigth) in gl coord // returns: cc[4] cliped coordinate in original coordinate static void -compute_gl_coordinates(Evas_Object *obj, int rot, int clip_image, +compute_gl_coordinates(int win_w, int win_h, int rot, int clip_image, int x, int y, int width, int height, - int clip[4], + int img_x, int img_y, int img_w, int img_h, + int clip_x, int clip_y, int clip_w, int clip_h, int imgc[4], int objc[4], int cc[4]) { - Evas_Object_Protected_Data *pd = eo_data_scope_get(obj, EVAS_OBJ_CLASS); - - int obj_x, obj_y, obj_w, obj_h; - int clip_x, clip_y, clip_w, clip_h; - int out_w, out_h; - - // Original Coordinates - obj_x = pd->cur->geometry.x; - obj_y = pd->cur->geometry.y; - obj_w = pd->cur->geometry.w; - obj_h = pd->cur->geometry.h; - - // Clip Region - clip_x = clip[0]; - clip_y = clip[1]; - clip_w = clip[2]; - clip_h = clip[3]; - - // Output Window Size - out_w = pd->layer->evas->output.w; - out_h = pd->layer->evas->output.h; - - if (rot == 0) { // oringinal image object coordinate in gl coordinate - imgc[0] = obj_x; - imgc[1] = out_h - obj_y - obj_h; - imgc[2] = imgc[0] + obj_w; - imgc[3] = imgc[1] + obj_h; + imgc[0] = img_x; + imgc[1] = win_h - img_y - img_h; + imgc[2] = imgc[0] + img_w; + imgc[3] = imgc[1] + img_h; // clip coordinates in gl coordinate cc[0] = clip_x; - cc[1] = out_h - clip_y - clip_h; + cc[1] = win_h - clip_y - clip_h; cc[2] = cc[0] + clip_w; cc[3] = cc[1] + clip_h; @@ -208,20 +186,20 @@ compute_gl_coordinates(Evas_Object *obj, int rot, int clip_image, else if (rot == 180) { // oringinal image object coordinate in gl coordinate - imgc[0] = out_w - obj_x - obj_w; - imgc[1] = obj_y; - imgc[2] = imgc[0] + obj_w; - imgc[3] = imgc[1] + obj_h; + imgc[0] = win_w - img_x - img_w; + imgc[1] = img_y; + imgc[2] = imgc[0] + img_w; + imgc[3] = imgc[1] + img_h; // clip coordinates in gl coordinate - cc[0] = out_w - clip_x - clip_w; + cc[0] = win_w - clip_x - clip_w; cc[1] = clip_y; cc[2] = cc[0] + clip_w; cc[3] = cc[1] + clip_h; // transformed (x,y,width,height) in gl coordinate - objc[0] = imgc[0] + obj_w - x - width; - objc[1] = imgc[1] + obj_h - y - height; + objc[0] = imgc[0] + img_w - x - width; + objc[1] = imgc[1] + img_h - y - height; objc[2] = objc[0] + width; objc[3] = objc[1] + height; @@ -229,10 +207,10 @@ compute_gl_coordinates(Evas_Object *obj, int rot, int clip_image, else if (rot == 90) { // oringinal image object coordinate in gl coordinate - imgc[0] = obj_y; - imgc[1] = obj_x; - imgc[2] = imgc[0] + obj_h; - imgc[3] = imgc[1] + obj_w; + imgc[0] = img_y; + imgc[1] = img_x; + imgc[2] = imgc[0] + img_h; + imgc[3] = imgc[1] + img_w; // clip coordinates in gl coordinate cc[0] = clip_y; @@ -241,7 +219,7 @@ compute_gl_coordinates(Evas_Object *obj, int rot, int clip_image, cc[3] = cc[1] + clip_w; // transformed (x,y,width,height) in gl coordinate - objc[0] = imgc[0] + obj_h - y - height; + objc[0] = imgc[0] + img_h - y - height; objc[1] = imgc[1] + x; objc[2] = objc[0] + height; objc[3] = objc[1] + width; @@ -249,20 +227,20 @@ compute_gl_coordinates(Evas_Object *obj, int rot, int clip_image, else if (rot == 270) { // oringinal image object coordinate in gl coordinate - imgc[0] = out_h - obj_y - obj_h; - imgc[1] = out_w - obj_x - obj_w; - imgc[2] = imgc[0] + obj_h; - imgc[3] = imgc[1] + obj_w; + imgc[0] = win_h - img_y - img_h; + imgc[1] = win_w - img_x - img_w; + imgc[2] = imgc[0] + img_h; + imgc[3] = imgc[1] + img_w; // clip coordinates in gl coordinate - cc[0] = out_h - clip_y - clip_h; - cc[1] = out_w - clip_x - clip_w; + cc[0] = win_h - clip_y - clip_h; + cc[1] = win_w - clip_x - clip_w; cc[2] = cc[0] + clip_h; cc[3] = cc[1] + clip_w; // transformed (x,y,width,height) in gl coordinate objc[0] = imgc[0] + y; - objc[1] = imgc[1] + obj_w - x - width; + objc[1] = imgc[1] + img_w - x - width; objc[2] = objc[0] + height; objc[3] = objc[1] + width; } @@ -297,7 +275,7 @@ compute_gl_coordinates(Evas_Object *obj, int rot, int clip_image, cc[2] = cc[2]-cc[0]; // width cc[3] = cc[3]-cc[1]; // height - //DBG( "\e[1;32m Img[%d %d %d %d] Original [%d %d %d %d] Transformed[%d %d %d %d] Clip[%d %d %d %d] Clipped[%d %d %d %d] \e[m", obj_x, obj_y, obj_w, obj_h, imgc[0], imgc[1], imgc[2], imgc[3], objc[0], objc[1], objc[2], objc[3], clip[0], clip[1], clip[2], clip[3], cc[0], cc[1], cc[2], cc[3]); + //DBG( "\e[1;32m Img[%d %d %d %d] Original [%d %d %d %d] Transformed[%d %d %d %d] Clip[%d %d %d %d] Clipped[%d %d %d %d] \e[m", img_x, img_y, img_w, img_h, imgc[0], imgc[1], imgc[2], imgc[3], objc[0], objc[1], objc[2], objc[3], clip[0], clip[1], clip[2], clip[3], cc[0], cc[1], cc[2], cc[3]); } static void @@ -305,8 +283,6 @@ _evgl_glClear(GLbitfield mask) { EVGL_Resource *rsc; EVGL_Context *ctx; - Evas_Object *img; - int rot = 0; int oc[4] = {0,0,0,0}, nc[4] = {0,0,0,0}; int cc[4] = {0,0,0,0}; @@ -339,35 +315,33 @@ _evgl_glClear(GLbitfield mask) ctx->direct_scissor = 1; } - img = rsc->direct_img_obj; - rot = evgl_engine->funcs->rotation_angle_get(rsc->current_eng); - if ((ctx->scissor_updated) && (ctx->scissor_enabled)) { - compute_gl_coordinates(img, rot, 1, - ctx->scissor_coord[0], - ctx->scissor_coord[1], - ctx->scissor_coord[2], - ctx->scissor_coord[3], - rsc->clip, oc, nc, cc); - - if (rsc->master_clip) - { - RECTS_CLIP_TO_RECT(nc[0], nc[1], nc[2], nc[3], cc[0], cc[1], cc[2], cc[3]); - glScissor(nc[0], nc[1], nc[2], nc[3]); - } - else - glScissor(nc[0], nc[1], nc[2], nc[3]); + compute_gl_coordinates(rsc->direct.win_w, rsc->direct.win_h, + rsc->direct.rot, 1, + ctx->scissor_coord[0], ctx->scissor_coord[1], + ctx->scissor_coord[2], ctx->scissor_coord[3], + rsc->direct.img.x, rsc->direct.img.y, + rsc->direct.img.w, rsc->direct.img.h, + rsc->direct.clip.x, rsc->direct.clip.y, + rsc->direct.clip.w, rsc->direct.clip.h, + oc, nc, cc); + + RECTS_CLIP_TO_RECT(nc[0], nc[1], nc[2], nc[3], cc[0], cc[1], cc[2], cc[3]); + glScissor(nc[0], nc[1], nc[2], nc[3]); ctx->direct_scissor = 0; } else { - compute_gl_coordinates(img, rot, 0, 0, 0, 0, 0, rsc->clip, oc, nc, cc); - - if (rsc->master_clip) - glScissor(cc[0], cc[1], cc[2], cc[3]); - else - glScissor(oc[0], oc[1], oc[2], oc[3]); + compute_gl_coordinates(rsc->direct.win_w, rsc->direct.win_h, + rsc->direct.rot, 0, + 0, 0, 0, 0, + rsc->direct.img.x, rsc->direct.img.y, + rsc->direct.img.w, rsc->direct.img.h, + rsc->direct.clip.x, rsc->direct.clip.y, + rsc->direct.clip.w, rsc->direct.clip.h, + oc, nc, cc); + glScissor(cc[0], cc[1], cc[2], cc[3]); } glClear(mask); @@ -424,7 +398,6 @@ _evgl_glGetIntegerv(GLenum pname, GLint* params) { EVGL_Resource *rsc; EVGL_Context *ctx; - Evas_Object_Protected_Data *img; if (_evgl_direct_enabled()) { @@ -450,8 +423,6 @@ _evgl_glGetIntegerv(GLenum pname, GLint* params) // Only need to handle it if it's directly rendering to the window if (!(rsc->current_ctx->current_fbo)) { - img = eo_data_scope_get(rsc->direct_img_obj, EVAS_OBJ_CLASS); - if (pname == GL_SCISSOR_BOX) { if (ctx->scissor_updated) @@ -475,8 +446,8 @@ _evgl_glGetIntegerv(GLenum pname, GLint* params) { params[0] = 0; params[1] = 0; - params[2] = (GLint)img->cur->geometry.w; - params[3] = (GLint)img->cur->geometry.h; + params[2] = (GLint)rsc->direct.img.w; + params[3] = (GLint)rsc->direct.img.h; return; } } @@ -490,8 +461,6 @@ _evgl_glReadPixels(GLint x, GLint y, GLsizei width, GLsizei height, GLenum forma { EVGL_Resource *rsc; EVGL_Context *ctx; - Evas_Object *img; - int rot = 0; int oc[4] = {0,0,0,0}, nc[4] = {0,0,0,0}; int cc[4] = {0,0,0,0}; @@ -520,10 +489,14 @@ _evgl_glReadPixels(GLint x, GLint y, GLsizei width, GLsizei height, GLenum forma if (!(rsc->current_ctx->current_fbo)) { - img = rsc->direct_img_obj; - rot = evgl_engine->funcs->rotation_angle_get(rsc->current_eng); - - compute_gl_coordinates(img, rot, 1, x, y, width, height, rsc->clip, oc, nc, cc); + compute_gl_coordinates(rsc->direct.win_w, rsc->direct.win_h, + rsc->direct.rot, 1, + x, y, width, height, + rsc->direct.img.x, rsc->direct.img.y, + rsc->direct.img.w, rsc->direct.img.h, + rsc->direct.clip.x, rsc->direct.clip.y, + rsc->direct.clip.w, rsc->direct.clip.h, + oc, nc, cc); glReadPixels(nc[0], nc[1], nc[2], nc[3], format, type, pixels); } else @@ -542,8 +515,6 @@ _evgl_glScissor(GLint x, GLint y, GLsizei width, GLsizei height) { EVGL_Resource *rsc; EVGL_Context *ctx; - Evas_Object *img; - int rot = 0; int oc[4] = {0,0,0,0}, nc[4] = {0,0,0,0}; int cc[4] = {0,0,0,0}; @@ -575,10 +546,14 @@ _evgl_glScissor(GLint x, GLint y, GLsizei width, GLsizei height) glDisable(GL_SCISSOR_TEST); } - img = rsc->direct_img_obj; - rot = evgl_engine->funcs->rotation_angle_get(rsc->current_eng); - - compute_gl_coordinates(img, rot, 1, x, y, width, height, rsc->clip, oc, nc, cc); + compute_gl_coordinates(rsc->direct.win_w, rsc->direct.win_h, + rsc->direct.rot, 1, + x, y, width, height, + rsc->direct.img.x, rsc->direct.img.y, + rsc->direct.img.w, rsc->direct.img.h, + rsc->direct.clip.x, rsc->direct.clip.y, + rsc->direct.clip.w, rsc->direct.clip.h, + oc, nc, cc); // Keep a copy of the original coordinates ctx->scissor_coord[0] = x; @@ -586,13 +561,8 @@ _evgl_glScissor(GLint x, GLint y, GLsizei width, GLsizei height) ctx->scissor_coord[2] = width; ctx->scissor_coord[3] = height; - if (rsc->master_clip) - { - RECTS_CLIP_TO_RECT(nc[0], nc[1], nc[2], nc[3], cc[0], cc[1], cc[2], cc[3]); - glScissor(nc[0], nc[1], nc[2], nc[3]); - } - else - glScissor(nc[0], nc[1], nc[2], nc[3]); + RECTS_CLIP_TO_RECT(nc[0], nc[1], nc[2], nc[3], cc[0], cc[1], cc[2], cc[3]); + glScissor(nc[0], nc[1], nc[2], nc[3]); ctx->direct_scissor = 0; @@ -629,8 +599,6 @@ _evgl_glViewport(GLint x, GLint y, GLsizei width, GLsizei height) { EVGL_Resource *rsc; EVGL_Context *ctx; - Evas_Object *img; - int rot = 0; int oc[4] = {0,0,0,0}, nc[4] = {0,0,0,0}; int cc[4] = {0,0,0,0}; @@ -663,40 +631,47 @@ _evgl_glViewport(GLint x, GLint y, GLsizei width, GLsizei height) ctx->direct_scissor = 1; } - img = rsc->direct_img_obj; - rot = evgl_engine->funcs->rotation_angle_get(rsc->current_eng); - if ((ctx->scissor_updated) && (ctx->scissor_enabled)) { // Recompute the scissor coordinates - compute_gl_coordinates(img, rot, 1, - ctx->scissor_coord[0], - ctx->scissor_coord[1], - ctx->scissor_coord[2], - ctx->scissor_coord[3], - rsc->clip, oc, nc, cc); - - if (rsc->master_clip) - { - RECTS_CLIP_TO_RECT(nc[0], nc[1], nc[2], nc[3], cc[0], cc[1], cc[2], cc[3]); - glScissor(nc[0], nc[1], nc[2], nc[3]); - } - else - glScissor(nc[0], nc[1], nc[2], nc[3]); + compute_gl_coordinates(rsc->direct.win_w, rsc->direct.win_h, + rsc->direct.rot, 1, + ctx->scissor_coord[0], ctx->scissor_coord[1], + ctx->scissor_coord[2], ctx->scissor_coord[3], + rsc->direct.img.x, rsc->direct.img.y, + rsc->direct.img.w, rsc->direct.img.h, + rsc->direct.clip.x, rsc->direct.clip.y, + rsc->direct.clip.w, rsc->direct.clip.h, + oc, nc, cc); + + RECTS_CLIP_TO_RECT(nc[0], nc[1], nc[2], nc[3], cc[0], cc[1], cc[2], cc[3]); + glScissor(nc[0], nc[1], nc[2], nc[3]); ctx->direct_scissor = 0; // Compute the viewport coordinate - compute_gl_coordinates(img, rot, 0, x, y, width, height, rsc->clip, oc, nc, cc); + compute_gl_coordinates(rsc->direct.win_w, rsc->direct.win_h, + rsc->direct.rot, 0, + x, y, width, height, + rsc->direct.img.x, rsc->direct.img.y, + rsc->direct.img.w, rsc->direct.img.h, + rsc->direct.clip.x, rsc->direct.clip.y, + rsc->direct.clip.w, rsc->direct.clip.h, + oc, nc, cc); glViewport(nc[0], nc[1], nc[2], nc[3]); } else { - compute_gl_coordinates(img, rot, 0, x, y, width, height, rsc->clip, oc, nc, cc); - if (rsc->master_clip) - glScissor(cc[0], cc[1], cc[2], cc[3]); - else - glScissor(oc[0], oc[1], oc[2], oc[3]); + + compute_gl_coordinates(rsc->direct.win_w, rsc->direct.win_h, + rsc->direct.rot, 0, + x, y, width, height, + rsc->direct.img.x, rsc->direct.img.y, + rsc->direct.img.w, rsc->direct.img.h, + rsc->direct.clip.x, rsc->direct.clip.y, + rsc->direct.clip.w, rsc->direct.clip.h, + oc, nc, cc); + glScissor(cc[0], cc[1], cc[2], cc[3]); glViewport(nc[0], nc[1], nc[2], nc[3]); } @@ -1627,7 +1602,7 @@ void _evgld_glShaderSource(GLuint shader, GLsizei count, const char* const * string, const GLint* length) { EVGL_FUNC_BEGIN(); -#ifdef GL_GLES +#ifdef GL_GLES glShaderSource(shader, count, (const GLchar * const *) string, length); #else glShaderSource(shader, count, (const GLchar **) string, length); @@ -2273,7 +2248,7 @@ _evgld_glShaderSource(GLuint shader, GLsizei count, const char* const* string, c finish: EVGL_FUNC_END(); } -#endif +#endif //-------------------------------------------------------------// @@ -2524,7 +2499,7 @@ _normal_gl_api_get(Evas_GL_API *funcs) ORD(glGetShaderPrecisionFormat); ORD(glShaderBinary); ORD(glReleaseShaderCompiler); - + #undef ORD evgl_api_ext_get(funcs); diff --git a/src/modules/evas/engines/gl_common/evas_gl_core.c b/src/modules/evas/engines/gl_common/evas_gl_core.c index c711a2675..a065bd465 100644 --- a/src/modules/evas/engines/gl_common/evas_gl_core.c +++ b/src/modules/evas/engines/gl_common/evas_gl_core.c @@ -114,10 +114,10 @@ _internal_resource_make_current(void *eng_data, EVGL_Context *ctx) // Set the surface to evas surface if it's there if (rsc->id == evgl_engine->main_tid) - rsc->direct_surface = evgl_engine->funcs->evas_surface_get(eng_data); + rsc->direct.surface = evgl_engine->funcs->evas_surface_get(eng_data); - if (rsc->direct_surface) - surface = (void*)rsc->direct_surface; + if (rsc->direct.surface) + surface = (void*)rsc->direct.surface; else surface = (void*)rsc->surface; @@ -1117,7 +1117,7 @@ _evgl_direct_renderable(EVGL_Resource *rsc, EVGL_Surface *sfc) if (evgl_engine->direct_force_off) return 0; if (rsc->id != evgl_engine->main_tid) return 0; if (!sfc->direct_fb_opt) return 0; - if (!rsc->direct_img_obj) return 0; + if (!rsc->direct.enabled) return 0; return 1; } @@ -1243,7 +1243,7 @@ _evgl_not_in_pixel_get() (ctx) && (ctx->current_sfc) && (ctx->current_sfc->direct_fb_opt) && - (!rsc->direct_img_obj)) + (!rsc->direct.enabled)) return 1; else return 0; @@ -1384,7 +1384,7 @@ error: // Terminate engine and all the resources // - destroy all internal resources // - free allocated engine struct -void +void evgl_engine_shutdown(void *eng_data) { // Check if engine is valid @@ -1740,7 +1740,7 @@ evgl_make_current(void *eng_data, EVGL_Surface *sfc, EVGL_Context *ctx) glBindFramebuffer(GL_FRAMEBUFFER, 0); ctx->current_fbo = 0; } - rsc->direct_rendered = 1; + rsc->direct.rendered = 1; } else { @@ -1757,7 +1757,7 @@ evgl_make_current(void *eng_data, EVGL_Surface *sfc, EVGL_Context *ctx) if (ctx->current_fbo) glBindFramebuffer(GL_FRAMEBUFFER, ctx->current_fbo); } - rsc->direct_rendered = 0; + rsc->direct.rendered = 0; } ctx->current_sfc = sfc; @@ -1820,9 +1820,56 @@ evgl_direct_rendered() if (!(rsc=_evgl_tls_resource_get())) return 0; - return rsc->direct_rendered; + return rsc->direct.rendered; +} + + + +void +evgl_direct_info_set(int win_w, int win_h, int rot, int img_x, int img_y, int img_w, int img_h, int clip_x, int clip_y, int clip_w, int clip_h) +{ + EVGL_Resource *rsc; + + if (!(rsc=_evgl_tls_resource_get())) return; + + // Normally direct rendering isn't allowed if alpha is on and + // rotation is not 0. BUT, if override is on, allow it. + if ( (rot==0) || + ((rot!=0) && (evgl_engine->direct_override)) ) + { + rsc->direct.enabled = EINA_TRUE; + + rsc->direct.win_w = win_w; + rsc->direct.win_h = win_h; + rsc->direct.rot = rot; + + rsc->direct.img.x = img_x; + rsc->direct.img.y = img_y; + rsc->direct.img.w = img_w; + rsc->direct.img.h = img_h; + + rsc->direct.clip.x = clip_x; + rsc->direct.clip.y = clip_y; + rsc->direct.clip.w = clip_w; + rsc->direct.clip.h = clip_h; + } + else + { + rsc->direct.enabled = EINA_FALSE; + } +} + +void +evgl_direct_info_clear() +{ + EVGL_Resource *rsc; + + if (!(rsc=_evgl_tls_resource_get())) return; + + rsc->direct.enabled = EINA_FALSE; } +/* void evgl_direct_img_obj_set(Evas_Object *img, int rot) { @@ -1835,12 +1882,12 @@ evgl_direct_img_obj_set(Evas_Object *img, int rot) if (rot!=0) { if (evgl_engine->direct_override) - rsc->direct_img_obj = img; + rsc->direct.img = img; else - rsc->direct_img_obj = NULL; + rsc->direct.img = NULL; } else - rsc->direct_img_obj = img; + rsc->direct.img = img; } Evas_Object * @@ -1850,8 +1897,9 @@ evgl_direct_img_obj_get() if (!(rsc=_evgl_tls_resource_get())) return NULL; - return rsc->direct_img_obj; + return rsc->direct.img; } +*/ Evas_GL_API * evgl_api_get() @@ -1862,6 +1910,7 @@ evgl_api_get() } +/* void evgl_direct_img_clip_set(int c, int x, int y, int w, int h) { @@ -1876,6 +1925,7 @@ evgl_direct_img_clip_set(int c, int x, int y, int w, int h) rsc->clip[3] = h; } +*/ void evgl_direct_override_get(int *override, int *force_off) diff --git a/src/modules/evas/engines/gl_common/evas_gl_core.h b/src/modules/evas/engines/gl_common/evas_gl_core.h index edcb52c3d..bbd5b24af 100644 --- a/src/modules/evas/engines/gl_common/evas_gl_core.h +++ b/src/modules/evas/engines/gl_common/evas_gl_core.h @@ -18,24 +18,31 @@ typedef struct _EVGL_Surface_Cap EVGL_Surface_Cap; typedef struct _EVGL_Surface_Format EVGL_Surface_Format; -extern EVGL_Engine *evgl_engine_init(void *eng_data, EVGL_Interface *efunc); -extern void evgl_engine_shutdown(void *eng_data); - -extern void *evgl_surface_create(void *eng_data, Evas_GL_Config *cfg, int w, int h); -extern int evgl_surface_destroy(void *eng_data, EVGL_Surface *sfc); -extern void *evgl_context_create(void *eng_data, EVGL_Context *share_ctx); -extern int evgl_context_destroy(void *eng_data, EVGL_Context *ctx); -extern int evgl_make_current(void *eng_data, EVGL_Surface *sfc, EVGL_Context *ctx); - -extern const char *evgl_string_query(int name); -extern void *evgl_proc_address_get(const char *name); -extern int evgl_native_surface_get(EVGL_Surface *sfc, Evas_Native_Surface *ns); -extern Evas_GL_API *evgl_api_get(); -extern int evgl_direct_rendered(); +EVGL_Engine *evgl_engine_init(void *eng_data, EVGL_Interface *efunc); +void evgl_engine_shutdown(void *eng_data); + +void *evgl_surface_create(void *eng_data, Evas_GL_Config *cfg, int w, int h); +int evgl_surface_destroy(void *eng_data, EVGL_Surface *sfc); +void *evgl_context_create(void *eng_data, EVGL_Context *share_ctx); +int evgl_context_destroy(void *eng_data, EVGL_Context *ctx); +int evgl_make_current(void *eng_data, EVGL_Surface *sfc, EVGL_Context *ctx); + +const char *evgl_string_query(int name); +void *evgl_proc_address_get(const char *name); +int evgl_native_surface_get(EVGL_Surface *sfc, Evas_Native_Surface *ns); +Evas_GL_API *evgl_api_get(); +int evgl_direct_rendered(); + + +/* extern void evgl_direct_img_obj_set(Evas_Object *img, int rot); extern Evas_Object *evgl_direct_img_obj_get(); +*/ + +void evgl_direct_info_set(int win_w, int win_h, int rot, int img_x, int img_y, int img_w, int img_h, int clip_x, int clip_y, int clip_w, int clip_h); +void evgl_direct_info_clear(); -extern void evgl_direct_img_clip_set(int c, int x, int y, int w, int h); -extern void evgl_direct_override_get(int *override, int *force_off); +//extern void evgl_direct_img_clip_set(int c, int x, int y, int w, int h); +void evgl_direct_override_get(int *override, int *force_off); #endif //_EVAS_GL_CORE_H diff --git a/src/modules/evas/engines/gl_common/evas_gl_core_private.h b/src/modules/evas/engines/gl_common/evas_gl_core_private.h index 5c617b6c6..37e8cc512 100644 --- a/src/modules/evas/engines/gl_common/evas_gl_core_private.h +++ b/src/modules/evas/engines/gl_common/evas_gl_core_private.h @@ -209,13 +209,26 @@ struct _EVGL_Resource EVGL_Context *current_ctx; void *current_eng; - EVGLNative_Surface direct_surface; - int direct_rendered; - Evas_Object *direct_img_obj; - int get_pixels_set; + struct { + EVGLNative_Surface surface; + int rendered; + //Evas_Object *img; - int master_clip; - int clip[4]; + int rot; + int win_w; + int win_h; + + struct { + int x, y, w, h; + } img; + + struct { + int x, y, w, h; + } clip; + + Eina_Bool enabled : 1; + + } direct; }; struct _EVGL_Engine diff --git a/src/modules/evas/engines/gl_x11/evas_engine.c b/src/modules/evas/engines/gl_x11/evas_engine.c index f1a41e5a3..b708bf8fe 100644 --- a/src/modules/evas/engines/gl_x11/evas_engine.c +++ b/src/modules/evas/engines/gl_x11/evas_engine.c @@ -2913,24 +2913,21 @@ eng_image_draw(void *data, void *context, void *surface, void *image, int src_x, re->win->gl_context->dc = context; - if (re->func.get_pixels) - { - - // Pass the clip info the evas_gl - evgl_direct_img_clip_set(1, - re->win->gl_context->dc->clip.x, - re->win->gl_context->dc->clip.y, - re->win->gl_context->dc->clip.w, - re->win->gl_context->dc->clip.h); - - // Call pixel get function - evgl_direct_img_obj_set(re->func.obj, re->win->gl_context->rot); - re->func.get_pixels(re->func.get_pixels_data, re->func.obj); - evgl_direct_img_obj_set(NULL, 0); - - // Reset clip - evgl_direct_img_clip_set(0, 0, 0, 0, 0); - } + // Set necessary info for direct rendering + evgl_direct_info_set(re->win->gl_context->w, + re->win->gl_context->h, + re->win->gl_context->rot, + dst_x, dst_y, dst_w, dst_h, + re->win->gl_context->dc->clip.x, + re->win->gl_context->dc->clip.y, + re->win->gl_context->dc->clip.w, + re->win->gl_context->dc->clip.h); + + // Call pixel get function + re->func.get_pixels(re->func.get_pixels_data, re->func.obj); + + // Clear direct rendering info + evgl_direct_info_clear(); } else { diff --git a/src/modules/evas/engines/wayland_egl/evas_engine.c b/src/modules/evas/engines/wayland_egl/evas_engine.c index a370825b2..f5acf968e 100644 --- a/src/modules/evas/engines/wayland_egl/evas_engine.c +++ b/src/modules/evas/engines/wayland_egl/evas_engine.c @@ -2018,20 +2018,21 @@ eng_image_draw(void *data, void *context, void *surface, void *image, int src_x, re->win->gl_context->dc = context; - // Pass the clip info the evas_gl - evgl_direct_img_clip_set(1, - re->win->gl_context->dc->clip.x, - re->win->gl_context->dc->clip.y, - re->win->gl_context->dc->clip.w, - re->win->gl_context->dc->clip.h); + // Set necessary info for direct rendering + evgl_direct_info_set(re->win->gl_context->w, + re->win->gl_context->h, + re->win->gl_context->rot, + dst_x, dst_y, dst_w, dst_h, + re->win->gl_context->dc->clip.x, + re->win->gl_context->dc->clip.y, + re->win->gl_context->dc->clip.w, + re->win->gl_context->dc->clip.h); // Call pixel get function - evgl_direct_img_obj_set(re->func.obj, re->win->gl_context->rot); re->func.pixels_get(re->func.pixels_data_get, re->func.obj); - evgl_direct_img_obj_set(NULL, 0); - // Reset clip - evgl_direct_img_clip_set(0, 0, 0, 0, 0); + // Clear direct rendering info + evgl_direct_info_clear(); } else { |