summaryrefslogtreecommitdiff
path: root/fb/fbcompose.c
diff options
context:
space:
mode:
authorKristian Høgsberg <krh@redhat.com>2006-06-21 16:22:14 -0400
committerKristian Høgsberg <krh@redhat.com>2006-06-21 16:22:14 -0400
commited18d776f02e2ab235954501ef64936af9f9d909 (patch)
tree23e4fef6f6ba7834fea6c2a904a11e734e1ece5f /fb/fbcompose.c
parentea5e0eabd1303a55d8fc10f44d21a3d371ce8919 (diff)
Fix #2488 for fb too: sample pixel center when transforming.
Diffstat (limited to 'fb/fbcompose.c')
-rw-r--r--fb/fbcompose.c21
1 files changed, 15 insertions, 6 deletions
diff --git a/fb/fbcompose.c b/fb/fbcompose.c
index 6f7e3e6ec..03adab456 100644
--- a/fb/fbcompose.c
+++ b/fb/fbcompose.c
@@ -2726,8 +2726,9 @@ static void fbFetchSourcePict(PicturePtr pict, int x, int y, int width, CARD32 *
xFixed_32_32 l;
xFixed_48_16 dx, dy, a, b, off;
- v.vector[0] = IntToxFixed(x);
- v.vector[1] = IntToxFixed(y);
+ /* reference point is the center of the pixel */
+ v.vector[0] = IntToxFixed(x) + xFixed1/2;
+ v.vector[1] = IntToxFixed(y) + xFixed1/2;
v.vector[2] = xFixed1;
if (pict->transform) {
if (!PictureTransformPoint3d (pict->transform, &v))
@@ -2793,8 +2794,9 @@ static void fbFetchSourcePict(PicturePtr pict, int x, int y, int width, CARD32 *
if (pict->transform) {
PictVector v;
- v.vector[0] = IntToxFixed(x);
- v.vector[1] = IntToxFixed(y);
+ /* reference point is the center of the pixel */
+ v.vector[0] = IntToxFixed(x) + xFixed1/2;
+ v.vector[1] = IntToxFixed(y) + xFixed1/2;
v.vector[2] = xFixed1;
if (!PictureTransformPoint3d (pict->transform, &v))
return;
@@ -2914,8 +2916,9 @@ static void fbFetchTransformed(PicturePtr pict, int x, int y, int width, CARD32
dx = pict->pDrawable->x;
dy = pict->pDrawable->y;
- v.vector[0] = IntToxFixed(x - dx);
- v.vector[1] = IntToxFixed(y - dy);
+ /* reference point is the center of the pixel */
+ v.vector[0] = IntToxFixed(x - dx) + xFixed1 / 2;
+ v.vector[1] = IntToxFixed(y - dy) + xFixed1 / 2;
v.vector[2] = xFixed1;
/* when using convolution filters one might get here without a transform */
@@ -3020,6 +3023,12 @@ static void fbFetchTransformed(PicturePtr pict, int x, int y, int width, CARD32
}
}
} else if (pict->filter == PictFilterBilinear) {
+ /* adjust vector for maximum contribution at 0.5, 0.5 of each texel. */
+ v.vector[0] -= v.vector[2] / 2;
+ v.vector[1] -= v.vector[2] / 2;
+ unit.vector[0] -= unit.vector[2] / 2;
+ unit.vector[1] -= unit.vector[2] / 2;
+
if (pict->repeatType == RepeatNormal) {
if (REGION_NUM_RECTS(pict->pCompositeClip) == 1) {
for (i = 0; i < width; ++i) {