From b104a79502e2c01c508e40d83613ecfa001a2a4e Mon Sep 17 00:00:00 2001 From: Bertram Felgenhauer Date: Tue, 13 Jun 2006 20:07:28 -0400 Subject: [PATCH] Patch to fix pixman samping location bug (#2488). --- pixman/src/fbcompose.c | 21 +++++++++++++++------ test/pixman-rotate-rgb24-ref.png | Bin 385 -> 244 bytes test/pixman-rotate-svg-argb32-ref.png | Bin 0 -> 258 bytes test/pixman-rotate-svg-rgb24-ref.png | Bin 0 -> 358 bytes 4 files changed, 15 insertions(+), 6 deletions(-) create mode 100644 test/pixman-rotate-svg-argb32-ref.png create mode 100644 test/pixman-rotate-svg-rgb24-ref.png 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 c9d00fde7b9d96fdc039cd25c8bdca893d1185db..60d9b1c38b902e76979076dc38275804cc7a2df1 100644 GIT binary patch delta 188 zcmZo<{=zuHrv4fmuQ)eTB3J2O1_p*{o-U3d6?5L+*vNaxK)~T*Lqs?4CZ5SDGjk>! zeX(M~z90*+M|*F5ii}^E7YS4j0spSNZIXO#_3BxzeCg-owLeum|Bmo zIe5G9-JjQ%&t#ACb1|_tHaR#hP=HATxfA=?jeKsipS|^d&Qo@{GzZM=hWGcTonv{Y SwP(dykdUXVpUXO@geCxp$Vc-4 literal 385 zcmeAS@N?(olHy`uVBq!ia0vp^2_VeD1SE5RJ;(=AY)RhkE)4%caKYZ?lYt`aC7!;n z>{mI3#km+mr7m1$U|>}Cba4!+nDh3|Mc)<&5r>PC$)3{|9*yWcx+C?*ijZF@Y#By7o|J}VKci#V9rN0^- zlFw~l`+0jEbD7cwiR88CeJ7V+FXu-XXz^vn|C^_O*WRwLePh|TKf)2WEv?@7*<(M} zJ&y}RxayG2hyM#KpI`eK?f=kaLH$`(F;X21@!1F7)W70sZVNR+fg#A?>FVdQ&MBb@ E0JtfCKmY&$ diff --git a/test/pixman-rotate-svg-argb32-ref.png b/test/pixman-rotate-svg-argb32-ref.png new file mode 100644 index 0000000000000000000000000000000000000000..08d750bddd59ca686097215aa840fd0cad264110 GIT binary patch literal 258 zcmeAS@N?(olHy`uVBq!ia0vp^2_VeD1|%QND7OGoEX7WqAsj$Z!;#Vfk{H1geLDy1PO832E0V z>UOaoFZywL*SVcDcIy;tKig+@h5JW2(-D>qP61&BHHRGW>le2B72o~xr&dos>SVYD zqakAwLfWTc1_O#f&j0(&W&iBzwbg-|;j(|`?d!LNSq-A=ZZJzM*?y} Jvd$@?2>_5AR0#k8 literal 0 HcmV?d00001 diff --git a/test/pixman-rotate-svg-rgb24-ref.png b/test/pixman-rotate-svg-rgb24-ref.png new file mode 100644 index 0000000000000000000000000000000000000000..349fd5ce80ea248a99022891009e45d94bdf5fb9 GIT binary patch literal 358 zcmeAS@N?(olHy`uVBq!ia0vp^2_VeD1|%QND7OGoEX7WqAsj$Z!;#X#z`!W$>Eakt zG3V`_gPeyP1RO4QMogDoBFVjRW=TSF)z>Gg6U9I5ufEZE-r