summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSøren Sandmann <sandmann@redhat.com>2007-06-12 14:24:40 -0400
committerSøren Sandmann <sandmann@redhat.com>2007-06-12 14:24:40 -0400
commitd466cf1d2f09f78baaafac713d6bc7d4f003b860 (patch)
tree435ac6bd25d149f7afb9ed898261cab46d67ee71
parentb62b769c0da8d8eae68bd41a53f390c1f0917be0 (diff)
Add various accessors; remove composite_rect
-rw-r--r--TODO1
-rw-r--r--configure.ac2
-rw-r--r--pixman/pixman-image.c93
-rw-r--r--pixman/pixman-pict.c50
-rw-r--r--pixman/pixman.h41
-rw-r--r--test/composite-test.c4
-rw-r--r--test/gradient-test.c4
7 files changed, 115 insertions, 80 deletions
diff --git a/TODO b/TODO
index e7f6c573..26eab050 100644
--- a/TODO
+++ b/TODO
@@ -62,3 +62,4 @@
- Run cairo test suite; fix bugs
- one bug in source-scale-clip
+- Default clip region should be the full image \ No newline at end of file
diff --git a/configure.ac b/configure.ac
index 5b604f18..b759c7f6 100644
--- a/configure.ac
+++ b/configure.ac
@@ -22,7 +22,7 @@ dnl Process this file with autoconf to create configure.
AC_PREREQ([2.57])
-AC_INIT(pixman, 0.9.2, "sandmann@daimi.au.dk", pixman)
+AC_INIT(pixman, 0.9.3, "sandmann@daimi.au.dk", pixman)
AM_INIT_AUTOMAKE([dist-bzip2])
AM_CONFIG_HEADER(config.h)
diff --git a/pixman/pixman-image.c b/pixman/pixman-image.c
index 1cc28b25..a719f3a8 100644
--- a/pixman/pixman-image.c
+++ b/pixman/pixman-image.c
@@ -268,13 +268,13 @@ pixman_image_create_bits (pixman_format_code_t format,
int width,
int height,
uint32_t *bits,
- int rowstride)
+ int rowstride_bytes)
{
pixman_image_t *image;
- return_val_if_fail ((rowstride & 0x3) == 0, NULL); /* must be a
- * multiple of 4
- */
+ /* must be a whole number of uint32_t's
+ */
+ return_val_if_fail ((rowstride_bytes % sizeof (uint32_t)) == 0, NULL);
image = allocate_image();
@@ -286,9 +286,9 @@ pixman_image_create_bits (pixman_format_code_t format,
image->bits.width = width;
image->bits.height = height;
image->bits.bits = bits;
- image->bits.rowstride = rowstride / 4; /* we store it in number
- * of uint32_t's
- */
+ image->bits.rowstride = rowstride_bytes / sizeof (uint32_t); /* we store it in number
+ * of uint32_t's
+ */
image->bits.indexed = NULL;
return image;
@@ -429,8 +429,6 @@ pixman_image_set_component_alpha (pixman_image_t *image,
}
-#define SCANLINE_BUFFER_LENGTH 2048
-
void
pixman_image_set_accessors (pixman_image_t *image,
pixman_read_memory_func_t read_func,
@@ -442,50 +440,43 @@ pixman_image_set_accessors (pixman_image_t *image,
image->common.write_func = write_func;
}
-void
-pixman_image_composite_rect (pixman_op_t op,
- pixman_image_t *src,
- pixman_image_t *mask,
- pixman_image_t *dest,
- int16_t src_x,
- int16_t src_y,
- int16_t mask_x,
- int16_t mask_y,
- int16_t dest_x,
- int16_t dest_y,
- uint16_t width,
- uint16_t height)
+uint32_t *
+pixman_image_get_data (pixman_image_t *image)
{
- FbComposeData compose_data;
- uint32_t _scanline_buffer[SCANLINE_BUFFER_LENGTH * 3];
- uint32_t *scanline_buffer = _scanline_buffer;
+ return_val_if_fail (image->type == BITS, NULL);
- return_if_fail (src != NULL);
- return_if_fail (dest != NULL);
-
- if (width > SCANLINE_BUFFER_LENGTH)
- {
- scanline_buffer = (uint32_t *)malloc (width * 3 * sizeof (uint32_t));
+ return image->bits.bits;
+}
- if (!scanline_buffer)
- return;
- }
+int
+pixman_image_get_width (pixman_image_t *image)
+{
+ return_val_if_fail (image->type == BITS, -1);
+
+ return image->bits.width;
- compose_data.op = op;
- compose_data.src = src;
- compose_data.mask = mask;
- compose_data.dest = dest;
- compose_data.xSrc = src_x;
- compose_data.ySrc = src_y;
- compose_data.xMask = mask_x;
- compose_data.yMask = mask_y;
- compose_data.xDest = dest_x;
- compose_data.yDest = dest_y;
- compose_data.width = width;
- compose_data.height = height;
-
- pixmanCompositeRect (&compose_data, scanline_buffer);
-
- if (scanline_buffer != _scanline_buffer)
- free (scanline_buffer);
+}
+
+int
+pixman_image_get_height (pixman_image_t *image)
+{
+ return_val_if_fail (image->type == BITS, -1);
+
+ return image->bits.height;
+}
+
+int
+pixman_image_get_stride (pixman_image_t *image)
+{
+ return_val_if_fail (image->type == BITS, -1);
+
+ return sizeof (uint32_t) * image->bits.rowstride;
+}
+
+int
+pixman_image_get_depth (pixman_image_t *image)
+{
+ return_val_if_fail (image->type == BITS, -1);
+
+ return PIXMAN_FORMAT_DEPTH (image->bits.format);
}
diff --git a/pixman/pixman-pict.c b/pixman/pixman-pict.c
index 5d5417c8..741ede6c 100644
--- a/pixman/pixman-pict.c
+++ b/pixman/pixman-pict.c
@@ -1063,6 +1063,56 @@ can_get_solid (pixman_image_t *image)
}
}
+#define SCANLINE_BUFFER_LENGTH 2048
+
+static void
+pixman_image_composite_rect (pixman_op_t op,
+ pixman_image_t *src,
+ pixman_image_t *mask,
+ pixman_image_t *dest,
+ int16_t src_x,
+ int16_t src_y,
+ int16_t mask_x,
+ int16_t mask_y,
+ int16_t dest_x,
+ int16_t dest_y,
+ uint16_t width,
+ uint16_t height)
+{
+ FbComposeData compose_data;
+ uint32_t _scanline_buffer[SCANLINE_BUFFER_LENGTH * 3];
+ uint32_t *scanline_buffer = _scanline_buffer;
+
+ return_if_fail (src != NULL);
+ return_if_fail (dest != NULL);
+
+ if (width > SCANLINE_BUFFER_LENGTH)
+ {
+ scanline_buffer = (uint32_t *)malloc (width * 3 * sizeof (uint32_t));
+
+ if (!scanline_buffer)
+ return;
+ }
+
+ compose_data.op = op;
+ compose_data.src = src;
+ compose_data.mask = mask;
+ compose_data.dest = dest;
+ compose_data.xSrc = src_x;
+ compose_data.ySrc = src_y;
+ compose_data.xMask = mask_x;
+ compose_data.yMask = mask_y;
+ compose_data.xDest = dest_x;
+ compose_data.yDest = dest_y;
+ compose_data.width = width;
+ compose_data.height = height;
+
+ pixmanCompositeRect (&compose_data, scanline_buffer);
+
+ if (scanline_buffer != _scanline_buffer)
+ free (scanline_buffer);
+}
+
void
pixman_image_composite (pixman_op_t op,
pixman_image_t * pSrc,
diff --git a/pixman/pixman.h b/pixman/pixman.h
index 277fc0f3..3ca6be00 100644
--- a/pixman/pixman.h
+++ b/pixman/pixman.h
@@ -479,6 +479,11 @@ void pixman_image_set_accessors (pixman_image_t *image,
pixman_write_memory_func_t write_func);
void pixman_image_set_indexed (pixman_image_t *image,
const pixman_indexed_t *indexed);
+uint32_t *pixman_image_get_data (pixman_image_t *image);
+int pixman_image_get_width (pixman_image_t *image);
+int pixman_image_get_height (pixman_image_t *image);
+int pixman_image_get_stride (pixman_image_t *image);
+int pixman_image_get_depth (pixman_image_t *image);
/* Composite */
pixman_bool_t pixman_compute_composite_region (pixman_region16_t * pRegion,
@@ -493,30 +498,18 @@ pixman_bool_t pixman_compute_composite_region (pixman_region16_t * pRegion,
int16_t yDst,
uint16_t width,
uint16_t height);
-void pixman_image_composite (pixman_op_t op,
- pixman_image_t *src,
- pixman_image_t *mask,
- pixman_image_t *dest,
- int16_t src_x,
- int16_t src_y,
- int16_t mask_x,
- int16_t mask_y,
- int16_t dest_x,
- int16_t dest_y,
- uint16_t width,
- uint16_t height);
-void pixman_image_composite_rect (pixman_op_t op,
- pixman_image_t *src,
- pixman_image_t *mask,
- pixman_image_t *dest,
- int16_t src_x,
- int16_t src_y,
- int16_t mask_x,
- int16_t mask_y,
- int16_t dest_x,
- int16_t dest_y,
- uint16_t width,
- uint16_t height);
+void pixman_image_composite (pixman_op_t op,
+ pixman_image_t *src,
+ pixman_image_t *mask,
+ pixman_image_t *dest,
+ int16_t src_x,
+ int16_t src_y,
+ int16_t mask_x,
+ int16_t mask_y,
+ int16_t dest_x,
+ int16_t dest_y,
+ uint16_t width,
+ uint16_t height);
/*
* Trapezoids
diff --git a/test/composite-test.c b/test/composite-test.c
index 567d6205..cee9609e 100644
--- a/test/composite-test.c
+++ b/test/composite-test.c
@@ -129,8 +129,8 @@ main (int argc, char **argv)
dest,
WIDTH * 4);
- pixman_image_composite_rect (PIXMAN_OP_OVER, src_img, NULL, dest_img,
- 0, 0, 0, 0, 0, 0, WIDTH, HEIGHT);
+ pixman_image_composite (PIXMAN_OP_OVER, src_img, NULL, dest_img,
+ 0, 0, 0, 0, 0, 0, WIDTH, HEIGHT);
#if 0
for (i = 0; i < WIDTH; ++i)
diff --git a/test/gradient-test.c b/test/gradient-test.c
index 149d034f..f6e3ca39 100644
--- a/test/gradient-test.c
+++ b/test/gradient-test.c
@@ -129,8 +129,8 @@ main (int argc, char **argv)
#endif
pixman_image_set_transform (src_img, &trans);
- pixman_image_composite_rect (PIXMAN_OP_OVER, src_img, NULL, dest_img,
- 0, 0, 0, 0, 0, 0, WIDTH, HEIGHT);
+ pixman_image_composite (PIXMAN_OP_OVER, src_img, NULL, dest_img,
+ 0, 0, 0, 0, 0, 0, WIDTH, HEIGHT);
printf ("0, 0: %x\n", dest[0]);
printf ("10, 10: %x\n", dest[10 * 10 + 10]);