# HG changeset patch # User Thinker K.F. Li # Date 1278510905 -28800 # Node ID 6a0be737a3f36c5852f0b9562d60af63f6361ac7 # Parent b1d1b6c5af90650ed3672b333ce23939ea0e3610 mbe_clear() use vgClear() to clear regions for OpenVG diff -r b1d1b6c5af90 -r 6a0be737a3f3 src/graph_engine_openvg.c --- a/src/graph_engine_openvg.c Wed Jul 07 18:44:17 2010 +0800 +++ b/src/graph_engine_openvg.c Wed Jul 07 21:55:05 2010 +0800 @@ -483,6 +483,7 @@ EGLContext ctx, shared; VGPath path; EGLint attrib_list[2] = {EGL_NONE}; + static VGfloat clear_color[4] = {0, 0, 0, 1}; mbe_t *canvas; display = _VG_DISPLAY(); @@ -510,6 +511,10 @@ canvas->tgt = surface; canvas->ctx = ctx; canvas->path = path; + + /* Set clear color for the context */ + _MK_CURRENT_CTX(canvas); + vgSetfv(VG_CLEAR_COLOR, 4, clear_color); return canvas; } @@ -593,20 +598,19 @@ void mbe_clear(mbe_t *canvas) { - VGPaint paint; + EGLDisplay display; + EGLint w, h; + EGLBoolean r; _MK_CURRENT_CTX(canvas); - paint = vgCreatePaint(); - ASSERT(paint != VG_INVALID_HANDLE); - vgSetColor(paint, 0); + display = _VG_DISPLAY(); - vgSetPaint(paint, VG_FILL_PATH); - vgSeti(VG_BLEND_MODE, VG_BLEND_SRC); - vgDrawPath(canvas->path, VG_FILL_PATH); - vgSeti(VG_BLEND_MODE, VG_BLEND_SRC_OVER); - - vgDestroyPaint(paint); - - canvas->paint_installed = 0; + r = eglQuerySurface(display, canvas->tgt, EGL_WIDTH, &w); + ASSERT(r == EGL_TRUE); + r = eglQuerySurface(display, canvas->tgt, EGL_HEIGHT, &h); + ASSERT(r == EGL_TRUE); + + /* Clear regions to the color specified by mbe_create() */ + vgClear(0, 0, w, h); }