diff include/mb_redraw_man.h @ 490:5d0b2761f89c Android_Skia

Reset stroke and fill for shapes when a paint is freed. - reset stroke or/and fill of shapes with a freeing paint. - remove a shape from member lists of paints of stroke and fill when the shape being freed.
author Thinker K.F. Li <thinker@branda.to>
date Mon, 23 Nov 2009 18:04:22 +0800
parents af4b506ad56f
children 4291f16f3a09
line wrap: on
line diff
--- a/include/mb_redraw_man.h	Sun Nov 22 20:41:27 2009 +0800
+++ b/include/mb_redraw_man.h	Mon Nov 23 18:04:22 2009 +0800
@@ -157,25 +157,31 @@
 #define _rdman_paint_remove_child(rdman, paint, shape)		\
     do {							\
 	if((shape)->fill == (shape)->stroke &&			\
-	   (shape)->stroke == paint)				\
+	   (shape)->stroke == (paint))				\
 	    break;						\
 	_rdman_paint_real_remove_child(rdman, paint, shape);	\
     } while(0)
-#define rdman_paint_fill(rdman, paint, shape)		\
-    do {						\
-	if((shape)->fill == paint)			\
-	    break;					\
-	_rdman_paint_remove_child(rdman, paint, shape);	\
-	_rdman_paint_child(rdman, paint, shape);	\
-	(shape)->fill = paint;				\
+#define rdman_paint_fill(rdman, paint, shape)			\
+    do {							\
+	if((shape)->fill == paint)				\
+	    break;						\
+	if((shape)->fill)					\
+	    _rdman_paint_remove_child(rdman, (shape)->fill,	\
+				      shape);			\
+	if(paint)						\
+	    _rdman_paint_child(rdman, paint, shape);		\
+	(shape)->fill = paint;					\
     } while(0)
-#define rdman_paint_stroke(rdman, paint, shape)		\
-    do {						\
-	if((shape)->stroke == paint)			\
-	    break;					\
-	_rdman_paint_remove_child(rdman, paint, shape);	\
-	_rdman_paint_child(rdman, paint, shape);	\
-	(shape)->stroke = paint;			\
+#define rdman_paint_stroke(rdman, paint, shape)			\
+    do {							\
+	if((shape)->stroke == paint)				\
+	    break;						\
+	if((shape)->stroke)					\
+	    _rdman_paint_remove_child(rdman, (shape)->stroke,	\
+				      shape);			\
+	if(paint)						\
+	    _rdman_paint_child(rdman, paint, shape);		\
+	(shape)->stroke = paint;				\
     } while(0)
 extern int rdman_paint_changed(redraw_man_t *rdman, paint_t *paint);