changeset 613:6a0be737a3f3 openvg

mbe_clear() use vgClear() to clear regions for OpenVG
author Thinker K.F. Li <thinker@branda.to>
date Wed, 07 Jul 2010 21:55:05 +0800
parents b1d1b6c5af90
children 9c5705da2495
files src/graph_engine_openvg.c
diffstat 1 files changed, 16 insertions(+), 12 deletions(-) [+]
line wrap: on
line diff
--- 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);
 }