Mercurial > MadButterfly
diff src/graph_engine_openvg.c @ 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 |
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; }