Optimize fill rectangles in the op=PIXMAN_OP_CLEAR case
authorSøren Sandmann Pedersen <sandmann@redhat.com>
Sun, 17 Jun 2007 05:00:07 +0000 (01:00 -0400)
committerSøren Sandmann Pedersen <sandmann@redhat.com>
Sun, 17 Jun 2007 05:00:07 +0000 (01:00 -0400)
pixman/pixman-image.c

index d54e438..2bc3ef6 100644 (file)
@@ -570,18 +570,32 @@ pixman_image_fill_rectangles (pixman_op_t             op,
                              int                           n_rects,
                              const pixman_rectangle16_t   *rects)
 {
-    pixman_image_t *solid = pixman_image_create_solid_fill (color);
+    pixman_image_t *solid;
+    pixman_color_t c;
     int i;
     
-    if (!solid)
-       return FALSE;
-
     if (color->alpha == 0xffff)
     {
        if (op == PIXMAN_OP_OVER)
            op = PIXMAN_OP_SRC;
     }
 
+    if (op == PIXMAN_OP_CLEAR)
+    {
+       c.red = 0;
+       c.green = 0;
+       c.blue = 0;
+       c.alpha = 0;
+
+       color = &c;
+       
+       op = PIXMAN_OP_SRC;
+    }
+
+    solid = pixman_image_create_solid_fill (color);
+    if (!solid)
+       return FALSE;
+
     for (i = 0; i < n_rects; ++i)
     {
        const pixman_rectangle16_t *rect = &(rects[i]);