# HG changeset patch # User Thinker K.F. Li # Date 1277970749 -28800 # Node ID 3300992b29ff58b12ff8f587de2195f749eb9afb # Parent aaab76730beba8ade512f628266339368b8aa864 Define mbe_clear() for VG diff -r aaab76730beb -r 3300992b29ff include/mb_graph_engine_openvg.h --- a/include/mb_graph_engine_openvg.h Thu Jul 01 14:48:57 2010 +0800 +++ b/include/mb_graph_engine_openvg.h Thu Jul 01 15:52:29 2010 +0800 @@ -62,7 +62,6 @@ #define mbe_move_to(canvas, x, y) #define mbe_line_to(canvas, x, y) #define mbe_in_fill(canvas, x, y) (0) -#define mbe_clear(canvas) #define mbe_save(canvas) #define mbe_arc(canvas, x, y, radius, angle_start, angle_stop) @@ -177,6 +176,7 @@ extern mbe_t *mbe_create(mbe_surface_t *surface); extern void mbe_destroy(mbe_t *canvas); extern void mbe_paint(mbe_t *canvas); +extern void mbe_clear(mbe_t *canvas); static void mbe_stroke(mbe_t *canvas) { diff -r aaab76730beb -r 3300992b29ff src/graph_engine_openvg.c --- a/src/graph_engine_openvg.c Thu Jul 01 14:48:57 2010 +0800 +++ b/src/graph_engine_openvg.c Thu Jul 01 15:52:29 2010 +0800 @@ -267,6 +267,7 @@ canvas->src = NULL; canvas->paint = VG_INVALID_HANDLE; + canvas->paint_installed = 0; canvas->tgt = surface; canvas->ctx = ctx; canvas->path = path; @@ -314,3 +315,22 @@ vgSeti(VG_SCISSORING, VG_TRUE); } +void +mbe_clear(mbe_t *canvas) { + VGPaint paint; + + _MK_CURRENT_CTX(canvas); + + paint = vgCreatePaint(); + ASSERT(paint != VG_INVALID_HANDLE); + vgSetColor(paint, 0); + + 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; +}