Disable source clipping by default
authorSøren Sandmann <sandmann@redhat.com>
Fri, 15 Jun 2007 04:15:03 +0000 (00:15 -0400)
committerSøren Sandmann <sandmann@redhat.com>
Fri, 15 Jun 2007 04:15:03 +0000 (00:15 -0400)
pixman/pixman-compose.c
pixman/pixman-compute-region.c
pixman/pixman-image.c
pixman/pixman-private.h

index 6293ce9..d761e8f 100644 (file)
@@ -3725,7 +3725,7 @@ static void fbFetchTransformed(bits_image_t * pict, int x, int y, int width, uin
     if (pict->common.filter == PIXMAN_FILTER_NEAREST || pict->common.filter == PIXMAN_FILTER_FAST)
     {
         if (pict->common.repeat == PIXMAN_REPEAT_NORMAL) {
-            if (pixman_region_n_rects (&pict->common.clip_region) == 1) {
+            if (pixman_region_n_rects (pict->common.src_clip) == 1) {
                for (i = 0; i < width; ++i) {
                    if (!mask || mask[i] & maskBits)
                    {
@@ -3761,7 +3761,7 @@ static void fbFetchTransformed(bits_image_t * pict, int x, int y, int width, uin
                                y = MOD(v.vector[1]>>16, pict->height);
                                x = MOD(v.vector[0]>>16, pict->width);
                            }
-                           if (pixman_region_contains_point (&pict->common.clip_region, x, y, &box))
+                           if (pixman_region_contains_point (pict->common.src_clip, x, y, &box))
                                *(buffer + i) = fetch ((pixman_image_t *)pict, bits + y*stride, x, indexed);
                            else
                                *(buffer + i) = 0;
@@ -3774,8 +3774,8 @@ static void fbFetchTransformed(bits_image_t * pict, int x, int y, int width, uin
                 }
             }
         } else {
-            if (pixman_region_n_rects(&pict->common.clip_region) == 1) {
-                box = pict->common.clip_region.extents;
+            if (pixman_region_n_rects(pict->common.src_clip) == 1) {
+                box = pict->common.src_clip->extents;
                 for (i = 0; i < width; ++i) {
                    if (!mask || mask[i] & maskBits)
                    {
@@ -3811,7 +3811,7 @@ static void fbFetchTransformed(bits_image_t * pict, int x, int y, int width, uin
                                y = v.vector[1]>>16;
                                x = v.vector[0]>>16;
                            }
-                           if (pixman_region_contains_point (&pict->common.clip_region, x, y, &box))
+                           if (pixman_region_contains_point (pict->common.src_clip, x, y, &box))
                                *(buffer + i) = fetch((pixman_image_t *)pict, bits + y*stride, x, indexed);
                            else
                                *(buffer + i) = 0;
@@ -3834,7 +3834,7 @@ static void fbFetchTransformed(bits_image_t * pict, int x, int y, int width, uin
         unit.vector[1] -= unit.vector[2] / 2;
        
         if (pict->common.repeat == PIXMAN_REPEAT_NORMAL) {
-            if (pixman_region_n_rects(&pict->common.clip_region) == 1) {
+            if (pixman_region_n_rects(pict->common.src_clip) == 1) {
                 for (i = 0; i < width; ++i) {
                     if (!mask || mask[i] & maskBits)
                    {
@@ -3937,14 +3937,14 @@ static void fbFetchTransformed(bits_image_t * pict, int x, int y, int width, uin
                            
                            b = bits + y1*stride;
                            
-                           tl = pixman_region_contains_point(&pict->common.clip_region, x1, y1, &box)
+                           tl = pixman_region_contains_point(pict->common.src_clip, x1, y1, &box)
                                ? fetch((pixman_image_t *)pict, b, x1, indexed) : 0;
-                           tr = pixman_region_contains_point(&pict->common.clip_region, x2, y1, &box)
+                           tr = pixman_region_contains_point(pict->common.src_clip, x2, y1, &box)
                                ? fetch((pixman_image_t *)pict, b, x2, indexed) : 0;
                            b = bits + (y2)*stride;
-                           bl = pixman_region_contains_point(&pict->common.clip_region, x1, y2, &box)
+                           bl = pixman_region_contains_point(pict->common.src_clip, x1, y2, &box)
                                ? fetch((pixman_image_t *)pict, b, x1, indexed) : 0;
-                           br = pixman_region_contains_point(&pict->common.clip_region, x2, y2, &box)
+                           br = pixman_region_contains_point(pict->common.src_clip, x2, y2, &box)
                                ? fetch((pixman_image_t *)pict, b, x2, indexed) : 0;
                            
                            ft = FbGet8(tl,0) * idistx + FbGet8(tr,0) * distx;
@@ -3969,8 +3969,8 @@ static void fbFetchTransformed(bits_image_t * pict, int x, int y, int width, uin
                 }
             }
         } else {
-            if (pixman_region_n_rects(&pict->common.clip_region) == 1) {
-                box = pict->common.clip_region.extents;
+            if (pixman_region_n_rects(pict->common.src_clip) == 1) {
+                box = pict->common.src_clip->extents;
                 for (i = 0; i < width; ++i) {
                    if (!mask || mask[i] & maskBits)
                    {
@@ -4072,14 +4072,14 @@ static void fbFetchTransformed(bits_image_t * pict, int x, int y, int width, uin
                            b = bits + (y1)*stride;
                            x_off = x1;
                            
-                           tl = pixman_region_contains_point(&pict->common.clip_region, x1, y1, &box)
+                           tl = pixman_region_contains_point(pict->common.src_clip, x1, y1, &box)
                                ? fetch((pixman_image_t *)pict, b, x_off, indexed) : 0;
-                           tr = pixman_region_contains_point(&pict->common.clip_region, x2, y1, &box)
+                           tr = pixman_region_contains_point(pict->common.src_clip, x2, y1, &box)
                                ? fetch((pixman_image_t *)pict, b, x_off + 1, indexed) : 0;
                            b += stride;
-                           bl = pixman_region_contains_point(&pict->common.clip_region, x1, y2, &box)
+                           bl = pixman_region_contains_point(pict->common.src_clip, x1, y2, &box)
                                ? fetch((pixman_image_t *)pict, b, x_off, indexed) : 0;
-                           br = pixman_region_contains_point(&pict->common.clip_region, x2, y2, &box)
+                           br = pixman_region_contains_point(pict->common.src_clip, x2, y2, &box)
                                ? fetch((pixman_image_t *)pict, b, x_off + 1, indexed) : 0;
                            
                            ft = FbGet8(tl,0) * idistx + FbGet8(tr,0) * distx;
@@ -4141,7 +4141,7 @@ static void fbFetchTransformed(bits_image_t * pict, int x, int y, int width, uin
                        for (x = x1; x < x2; x++) {
                            if (*p) {
                                int tx = (pict->common.repeat == PIXMAN_REPEAT_NORMAL) ? MOD (x, pict->width) : x;
-                               if (pixman_region_contains_point (&pict->common.clip_region, tx, ty, &box)) {
+                               if (pixman_region_contains_point (pict->common.src_clip, tx, ty, &box)) {
                                    uint32_t *b = bits + (ty)*stride;
                                    uint32_t c = fetch((pixman_image_t *)pict, b, tx, indexed);
                                    
index d4e0ed6..f9b9de7 100644 (file)
@@ -98,7 +98,7 @@ miClipPictureSrc (pixman_region16_t * pRegion,
            pixman_region_translate ( pRegion, dx, dy);
            
            if (!pixman_region_intersect (pRegion, pRegion, 
-                                         (pixman_region16_t *) &pPicture->common.clip_region))
+                                         (pixman_region16_t *) pPicture->common.src_clip))
                return FALSE;
            
            pixman_region_translate ( pRegion, -dx, -dy);
@@ -109,7 +109,7 @@ miClipPictureSrc (pixman_region16_t *       pRegion,
     else
     {
        return miClipPictureReg (pRegion,
-                                &pPicture->common.clip_region,
+                                pPicture->common.src_clip,
                                 dx,
                                 dy);
     }
index 1eee840..8657c31 100644 (file)
 #include "pixman.h"
 #include "pixman-private.h"
 
-enum
-{
-    PIXMAN_BAD_VALUE,
-    PIXMAN_BAD_ALLOC
-};
-
 static void
 init_source_image (source_image_t *image)
 {
@@ -83,8 +77,10 @@ allocate_image (void)
     if (image)
     {
        image_common_t *common = &image->common;
-       
+
+       pixman_region_init (&common->full_region);
        pixman_region_init (&common->clip_region);
+       common->src_clip = &common->full_region;
        common->has_client_clip = FALSE;
        common->transform = NULL;
        common->repeat = PIXMAN_REPEAT_NONE;
@@ -120,6 +116,7 @@ pixman_image_unref (pixman_image_t *image)
     if (common->ref_count == 0)
     {
        pixman_region_fini (&common->clip_region);
+       pixman_region_fini (&common->full_region);
 
        if (common->transform)
            free (common->transform);
@@ -291,8 +288,7 @@ reset_clip_region (pixman_image_t *image)
     if (image->type == BITS)
     {
        pixman_region_init_rect (&image->common.clip_region, 0, 0,
-                                image->bits.width, image->bits.height);
-       
+                                image->bits.width, image->bits.height);        
     }
     else
     {
@@ -336,8 +332,11 @@ pixman_image_create_bits (pixman_format_code_t  format,
                                                                  */
     image->bits.indexed = NULL;
 
-    reset_clip_region (image);
+    pixman_region_fini (&image->common.full_region);
+    pixman_region_init_rect (&image->common.full_region, 0, 0,
+                            image->bits.width, image->bits.height);
 
+    reset_clip_region (image);
     return image;
 }
 
index 09969fb..bf0579f 100644 (file)
@@ -147,7 +147,9 @@ struct image_common
 {
     image_type_t               type;
     int32_t                    ref_count;
+    pixman_region16_t          full_region;
     pixman_region16_t          clip_region;
+    pixman_region16_t         *src_clip;
     pixman_bool_t               has_client_clip;
     pixman_transform_t        *transform;
     pixman_repeat_t            repeat;