diff options
| author | Alexander Larsson <alexl@redhat.com> | 2010-07-08 14:46:04 +0200 |
|---|---|---|
| committer | Marc-André Lureau <marcandre.lureau@gmail.com> | 2012-03-20 15:25:48 +0100 |
| commit | fb935fe73b324a3c8cfda5916920f0ee3a0de2ce (patch) | |
| tree | 451eb01cfd33d6f22a17eb1416c836bbeb49949a | |
| parent | 12a734e33627b1e0c0aee7b26fc1ef510584f5f0 (diff) | |
| download | spice-common-fb935fe73b324a3c8cfda5916920f0ee3a0de2ce.tar.gz spice-common-fb935fe73b324a3c8cfda5916920f0ee3a0de2ce.tar.xz spice-common-fb935fe73b324a3c8cfda5916920f0ee3a0de2ce.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.
| -rw-r--r-- | common/pixman_utils.c | 30 |
1 files changed, 2 insertions, 28 deletions
diff --git a/common/pixman_utils.c b/common/pixman_utils.c index de8706e..bdc18c9 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) |
