summaryrefslogtreecommitdiff
path: root/pixman
diff options
context:
space:
mode:
authorDavid Reveman <davidr@novell.com>2004-09-11 19:27:59 +0000
committerDavid Reveman <davidr@novell.com>2004-09-11 19:27:59 +0000
commitc5786fd0fe0f0b69f3896e77705282c211ba7a77 (patch)
tree16ffa2bb20bd48f0e7d1132b73ab8a1b0563aad4 /pixman
parent4af8faee061b3b90e71badf36040daa0b8edb7d1 (diff)
Added support for both transform and repeat
Diffstat (limited to 'pixman')
-rw-r--r--pixman/AUTHORS1
-rw-r--r--pixman/ChangeLog7
-rw-r--r--pixman/src/ic.c8
-rw-r--r--pixman/src/iccompose.c46
-rw-r--r--pixman/src/icimage.h3
5 files changed, 61 insertions, 4 deletions
diff --git a/pixman/AUTHORS b/pixman/AUTHORS
index 034f854b..d18a0411 100644
--- a/pixman/AUTHORS
+++ b/pixman/AUTHORS
@@ -4,6 +4,7 @@ Dave Beckett <Dave.Beckett@bristol.ac.uk> Combined libpixregion, libic, and slim
Jakub Bogusz <qboosh@pld-linux.org> Fixes for 64-bit machines.
Anders Carlsson <andersca@gnome.org> Build fixes. New accessor functions.
Richard Henderson <rth@twiddle.net> "slim" macros for better shared libraries
+Owen Taylor <otaylor@redhat.com> Support for both transform and repeat
Keith Packard <keithp@keithp.com> The original implementation of the compositing code.
Vladimir Vukicevic <vladimir@pobox.com> Bug fix.
Bryan Worth <bryan@theworths.org> Cleanups to not depend on X header files.
diff --git a/pixman/ChangeLog b/pixman/ChangeLog
index 798ed09d..34d3f90c 100644
--- a/pixman/ChangeLog
+++ b/pixman/ChangeLog
@@ -1,3 +1,10 @@
+2004-09-12 David Reveman <c99drn@cs.umu.se>
+
+ * src/ic.c (pixman_composite):
+ * src/iccompose.c (IcFetch_transform, IcFetcha_transform):
+ * src/icimage.h: Added support for both transform and repeat
+ (thanks to Owen Taylor <otaylor@redhat.com>).
+
2004-05-06 Carl Worth <cworth@isi.edu>
* src/icimage.c (pixman_image_set_clip_region): Leave
diff --git a/pixman/src/ic.c b/pixman/src/ic.c
index 13ec6538..44e7120f 100644
--- a/pixman/src/ic.c
+++ b/pixman/src/ic.c
@@ -1078,6 +1078,14 @@ pixman_composite (pixman_operator_t op,
func = pixman_compositeGeneral;
break;
}
+ /* if we are transforming, we handle repeats in
+ * IcFetch[a]_transform
+ */
+ if (iSrc->transform)
+ srcRepeat = 0;
+ if (iMask && iMask->transform)
+ maskRepeat = 0;
+
n = pixman_region_num_rects (region);
pbox = pixman_region_rects (region);
while (n--)
diff --git a/pixman/src/iccompose.c b/pixman/src/iccompose.c
index 0f241353..5dd074cc 100644
--- a/pixman/src/iccompose.c
+++ b/pixman/src/iccompose.c
@@ -2239,6 +2239,8 @@ IcStore_external (pixman_compositeOperand *op, uint32_t value)
(*op[2].store) (&op[2], value & 0xff000000);
}
+#define mod(a,b) ((b) == 1 ? 0 : (a) >= 0 ? (a) % (b) : (a) % (b) == 0 ? 0: (b) + (a) % (b))
+
static uint32_t
IcFetch_transform (pixman_compositeOperand *op)
{
@@ -2260,6 +2262,11 @@ IcFetch_transform (pixman_compositeOperand *op)
case PIXMAN_FILTER_NEAREST:
y = xFixedToInt (v.vector[1]) + op->u.transform.top_y;
x = xFixedToInt (v.vector[0]) + op->u.transform.left_x;
+ if (op->u.transform.repeat)
+ {
+ y = mod (y, op->u.transform.height);
+ x = mod (x, op->u.transform.width);
+ }
if (pixman_region_contains_point (op->clip, x, y, &box))
{
(*op[1].set) (&op[1], x, y);
@@ -2282,13 +2289,24 @@ IcFetch_transform (pixman_compositeOperand *op)
for (y = miny; y <= maxy; y++)
{
uint32_t lrtot = 0, lgtot = 0, lbtot = 0, latot = 0;
+ int tx, ty;
+
+ if (op->u.transform.repeat)
+ ty = mod (y, op->u.transform.height);
+ else
+ ty = y;
xerr = xFixed1 - xFixedFrac (v.vector[0]);
for (x = minx; x <= maxx; x++)
{
- if (pixman_region_contains_point (op->clip, x, y, &box))
+ if (op->u.transform.repeat)
+ tx = mod (x, op->u.transform.width);
+ else
+ tx = x;
+
+ if (pixman_region_contains_point (op->clip, tx, ty, &box))
{
- (*op[1].set) (&op[1], x, y);
+ (*op[1].set) (&op[1], tx, ty);
bits = (*op[1].fetch) (&op[1]);
{
Splita(bits);
@@ -2343,6 +2361,11 @@ IcFetcha_transform (pixman_compositeOperand *op)
case PIXMAN_FILTER_NEAREST:
y = xFixedToInt (v.vector[1]) + op->u.transform.left_x;
x = xFixedToInt (v.vector[0]) + op->u.transform.top_y;
+ if (op->u.transform.repeat)
+ {
+ y = mod (y, op->u.transform.height);
+ x = mod (x, op->u.transform.width);
+ }
if (pixman_region_contains_point (op->clip, x, y, &box))
{
(*op[1].set) (&op[1], x, y);
@@ -2366,12 +2389,24 @@ IcFetcha_transform (pixman_compositeOperand *op)
for (y = miny; y <= maxy; y++)
{
uint32_t lrtot = 0, lgtot = 0, lbtot = 0, latot = 0;
+ int tx, ty;
+
+ if (op->u.transform.repeat)
+ ty = mod (y, op->u.transform.height);
+ else
+ ty = y;
+
xerr = xFixed1 - xFixedFrac (v.vector[0]);
for (x = minx; x <= maxx; x++)
{
- if (pixman_region_contains_point (op->clip, x, y, &box))
+ if (op->u.transform.repeat)
+ tx = mod (x, op->u.transform.width);
+ else
+ tx = x;
+
+ if (pixman_region_contains_point (op->clip, tx, ty, &box))
{
- (*op[1].set) (&op[1], x, y);
+ (*op[1].set) (&op[1], tx, ty);
bits = (*op[1].fetcha) (&op[1]);
{
Splita(bits);
@@ -2535,6 +2570,9 @@ IcBuildCompositeOperand (pixman_image_t *image,
op->u.transform.y = y - op->u.transform.top_y;
op->u.transform.transform = image->transform;
op->u.transform.filter = image->filter;
+ op->u.transform.repeat = image->repeat;
+ op->u.transform.width = image->pixels->width;
+ op->u.transform.height = image->pixels->height;
op->fetch = IcFetch_transform;
op->fetcha = IcFetcha_transform;
diff --git a/pixman/src/icimage.h b/pixman/src/icimage.h
index 0c37666e..79fcae16 100644
--- a/pixman/src/icimage.h
+++ b/pixman/src/icimage.h
@@ -272,6 +272,9 @@ struct _pixman_compositeOperand {
int y;
pixman_transform_t *transform;
pixman_filter_t filter;
+ int repeat;
+ int width;
+ int height;
} transform;
} u;
pixman_compositeFetch fetch;