jpeg pushed a commit to branch master.

http://git.enlightenment.org/core/efl.git/commit/?id=9db20800a2c0e517977226cd8f23d9ac49c6547a

commit 9db20800a2c0e517977226cd8f23d9ac49c6547a
Author: Jean-Philippe Andre <jp.an...@samsung.com>
Date:   Fri Jul 10 12:37:27 2015 +0900

    Evas GL: Fix glClear(0,0,0,0) with DR and COPY
    
    When glClear is called in direct rendering move (DR), we usually
    have to skip the call altogether because clearing out transparency
    would erase the pixels in the evas backbuffer. This means Evas
    would not be able to blend an RGBA GLView on top of other objects.
    
    But COPY mode should allow Evas GL to poke holes in a window
    backbuffer.
    
    Thanks @spacegrapher for the review :)
    
    NOTE: Elm GLView also needs to pass the render op to its Evas.Image.
    
    @fix
---
 src/modules/evas/engines/gl_common/evas_gl_api.c          | 4 +++-
 src/modules/evas/engines/gl_common/evas_gl_core.c         | 4 +++-
 src/modules/evas/engines/gl_common/evas_gl_core.h         | 2 +-
 src/modules/evas/engines/gl_common/evas_gl_core_private.h | 1 +
 src/modules/evas/engines/gl_generic/evas_engine.c         | 1 +
 5 files changed, 9 insertions(+), 3 deletions(-)

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 2d75586..8597bf8 100644
--- a/src/modules/evas/engines/gl_common/evas_gl_api.c
+++ b/src/modules/evas/engines/gl_common/evas_gl_api.c
@@ -366,8 +366,10 @@ _evgl_glClear(GLbitfield mask)
              /* Skip glClear() if clearing with transparent color
               * Note: There will be side effects if the object itself is not
               * marked as having an alpha channel!
+              * COPY mode forces the normal behaviour of glClear().
               */
-             if (ctx->current_sfc->alpha && (mask & GL_COLOR_BUFFER_BIT))
+             if (ctx->current_sfc->alpha && !rsc->direct.render_op_copy &&
+                 (mask & GL_COLOR_BUFFER_BIT))
                {
                   if ((rsc->clear_color.a == 0) &&
                       (rsc->clear_color.r == 0) &&
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 33ef45a..809c63d 100644
--- a/src/modules/evas/engines/gl_common/evas_gl_core.c
+++ b/src/modules/evas/engines/gl_common/evas_gl_core.c
@@ -2744,7 +2744,7 @@ 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 *surface)
+                     int render_op, void *surface)
 {
    EVGL_Resource *rsc;
    EVGL_Surface *sfc = surface;
@@ -2783,6 +2783,8 @@ evgl_direct_info_set(int win_w, int win_h, int rot,
         rsc->direct.clip.y  = clip_y;
         rsc->direct.clip.w  = clip_w;
         rsc->direct.clip.h  = clip_h;
+
+        rsc->direct.render_op_copy = (render_op == EVAS_RENDER_COPY);
      }
    else
      {
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 cf2b325..991cae6 100644
--- a/src/modules/evas/engines/gl_common/evas_gl_core.h
+++ b/src/modules/evas/engines/gl_common/evas_gl_core.h
@@ -73,7 +73,7 @@ void         evgl_direct_override_get(Eina_Bool *override, 
Eina_Bool *force_off)
 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 *surface);
+                                  int render_op, void *surface);
 void         evgl_direct_info_clear(void);
 void         evgl_get_pixels_pre(void);
 void         evgl_get_pixels_post(void);
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 8b1adc2..6498b1a 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
@@ -289,6 +289,7 @@ struct _EVGL_Resource
 
         Eina_Bool            enabled : 1;
         Eina_Bool            in_get_pixels : 1;
+        Eina_Bool            render_op_copy : 1;
    } direct;
    struct {
         GLclampf r, g, b, a;
diff --git a/src/modules/evas/engines/gl_generic/evas_engine.c 
b/src/modules/evas/engines/gl_generic/evas_engine.c
index 280a5f3..473f3f6 100644
--- a/src/modules/evas/engines/gl_generic/evas_engine.c
+++ b/src/modules/evas/engines/gl_generic/evas_engine.c
@@ -1060,6 +1060,7 @@ eng_image_draw(void *data, void *context, void *surface, 
void *image, int src_x,
                              gl_context->dc->clip.y,
                              gl_context->dc->clip.w,
                              gl_context->dc->clip.h,
+                             gl_context->dc->render_op,
                              direct_surface);
 
         // Call pixel get function

-- 


Reply via email to