diff --git a/pixman/src/fbcompose.c b/pixman/src/fbcompose.c index 9515edd46..46a34ecd4 100644 --- a/pixman/src/fbcompose.c +++ b/pixman/src/fbcompose.c @@ -2814,8 +2814,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)) @@ -2928,8 +2929,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; @@ -3068,8 +3070,9 @@ static void fbFetchTransformed(PicturePtr pict, int x, int y, int width, CARD32 x += xoff; y += yoff; - 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; /* when using convolution filters one might get here without a transform */ @@ -3184,6 +3187,12 @@ static void fbFetchTransformed(PicturePtr pict, int x, int y, int width, CARD32 } } } else if (pict->filter == PIXMAN_FILTER_BILINEAR || pict->filter == PIXMAN_FILTER_GOOD || pict->filter == PIXMAN_FILTER_BEST) { + /* 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->repeat == RepeatNormal) { if (PIXREGION_NUM_RECTS(pict->pCompositeClip) == 1) { box = pict->pCompositeClip->extents; diff --git a/test/pixman-rotate-rgb24-ref.png b/test/pixman-rotate-rgb24-ref.png index c9d00fde7..60d9b1c38 100644 Binary files a/test/pixman-rotate-rgb24-ref.png and b/test/pixman-rotate-rgb24-ref.png differ diff --git a/test/pixman-rotate-svg-argb32-ref.png b/test/pixman-rotate-svg-argb32-ref.png new file mode 100644 index 000000000..08d750bdd Binary files /dev/null and b/test/pixman-rotate-svg-argb32-ref.png differ diff --git a/test/pixman-rotate-svg-rgb24-ref.png b/test/pixman-rotate-svg-rgb24-ref.png new file mode 100644 index 000000000..349fd5ce8 Binary files /dev/null and b/test/pixman-rotate-svg-rgb24-ref.png differ