pixman: Branch 'master' - 5 commits
Benjamin Otte
company at kemper.freedesktop.org
Tue Jan 26 11:24:41 PST 2010
pixman/pixman-region.c | 2
pixman/pixman.c | 157 +++++++++++++++++++++++++++++++++----------------
pixman/pixman.h | 23 ++++++-
3 files changed, 128 insertions(+), 54 deletions(-)
New commits:
commit 0e8550798f69ef69dbde59eda6341ab4e0801069
Author: Benjamin Otte <otte at redhat.com>
Date: Tue Jan 26 19:37:34 2010 +0100
Make pixman_image_fill_rectangles() call pixman_image_fill_boxes()
Avoids duplication of code
diff --git a/pixman/pixman.c b/pixman/pixman.c
index 870d2c6..9ab875d 100644
--- a/pixman/pixman.c
+++ b/pixman/pixman.c
@@ -28,6 +28,8 @@
#endif
#include "pixman-private.h"
+#include <stdlib.h>
+
/*
* Operator optimizations based on source or destination opacity
*/
@@ -341,84 +343,36 @@ pixman_image_fill_rectangles (pixman_op_t op,
int n_rects,
const pixman_rectangle16_t *rects)
{
- pixman_image_t *solid;
- pixman_color_t c;
+ pixman_box32_t stack_boxes[6];
+ pixman_box32_t *boxes;
+ pixman_bool_t result;
int i;
- _pixman_image_validate (dest);
-
- if (color->alpha == 0xffff)
+ if (n_rects > 6)
{
- if (op == PIXMAN_OP_OVER)
- op = PIXMAN_OP_SRC;
- }
-
- if (op == PIXMAN_OP_CLEAR)
- {
- c.red = 0;
- c.green = 0;
- c.blue = 0;
- c.alpha = 0;
-
- color = &c;
-
- op = PIXMAN_OP_SRC;
+ boxes = pixman_malloc_ab (sizeof (pixman_box32_t), n_rects);
+ if (boxes == NULL)
+ return FALSE;
}
-
- if (op == PIXMAN_OP_SRC)
+ else
{
- uint32_t pixel;
-
- if (color_to_pixel (color, &pixel, dest->bits.format))
- {
- for (i = 0; i < n_rects; ++i)
- {
- pixman_region32_t fill_region;
- int n_boxes, j;
- pixman_box32_t *boxes;
-
- pixman_region32_init_rect (&fill_region, rects[i].x, rects[i].y, rects[i].width, rects[i].height);
-
- if (dest->common.have_clip_region)
- {
- if (!pixman_region32_intersect (&fill_region,
- &fill_region,
- &dest->common.clip_region))
- return FALSE;
- }
-
- boxes = pixman_region32_rectangles (&fill_region, &n_boxes);
- for (j = 0; j < n_boxes; ++j)
- {
- const pixman_box32_t *box = &(boxes[j]);
- pixman_fill (dest->bits.bits, dest->bits.rowstride, PIXMAN_FORMAT_BPP (dest->bits.format),
- box->x1, box->y1, box->x2 - box->x1, box->y2 - box->y1,
- pixel);
- }
-
- pixman_region32_fini (&fill_region);
- }
- return TRUE;
- }
+ boxes = stack_boxes;
}
- solid = pixman_image_create_solid_fill (color);
- if (!solid)
- return FALSE;
-
for (i = 0; i < n_rects; ++i)
{
- const pixman_rectangle16_t *rect = &(rects[i]);
-
- pixman_image_composite (op, solid, NULL, dest,
- 0, 0, 0, 0,
- rect->x, rect->y,
- rect->width, rect->height);
+ boxes[i].x1 = rects[i].x;
+ boxes[i].y1 = rects[i].y;
+ boxes[i].x2 = boxes[i].x1 + rects[i].width;
+ boxes[i].y2 = boxes[i].y1 + rects[i].height;
}
- pixman_image_unref (solid);
+ result = pixman_image_fill_boxes (op, dest, color, n_rects, boxes);
- return TRUE;
+ if (boxes != stack_boxes)
+ free (boxes);
+
+ return result;
}
PIXMAN_EXPORT pixman_bool_t
commit d0d284da0a8810e7435b8e932ac5de352793a39a
Author: Benjamin Otte <otte at redhat.com>
Date: Tue Jan 26 19:03:38 2010 +0100
Add pixman_image_fill_boxes() API
It's basically the 32bit version of pixman_image_fill_rectangles(), just
with a saner data type.
diff --git a/pixman/pixman.c b/pixman/pixman.c
index 6b28093..870d2c6 100644
--- a/pixman/pixman.c
+++ b/pixman/pixman.c
@@ -421,6 +421,91 @@ pixman_image_fill_rectangles (pixman_op_t op,
return TRUE;
}
+PIXMAN_EXPORT pixman_bool_t
+pixman_image_fill_boxes (pixman_op_t op,
+ pixman_image_t * dest,
+ pixman_color_t * color,
+ int n_boxes,
+ const pixman_box32_t *boxes)
+{
+ pixman_image_t *solid;
+ pixman_color_t c;
+ int i;
+
+ _pixman_image_validate (dest);
+
+ if (color->alpha == 0xffff)
+ {
+ if (op == PIXMAN_OP_OVER)
+ op = PIXMAN_OP_SRC;
+ }
+
+ if (op == PIXMAN_OP_CLEAR)
+ {
+ c.red = 0;
+ c.green = 0;
+ c.blue = 0;
+ c.alpha = 0;
+
+ color = &c;
+
+ op = PIXMAN_OP_SRC;
+ }
+
+ if (op == PIXMAN_OP_SRC)
+ {
+ uint32_t pixel;
+
+ if (color_to_pixel (color, &pixel, dest->bits.format))
+ {
+ pixman_region32_t fill_region;
+ int n_rects, j;
+ pixman_box32_t *rects;
+
+ if (!pixman_region32_init_rects (&fill_region, boxes, n_boxes))
+ return FALSE;
+
+ if (dest->common.have_clip_region)
+ {
+ if (!pixman_region32_intersect (&fill_region,
+ &fill_region,
+ &dest->common.clip_region))
+ return FALSE;
+ }
+
+ rects = pixman_region32_rectangles (&fill_region, &n_rects);
+ for (j = 0; j < n_rects; ++j)
+ {
+ const pixman_box32_t *rect = &(rects[j]);
+ pixman_fill (dest->bits.bits, dest->bits.rowstride, PIXMAN_FORMAT_BPP (dest->bits.format),
+ rect->x1, rect->y1, rect->x2 - rect->x1, rect->y2 - rect->y1,
+ pixel);
+ }
+
+ pixman_region32_fini (&fill_region);
+ return TRUE;
+ }
+ }
+
+ solid = pixman_image_create_solid_fill (color);
+ if (!solid)
+ return FALSE;
+
+ for (i = 0; i < n_boxes; ++i)
+ {
+ const pixman_box32_t *box = &(boxes[i]);
+
+ pixman_image_composite32 (op, solid, NULL, dest,
+ 0, 0, 0, 0,
+ box->x1, box->y1,
+ box->x2 - box->x1, box->y2 - box->y1);
+ }
+
+ pixman_image_unref (solid);
+
+ return TRUE;
+}
+
/**
* pixman_version:
*
diff --git a/pixman/pixman.h b/pixman/pixman.h
index ff78b95..4fce706 100644
--- a/pixman/pixman.h
+++ b/pixman/pixman.h
@@ -761,6 +761,11 @@ pixman_bool_t pixman_image_fill_rectangles (pixman_op_t op,
pixman_color_t *color,
int n_rects,
const pixman_rectangle16_t *rects);
+pixman_bool_t pixman_image_fill_boxes (pixman_op_t op,
+ pixman_image_t *dest,
+ pixman_color_t *color,
+ int n_boxes,
+ const pixman_box32_t *boxes);
/* Composite */
pixman_bool_t pixman_compute_composite_region (pixman_region16_t *region,
commit e841c556d59ca0aa6d86eaf6dbf061ae0f4287de
Author: Benjamin Otte <otte at redhat.com>
Date: Tue Jan 26 18:52:27 2010 +0100
Add pixman_image_composite32()
This is equal to pixman_image_composite(), just with 32bit parameters.
pixman_image_composite() now just calls pixman_image_composite32()
diff --git a/pixman/pixman.c b/pixman/pixman.c
index 0edd967..6b28093 100644
--- a/pixman/pixman.c
+++ b/pixman/pixman.c
@@ -109,8 +109,8 @@ pixman_optimize_operator (pixman_op_t op,
static void
apply_workaround (pixman_image_t *image,
- int16_t * x,
- int16_t * y,
+ int32_t * x,
+ int32_t * y,
uint32_t ** save_bits,
int * save_dx,
int * save_dy)
@@ -166,6 +166,24 @@ pixman_image_composite (pixman_op_t op,
uint16_t width,
uint16_t height)
{
+ pixman_image_composite32 (op, src, mask, dest, src_x, src_y,
+ mask_x, mask_y, dest_x, dest_y, width, height);
+}
+
+PIXMAN_EXPORT void
+pixman_image_composite32 (pixman_op_t op,
+ pixman_image_t * src,
+ pixman_image_t * mask,
+ pixman_image_t * dest,
+ int32_t src_x,
+ int32_t src_y,
+ int32_t mask_x,
+ int32_t mask_y,
+ int32_t dest_x,
+ int32_t dest_y,
+ int32_t width,
+ int32_t height)
+{
uint32_t *src_bits;
int src_dx, src_dy;
uint32_t *mask_bits;
diff --git a/pixman/pixman.h b/pixman/pixman.h
index 546f0df..ff78b95 100644
--- a/pixman/pixman.h
+++ b/pixman/pixman.h
@@ -787,6 +787,18 @@ void pixman_image_composite (pixman_op_t op,
int16_t dest_y,
uint16_t width,
uint16_t height);
+void pixman_image_composite32 (pixman_op_t op,
+ pixman_image_t *src,
+ pixman_image_t *mask,
+ pixman_image_t *dest,
+ int32_t src_x,
+ int32_t src_y,
+ int32_t mask_x,
+ int32_t mask_y,
+ int32_t dest_x,
+ int32_t dest_y,
+ int32_t width,
+ int32_t height);
/* Old X servers rely on out-of-bounds accesses when they are asked
* to composite with a window as the source. They create a pixman image
commit 78b6c470789eb226708a5d98bb06a962d2ae0b0d
Author: Benjamin Otte <otte at redhat.com>
Date: Tue Jan 26 19:09:56 2010 +0100
Make region argument to pixman_region(32)_init_rects() const
No indenting of the header to keep git blame working
diff --git a/pixman/pixman-region.c b/pixman/pixman-region.c
index 8ce5deb..ec2ddf8 100644
--- a/pixman/pixman-region.c
+++ b/pixman/pixman-region.c
@@ -2470,7 +2470,7 @@ PREFIX (_selfcheck) (region_type_t *reg)
PIXMAN_EXPORT pixman_bool_t
PREFIX (_init_rects) (region_type_t *region,
- box_type_t *boxes, int count)
+ const box_type_t *boxes, int count)
{
box_type_t *rects;
int displacement;
diff --git a/pixman/pixman.h b/pixman/pixman.h
index 876fc0c..546f0df 100644
--- a/pixman/pixman.h
+++ b/pixman/pixman.h
@@ -393,7 +393,7 @@ void pixman_region_init_rect (pixman_region16_t *reg
unsigned int width,
unsigned int height);
pixman_bool_t pixman_region_init_rects (pixman_region16_t *region,
- pixman_box16_t *boxes,
+ const pixman_box16_t *boxes,
int count);
void pixman_region_init_with_extents (pixman_region16_t *region,
pixman_box16_t *extents);
@@ -480,7 +480,7 @@ void pixman_region32_init_rect (pixman_region32_t *r
unsigned int width,
unsigned int height);
pixman_bool_t pixman_region32_init_rects (pixman_region32_t *region,
- pixman_box32_t *boxes,
+ const pixman_box32_t *boxes,
int count);
void pixman_region32_init_with_extents (pixman_region32_t *region,
pixman_box32_t *extents);
commit b194bb78c8a32b7252cccaebdc085cd8e759427d
Author: Benjamin Otte <otte at redhat.com>
Date: Tue Jan 26 19:08:29 2010 +0100
Fix typo
diff --git a/pixman/pixman.h b/pixman/pixman.h
index ba2b242..876fc0c 100644
--- a/pixman/pixman.h
+++ b/pixman/pixman.h
@@ -429,7 +429,7 @@ pixman_bool_t pixman_region_contains_point (pixman_region16_t *reg
int x,
int y,
pixman_box16_t *box);
-pixman_region_overlap_t pixman_region_contains_rectangle (pixman_region16_t *pixman_region16_t,
+pixman_region_overlap_t pixman_region_contains_rectangle (pixman_region16_t *region,
pixman_box16_t *prect);
pixman_bool_t pixman_region_not_empty (pixman_region16_t *region);
pixman_box16_t * pixman_region_extents (pixman_region16_t *region);
More information about the xorg-commit
mailing list