Move region helpers into pixman-utils.c
authorSøren Sandmann Pedersen <sandmann@redhat.com>
Mon, 22 Jun 2009 02:12:25 +0000 (22:12 -0400)
committerSøren Sandmann Pedersen <sandmann@redhat.com>
Mon, 22 Jun 2009 02:36:15 +0000 (22:36 -0400)
pixman/pixman-region16.c
pixman/pixman-region32.c
pixman/pixman-utils.c

index 2925b19..13f739a 100644 (file)
@@ -42,36 +42,6 @@ typedef struct {
 
 #define PREFIX(x) pixman_region##x
 
-pixman_bool_t
-pixman_region16_copy_from_region32 (pixman_region16_t *dst,
-                                   pixman_region32_t *src)
-{
-    int n_boxes, i;
-    pixman_box32_t *boxes32;
-    pixman_box16_t *boxes16;
-    pixman_bool_t retval;
-    
-    boxes32 = pixman_region32_rectangles (src, &n_boxes);
-
-    boxes16 = pixman_malloc_ab (n_boxes, sizeof (pixman_box16_t));
-
-    if (!boxes16)
-       return FALSE;
-    
-    for (i = 0; i < n_boxes; ++i)
-    {
-       boxes16[i].x1 = boxes32[i].x1;
-       boxes16[i].y1 = boxes32[i].y1;
-       boxes16[i].x2 = boxes32[i].x2;
-       boxes16[i].y2 = boxes32[i].y2;
-    }
-
-    pixman_region_fini (dst);
-    retval = pixman_region_init_rects (dst, boxes16, n_boxes);
-    free (boxes16);
-    return retval;
-}
-
 #include "pixman-region.c"
 
 /* This function exists only to make it possible to preserve the X ABI - it should
index aac74f6..aeee86c 100644 (file)
@@ -40,43 +40,4 @@ typedef struct {
 
 #define PREFIX(x) pixman_region32##x
 
-#define N_TMP_BOXES (16)
-
-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;
-    pixman_box32_t tmp_boxes[N_TMP_BOXES];
-    pixman_bool_t retval;
-    
-    boxes16 = pixman_region_rectangles (src, &n_boxes);
-
-    if (n_boxes > N_TMP_BOXES)
-       boxes32 = pixman_malloc_ab (n_boxes, sizeof (pixman_box32_t));
-    else
-       boxes32 = tmp_boxes;
-    
-    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);
-    retval = pixman_region32_init_rects (dst, boxes32, n_boxes);
-
-    if (boxes32 != tmp_boxes)
-       free (boxes32);
-
-    return retval;
-}
-
 #include "pixman-region.c"
index af81525..fdd2426 100644 (file)
@@ -696,3 +696,73 @@ _pixman_run_fast_path (const pixman_fast_path_t *paths,
     
     return result;
 }
+
+#define N_TMP_BOXES (16)
+
+pixman_bool_t
+pixman_region16_copy_from_region32 (pixman_region16_t *dst,
+                                   pixman_region32_t *src)
+{
+    int n_boxes, i;
+    pixman_box32_t *boxes32;
+    pixman_box16_t *boxes16;
+    pixman_bool_t retval;
+    
+    boxes32 = pixman_region32_rectangles (src, &n_boxes);
+
+    boxes16 = pixman_malloc_ab (n_boxes, sizeof (pixman_box16_t));
+
+    if (!boxes16)
+       return FALSE;
+    
+    for (i = 0; i < n_boxes; ++i)
+    {
+       boxes16[i].x1 = boxes32[i].x1;
+       boxes16[i].y1 = boxes32[i].y1;
+       boxes16[i].x2 = boxes32[i].x2;
+       boxes16[i].y2 = boxes32[i].y2;
+    }
+
+    pixman_region_fini (dst);
+    retval = pixman_region_init_rects (dst, boxes16, n_boxes);
+    free (boxes16);
+    return retval;
+}
+
+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;
+    pixman_box32_t tmp_boxes[N_TMP_BOXES];
+    pixman_bool_t retval;
+    
+    boxes16 = pixman_region_rectangles (src, &n_boxes);
+
+    if (n_boxes > N_TMP_BOXES)
+       boxes32 = pixman_malloc_ab (n_boxes, sizeof (pixman_box32_t));
+    else
+       boxes32 = tmp_boxes;
+    
+    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);
+    retval = pixman_region32_init_rects (dst, boxes32, n_boxes);
+
+    if (boxes32 != tmp_boxes)
+       free (boxes32);
+
+    return retval;
+}
+