# HG changeset patch # User Thinker K.F. Li # Date 1291383872 -28800 # Node ID 7f4dd130a78e3d43f0cf5c4d31cb4c84262b7068 # Parent cd34de1a69604ff29c208d1b6996d68c95c1d36c 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. diff -r cd34de1a6960 -r 7f4dd130a78e src/graph_engine_openvg.c --- 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;