# HG changeset patch # User Thinker K.F. Li # Date 1279374263 -28800 # Node ID 608f58b9b84d1a4a66c00a64710d52c6f03a4b94 # Parent e50c4e1116982c09c10c36e935ebc2e744497c92 Use color transform and make compatible with OpenVG 1.0. diff -r e50c4e111698 -r 608f58b9b84d src/graph_engine_openvg.c --- a/src/graph_engine_openvg.c Fri Jul 16 18:44:29 2010 +0800 +++ b/src/graph_engine_openvg.c Sat Jul 17 21:44:23 2010 +0800 @@ -432,8 +432,6 @@ attrib_list[i++] = 8; attrib_list[i++] = EGL_ALPHA_SIZE; attrib_list[i++] = 8; - attrib_list[i++] = EGL_ALPHA_MASK_SIZE; - attrib_list[i++] = 8; break; case MB_IFMT_RGB24: @@ -443,22 +441,16 @@ attrib_list[i++] = 8; attrib_list[i++] = EGL_BLUE_SIZE; attrib_list[i++] = 8; - attrib_list[i++] = EGL_ALPHA_MASK_SIZE; - attrib_list[i++] = 8; break; case MB_IFMT_A8: attrib_list[i++] = EGL_ALPHA_SIZE; attrib_list[i++] = 8; - attrib_list[i++] = EGL_ALPHA_MASK_SIZE; - attrib_list[i++] = 8; break; case MB_IFMT_A1: attrib_list[i++] = EGL_ALPHA_SIZE; attrib_list[i++] = 1; - attrib_list[i++] = EGL_ALPHA_MASK_SIZE; - attrib_list[i++] = 1; break; case MB_IFMT_RGB16_565: @@ -468,8 +460,6 @@ attrib_list[i++] = 6; attrib_list[i++] = EGL_BLUE_SIZE; attrib_list[i++] = 5; - attrib_list[i++] = EGL_ALPHA_MASK_SIZE; - attrib_list[i++] = 5; break; default: @@ -723,8 +713,8 @@ void mbe_paint_with_alpha(mbe_t *canvas, co_comp_t alpha) { + VGfloat color_trans[8] = {1, 1, 1, alpha, 0, 0, 0, 0}; EGLDisplay display; - VGHandle mask; EGLint w, h; EGLBoolean r; @@ -736,18 +726,18 @@ ASSERT(r == EGL_TRUE); r = eglQuerySurface(display, canvas->tgt, EGL_HEIGHT, &h); ASSERT(r == EGL_TRUE); - - /* enable and fill mask layer with alpha value */ - vgSeti(VG_MASKING, VG_TRUE); - mask = vgCreateMaskLayer(w, h); - ASSERT(mask != VG_INVALID_HANDLE); - vgFillMaskLayer(mask, 0, 0, w, h, alpha); - vgMask(mask, VG_SET_MASK, 0, 0, w, h); - vgDestroyMaskLayer(mask); - + + /* Setup color transform for alpha */ +#ifdef OPENVG_1_1 + vgSetfv(VG_COLOR_TRANSFORM_VALUES, 8, color_trans); + vgSeti(VG_COLOR_TRANSFORM, VG_TRUE); +#endif + mbe_paint(canvas); - vgSeti(VG_MASKING, VG_FALSE); +#ifdef OPENVG_1_1 + vgSeti(VG_COLOR_TRANSFORM, VG_FALSE); +#endif } void