summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSøren Sandmann <sandmann@redhat.com>2008-06-08 22:07:46 -0400
committerSøren Sandmann <sandmann@redhat.com>2008-06-08 22:07:46 -0400
commitde150bf82fbe0e346fa38eae10a5bd43538bb3d9 (patch)
tree1a2968483110b880da9a45a521cca170e518f6ee
parente30f7e2eb56b53667ee83e2cad942f171a9486a0 (diff)
Add pixman_region32_copy_from_region16
-rw-r--r--pixman/pixman-private.h5
-rw-r--r--pixman/pixman-region32.c27
2 files changed, 32 insertions, 0 deletions
diff --git a/pixman/pixman-private.h b/pixman/pixman-private.h
index f4db687..82a0d3c 100644
--- a/pixman/pixman-private.h
+++ b/pixman/pixman-private.h
@@ -694,6 +694,11 @@ pixman_image_can_get_solid (pixman_image_t *image);
#define PIXMAN_EXPORT
#endif
+/* Helper for 32 bit regions */
+pixman_bool_t
+pixman_region32_copy_from_region16 (pixman_region32_t *dst,
+ pixman_region16_t *src);
+
#ifdef PIXMAN_TIMING
/* Timing */
diff --git a/pixman/pixman-region32.c b/pixman/pixman-region32.c
index 5a62b3e..4b5598d 100644
--- a/pixman/pixman-region32.c
+++ b/pixman/pixman-region32.c
@@ -38,4 +38,31 @@ typedef struct {
#define PREFIX(x) pixman_region32##x
+pixman_bool_t
+pixman_region32_copy_from_region16 (pixman_region32_t *dst,
+ pixman_region16_t *src)
+{
+ int n_boxes, i;
+ pixman_box16_t *boxes16;
+ pixman_box32_t *boxes32;
+
+ boxes16 = pixman_region_rectangles (src, &n_boxes);
+
+ boxes32 = pixman_malloc_ab (n_boxes, sizeof (pixman_box32_t));
+
+ if (!boxes32)
+ return FALSE;
+
+ for (i = 0; i < n_boxes; ++i)
+ {
+ boxes32[i].x1 = boxes16[i].x1;
+ boxes32[i].y1 = boxes16[i].y1;
+ boxes32[i].x2 = boxes16[i].x2;
+ boxes32[i].y2 = boxes16[i].y2;
+ }
+
+ pixman_region32_fini (dst);
+ return pixman_region32_init_rects (dst, boxes32, n_boxes);
+}
+
#include "pixman-region.c"