Mercurial > MadButterfly
changeset 1088:7f4dd130a78e openvg
Fix issue of color paints that do not show right color.
It is wrong to check if a canvas having valid color paint since it
check on a uninitialized variable of paint type. The variable is
supposed to be initialized by the paint of the canvas. It is fixed by
initialize the variable correctly.
author | Thinker K.F. Li <thinker@codemud.net> |
---|---|
date | Fri, 03 Dec 2010 21:44:32 +0800 |
parents | cd34de1a6960 |
children | 74f36875980d |
files | src/graph_engine_openvg.c |
diffstat | 1 files changed, 8 insertions(+), 4 deletions(-) [+] |
line wrap: on
line diff
--- a/src/graph_engine_openvg.c Fri Dec 03 18:18:43 2010 +0800 +++ b/src/graph_engine_openvg.c Fri Dec 03 21:44:32 2010 +0800 @@ -409,14 +409,18 @@ 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 = canvas->paint; + if(paint == VG_INVALID_HANDLE || canvas->src != NULL) { + /* previous one is not a color paint */ + if(canvas->src) { + mbe_pattern_destroy(canvas->src); + canvas->src = NULL; + } + paint = vgCreatePaint(); ASSERT(paint != VG_INVALID_HANDLE); vgSetParameteri(paint, VG_PAINT_TYPE, VG_PAINT_TYPE_COLOR); canvas->paint = paint; - canvas->src = NULL; } rgba[0] = r;