Mercurial > MadButterfly
changeset 1087:cd34de1a6960 openvg
Fix issue of incorrect color for color paint.
It is always black (nearly). It is caused by translate RGBA values
from MadButterfly to OpenVG with wrong function.
author | Thinker K.F. Li <thinker@codemud.net> |
---|---|
date | Fri, 03 Dec 2010 18:18:43 +0800 |
parents | 6723b2537993 |
children | 7f4dd130a78e |
files | src/graph_engine_openvg.c src/paint.c |
diffstat | 2 files changed, 14 insertions(+), 7 deletions(-) [+] |
line wrap: on
line diff
--- a/src/graph_engine_openvg.c Fri Dec 03 17:19:08 2010 +0800 +++ b/src/graph_engine_openvg.c Fri Dec 03 18:18:43 2010 +0800 @@ -18,11 +18,6 @@ ERR(func " is not impmemented\n") #endif -#define MB_2_VG_COLOR(r, g, b, a) ((((int)(0xf * r) & 0xf) << 24) | \ - (((int)(0xf * g) & 0xf) << 16) | \ - (((int)(0xf * b) & 0xf) << 16) | \ - ((int)(0xf * a) & 0xf)) - #define MK_ID(mtx) \ do { \ (mtx)[0] = 1; \ @@ -412,18 +407,23 @@ co_comp_t b, co_comp_t a) { VGPaint paint; VGuint color; + VGfloat rgba[4]; if(paint != VG_INVALID_HANDLE && canvas->src == NULL) paint = canvas->paint; /* previous one is also a color paint */ else { paint = vgCreatePaint(); ASSERT(paint != VG_INVALID_HANDLE); + vgSetParameteri(paint, VG_PAINT_TYPE, VG_PAINT_TYPE_COLOR); canvas->paint = paint; canvas->src = NULL; } - color = MB_2_VG_COLOR(r, g, b, a); - vgSetColor(paint, color); + rgba[0] = r; + rgba[1] = g; + rgba[2] = b; + rgba[3] = a; + vgSetParameterfv(paint, VG_PAINT_COLOR, 4, rgba); canvas->paint_installed = 0; }
--- a/src/paint.c Fri Dec 03 17:19:08 2010 +0800 +++ b/src/paint.c Fri Dec 03 18:18:43 2010 +0800 @@ -182,6 +182,11 @@ #define RDF_DIRTY 0x1 +#define pnt_radial_clear_flags(radial, _flags) \ + do { \ + (radial)->flags &= ~(_flags); \ + } while(0) + int _paint_radial_size = sizeof(paint_radial_t); static void paint_radial_prepare(paint_t *paint, mbe_t *cr, shape_t *sh) { @@ -205,6 +210,8 @@ if(radial->ptn) mbe_pattern_destroy(radial->ptn); radial->ptn = ptn; + + pnt_radial_clear_flags(radial, RDF_DIRTY); } mbe_set_source(cr, radial->ptn); }