From 10734c8d74bc26043c9714a80468040b8bfa7249 Mon Sep 17 00:00:00 2001 From: Alexander Larsson Date: Thu, 8 Jul 2010 14:46:04 +0200 Subject: 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. --- common/pixman_utils.c | 30 ++---------------------------- 1 file changed, 2 insertions(+), 28 deletions(-) (limited to 'common/pixman_utils.c') 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) -- cgit