summaryrefslogtreecommitdiffstats
path: root/common
diff options
context:
space:
mode:
authorAlexander Larsson <alexl@redhat.com>2010-07-08 14:46:04 +0200
committerAlexander Larsson <alexl@redhat.com>2010-07-08 14:46:04 +0200
commit10734c8d74bc26043c9714a80468040b8bfa7249 (patch)
treee82b136134d51bdf4f2065de8b4d701eb784880a /common
parentc60c995e60d4364d9d5233dbc84b32a118b3b360 (diff)
downloadspice-10734c8d74bc26043c9714a80468040b8bfa7249.tar.gz
spice-10734c8d74bc26043c9714a80468040b8bfa7249.tar.xz
spice-10734c8d74bc26043c9714a80468040b8bfa7249.zip
Simplify spice_pixman_region32_init_rects with new types
Don't manually of SpiceRects to pixman_box32_t now that they are compatible and SpiceRect is internal.
Diffstat (limited to 'common')
-rw-r--r--common/pixman_utils.c30
1 files changed, 2 insertions, 28 deletions
diff --git a/common/pixman_utils.c b/common/pixman_utils.c
index de8706ec..bdc18c93 100644
--- a/common/pixman_utils.c
+++ b/common/pixman_utils.c
@@ -919,34 +919,8 @@ pixman_bool_t spice_pixman_region32_init_rects (pixman_region32_t *region,
const SpiceRect *rects,
int count)
{
- pixman_box32_t boxes_array[10];
- pixman_box32_t *boxes;
- pixman_bool_t res;
- int i;
-
- if (count < 10) {
- boxes = boxes_array;
- } else {
- boxes = spice_new(pixman_box32_t, count);
- if (boxes == NULL) {
- return FALSE;
- }
- }
-
- for (i = 0; i < count; i++) {
- boxes[i].x1 = rects[i].left;
- boxes[i].y1 = rects[i].top;
- boxes[i].x2 = rects[i].right;
- boxes[i].y2 = rects[i].bottom;
- }
-
- res = pixman_region32_init_rects(region, boxes, count);
-
- if (count >= 10) {
- free(boxes);
- }
-
- return res;
+ /* These types are compatible, so just cast */
+ return pixman_region32_init_rects(region, (pixman_box32_t *)rects, count);
}
pixman_format_code_t spice_surface_format_to_pixman(uint32_t surface_format)