ector: fix pre multiplied color issue with FreeType backend.
Signed-off-by: Cedric BAIL <cedric@osg.samsung.com>
This commit is contained in:
parent
bc7833e785
commit
5753b43812
|
@ -89,18 +89,6 @@ _ector_comp_func_source_over(uint *dest, uint *src, int length, uint const_alpha
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
static inline uint
|
|
||||||
_ector_premultiply(uint data)
|
|
||||||
{
|
|
||||||
DATA32 a = 1 + (data >> 24);
|
|
||||||
data = ( data & 0xff000000) +
|
|
||||||
(((((data) >> 8) & 0xff) * a) & 0xff00) +
|
|
||||||
(((((data) & 0x00ff00ff) * a) >> 8) & 0x00ff00ff);
|
|
||||||
|
|
||||||
return data;
|
|
||||||
}
|
|
||||||
|
|
||||||
static inline uint
|
static inline uint
|
||||||
INTERPOLATE_PIXEL_256(uint x, uint a, uint y, uint b) {
|
INTERPOLATE_PIXEL_256(uint x, uint a, uint y, uint b) {
|
||||||
uint t = (x & 0xff00ff) * a + (y & 0xff00ff) * b;
|
uint t = (x & 0xff00ff) * a + (y & 0xff00ff) * b;
|
||||||
|
|
|
@ -82,7 +82,6 @@ _generate_gradient_color_table(Efl_Gfx_Gradient_Stop *gradient_stops, int stop_c
|
||||||
uint current_color = ECTOR_ARGB_JOIN(curr->a, curr->r, curr->g, curr->b);
|
uint current_color = ECTOR_ARGB_JOIN(curr->a, curr->r, curr->g, curr->b);
|
||||||
double incr = 1.0 / (double)size;
|
double incr = 1.0 / (double)size;
|
||||||
double fpos = 1.5 * incr;
|
double fpos = 1.5 * incr;
|
||||||
current_color = _ector_premultiply(current_color);
|
|
||||||
|
|
||||||
colorTable[pos++] = current_color;
|
colorTable[pos++] = current_color;
|
||||||
|
|
||||||
|
@ -99,7 +98,6 @@ _generate_gradient_color_table(Efl_Gfx_Gradient_Stop *gradient_stops, int stop_c
|
||||||
next = (gradient_stops + i + 1);
|
next = (gradient_stops + i + 1);
|
||||||
double delta = 1/(next->offset - curr->offset);
|
double delta = 1/(next->offset - curr->offset);
|
||||||
uint next_color = ECTOR_ARGB_JOIN(next->a, next->r, next->g, next->b);
|
uint next_color = ECTOR_ARGB_JOIN(next->a, next->r, next->g, next->b);
|
||||||
next_color = _ector_premultiply(next_color);
|
|
||||||
BLEND_FUNC func = &_ease_linear;
|
BLEND_FUNC func = &_ease_linear;
|
||||||
while (fpos < next->offset && pos < size)
|
while (fpos < next->offset && pos < size)
|
||||||
{
|
{
|
||||||
|
@ -113,12 +111,11 @@ _generate_gradient_color_table(Efl_Gfx_Gradient_Stop *gradient_stops, int stop_c
|
||||||
current_color = next_color;
|
current_color = next_color;
|
||||||
}
|
}
|
||||||
|
|
||||||
uint last_color = _ector_premultiply(current_color);
|
|
||||||
for (;pos < size; ++pos)
|
for (;pos < size; ++pos)
|
||||||
colorTable[pos] = last_color;
|
colorTable[pos] = current_color;
|
||||||
|
|
||||||
// Make sure the last color stop is represented at the end of the table
|
// Make sure the last color stop is represented at the end of the table
|
||||||
colorTable[size-1] = last_color;
|
colorTable[size-1] = current_color;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -482,9 +482,7 @@ void ector_software_rasterizer_clip_shape_set(Software_Rasterizer *rasterizer, S
|
||||||
|
|
||||||
void ector_software_rasterizer_color_set(Software_Rasterizer *rasterizer, int r, int g, int b, int a)
|
void ector_software_rasterizer_color_set(Software_Rasterizer *rasterizer, int r, int g, int b, int a)
|
||||||
{
|
{
|
||||||
uint color = ECTOR_ARGB_JOIN(a, r, g, b);
|
rasterizer->fillData.color = ECTOR_ARGB_JOIN(a, r, g, b);
|
||||||
|
|
||||||
rasterizer->fillData.color = _ector_premultiply(color);
|
|
||||||
rasterizer->fillData.type = Solid;
|
rasterizer->fillData.type = Solid;
|
||||||
}
|
}
|
||||||
void ector_software_rasterizer_linear_gradient_set(Software_Rasterizer *rasterizer, Ector_Renderer_Software_Gradient_Data *linear)
|
void ector_software_rasterizer_linear_gradient_set(Software_Rasterizer *rasterizer, Ector_Renderer_Software_Gradient_Data *linear)
|
||||||
|
|
Loading…
Reference in New Issue