changeset 616:7d70a811829b openvg

mbe_fill_preserve() and mbe_reset_scissoring() for OpenVG
author Thinker K.F. Li <thinker@branda.to>
date Thu, 08 Jul 2010 11:37:33 +0800
parents 0f0abc48e10a
children 89fee368e367
files include/mb_graph_engine_openvg.h src/graph_engine_openvg.c
diffstat 2 files changed, 12 insertions(+), 3 deletions(-) [+]
line wrap: on
line diff
--- a/include/mb_graph_engine_openvg.h	Thu Jul 08 11:29:58 2010 +0800
+++ b/include/mb_graph_engine_openvg.h	Thu Jul 08 11:37:33 2010 +0800
@@ -31,7 +31,6 @@
 #define mbe_set_source_rgb(canvas, r, g, b)	\
     mbe_set_source_rgba(canvas, r, g, b, 1)
 #define mbe_get_font_face(canvas) ((mbe_font_face_t *)NULL)
-#define mbe_fill_preserve(canvas)
 #define mbe_copy_source(src_canvas, dst_canvas)
 #define mbe_set_source(canvas, pattern)		\
     do {					\
@@ -39,7 +38,11 @@
 	(canvas)->paint = (pattern)->paint;	\
 	(canvas)->paint_installed = 0;		\
     } while(0)
-#define mbe_reset_scissoring(canvas)
+#define mbe_reset_scissoring(canvas)		\
+    do {					\
+	_MK_CURRENT_CTX(canvas);		\
+	vgSeti(VG_SCISSORING, VG_FALSE);	\
+    } while(0)
 #define mbe_get_target(canvas) ((mbe_surface_t *)(canvas)->tgt)
 #define mbe_close_path(canvas)
 #define mbe_text_path(canvas, utf8)
@@ -232,7 +235,7 @@
 }
 
 static void
-mbe_fill(mbe_t *canvas) {
+mbe_fill_preserve(mbe_t *canvas) {
     _MK_CURRENT_CTX(canvas);
     _MK_CURRENT_PAINT(canvas);
     if(canvas->src)
@@ -240,6 +243,11 @@
 			      VG_MATRIX_FILL_PAINT_TO_USER);
 
     vgDrawPath(canvas->path, VG_FILL_PATH);
+}
+
+static void
+mbe_fill(mbe_t *canvas) {
+    mbe_fill_preserve(canvas);
     vgClearPath(canvas->path, VG_PATH_CAPABILITY_ALL);
 }
 
--- a/src/graph_engine_openvg.c	Thu Jul 08 11:29:58 2010 +0800
+++ b/src/graph_engine_openvg.c	Thu Jul 08 11:37:33 2010 +0800
@@ -262,6 +262,7 @@
 	*coord++ = area->h;
     }
 
+    vgSeti(VG_SCISSORING, VG_TRUE);
     vgSetiv(VG_SCISSOR_RECTS, n_areas * 4, scissors);
 }