summaryrefslogtreecommitdiff
path: root/src/lib/ector
diff options
context:
space:
mode:
authorJunsuChoi <jsuya.choi@samsung.com>2019-06-20 16:07:05 +0900
committerHermet Park <hermetpark@gmail.com>2019-06-20 16:07:05 +0900
commitc7b1a40b5ec2d63ce32be3d78e60ea1f3206140a (patch)
tree08ff2ad827d7258ae93cd3205f46a0fd75119dc2 /src/lib/ector
parentc27c4692043140fef014dad3ff18c88c929772d8 (diff)
ector: Fix precomp layer rendering issue when it has alpha value
Summary: When the precomp layer(parent layer) has alpha transparency and has more than 1 child layer and they overlap each other if vg object just propagate the alpha to child layer it will be applied twice in overlapped area. Even if the child layer does not have alpha transparency, parent alpha is applied to each child. Test Plan: N/A Reviewers: Hermet, smohanty Reviewed By: Hermet Subscribers: cedric, #reviewers, kimcinoo, #committers Tags: #efl Differential Revision: https://phab.enlightenment.org/D9072
Diffstat (limited to 'src/lib/ector')
-rw-r--r--src/lib/ector/ector_surface.eo10
-rw-r--r--src/lib/ector/software/ector_software_private.h1
-rw-r--r--src/lib/ector/software/ector_software_surface.c26
-rw-r--r--src/lib/ector/software/ector_software_surface.eo1
4 files changed, 38 insertions, 0 deletions
diff --git a/src/lib/ector/ector_surface.eo b/src/lib/ector/ector_surface.eo
index 0dcfff2..67a4813 100644
--- a/src/lib/ector/ector_surface.eo
+++ b/src/lib/ector/ector_surface.eo
@@ -21,5 +21,15 @@ mixin @beta Ector.Surface extends Ector.Buffer
21 @in type: const(Efl.Class); [[Efl class]] /* FIXME: Should probably be a more restricted type */ 21 @in type: const(Efl.Class); [[Efl class]] /* FIXME: Should probably be a more restricted type */
22 } 22 }
23 } 23 }
24 draw_image @pure_virtual {
25 [[ Draw image's buffer to surface buffer. ]]
26 params {
27 @in image: Ector.Buffer; [[Image buffer]]
28 @in x: int; [[Buffer position x]]
29 @in y: int; [[Buffer position y]]
30 @in alpha: int; [[Buffer alpha value]]
31 }
32 return: bool; [[True if drawing was successful]]
33 }
24 } 34 }
25} 35}
diff --git a/src/lib/ector/software/ector_software_private.h b/src/lib/ector/software/ector_software_private.h
index 34ea003..62d1c3f 100644
--- a/src/lib/ector/software/ector_software_private.h
+++ b/src/lib/ector/software/ector_software_private.h
@@ -5,6 +5,7 @@
5#include "sw_ft_raster.h" 5#include "sw_ft_raster.h"
6#include "sw_ft_stroker.h" 6#include "sw_ft_stroker.h"
7#include "../ector_private.h" 7#include "../ector_private.h"
8#include "draw.h"
8 9
9typedef struct _Ector_Software_Surface_Data Ector_Software_Surface_Data; 10typedef struct _Ector_Software_Surface_Data Ector_Software_Surface_Data;
10typedef struct _Ector_Software_Thread Ector_Software_Thread; 11typedef struct _Ector_Software_Thread Ector_Software_Thread;
diff --git a/src/lib/ector/software/ector_software_surface.c b/src/lib/ector/software/ector_software_surface.c
index 10cf996..08a2786 100644
--- a/src/lib/ector/software/ector_software_surface.c
+++ b/src/lib/ector/software/ector_software_surface.c
@@ -245,5 +245,31 @@ _ector_software_surface_ector_surface_reference_point_set(Eo *obj EINA_UNUSED,
245 pd->y = y; 245 pd->y = y;
246} 246}
247 247
248static Eina_Bool
249_ector_software_surface_ector_surface_draw_image(Eo *obj EINA_UNUSED,
250 Ector_Software_Surface_Data *pd,
251 Ector_Buffer *buffer, int x, int y, int alpha)
252{
253 if (!buffer || !pd->rasterizer || !pd->rasterizer->fill_data.raster_buffer->pixels.u32)
254 return EINA_FALSE;
255
256 Ector_Software_Buffer_Base_Data *bd = efl_data_scope_get(buffer, ECTOR_SOFTWARE_BUFFER_BASE_MIXIN);
257 const int pix_stride = pd->rasterizer->fill_data.raster_buffer->stride / 4;
258
259 uint32_t *src = bd->pixels.u32;
260 for (unsigned int local_y = 0; local_y < bd->generic->h; local_y++)
261 {
262 uint32_t *dst = pd->rasterizer->fill_data.raster_buffer->pixels.u32 + (x + ((local_y + y) * pix_stride));
263 for (unsigned int local_x = 0; local_x < bd->generic->w; local_x++)
264 {
265 *src = draw_mul_256(alpha, *src);
266 int inv_alpha = 255 - ((*src) >> 24);
267 *dst = *src + draw_mul_256(inv_alpha, *dst);
268 dst++;
269 src++;
270 }
271 }
272 return EINA_TRUE;
273}
248#include "ector_software_surface.eo.c" 274#include "ector_software_surface.eo.c"
249#include "ector_renderer_software.eo.c" 275#include "ector_renderer_software.eo.c"
diff --git a/src/lib/ector/software/ector_software_surface.eo b/src/lib/ector/software/ector_software_surface.eo
index 77d6db2..6212640 100644
--- a/src/lib/ector/software/ector_software_surface.eo
+++ b/src/lib/ector/software/ector_software_surface.eo
@@ -6,6 +6,7 @@ class @beta Ector.Software.Surface extends Ector.Software.Buffer implements Ecto
6 implements { 6 implements {
7 Ector.Surface.renderer_factory_new; 7 Ector.Surface.renderer_factory_new;
8 Ector.Surface.reference_point { set; } 8 Ector.Surface.reference_point { set; }
9 Ector.Surface.draw_image;
9 Efl.Object.destructor; 10 Efl.Object.destructor;
10 Efl.Object.constructor; 11 Efl.Object.constructor;
11 } 12 }