<html>
<head>
<base href="https://bugs.freedesktop.org/" />
</head>
<body>
<p>
<div>
<b><a class="bz_bug_link
bz_status_NEW "
title="NEW --- - cairo-tor-scan-converter is off by half of a subrow."
href="https://bugs.freedesktop.org/show_bug.cgi?id=84396#c3">Comment # 3</a>
on <a class="bz_bug_link
bz_status_NEW "
title="NEW --- - cairo-tor-scan-converter is off by half of a subrow."
href="https://bugs.freedesktop.org/show_bug.cgi?id=84396">bug 84396</a>
from <span class="vcard"><a class="email" href="mailto:chris@chris-wilson.co.uk" title="Chris Wilson <chris@chris-wilson.co.uk>"> <span class="fn">Chris Wilson</span></a>
</span></b>
<pre>Untested, but I am thinking along the lines of:
diff --git a/src/cairo-tor-scan-converter.c b/src/cairo-tor-scan-converter.c
index 89ef20f..e271c31 100644
--- a/src/cairo-tor-scan-converter.c
+++ b/src/cairo-tor-scan-converter.c
@@ -1469,19 +1469,19 @@ glitter_scan_converter_reset(
* shifts if possible, and something saneish if not.
*/
#if !defined(INPUT_TO_GRID_Y) && defined(GRID_Y_BITS) && GRID_Y_BITS <=
GLITTER_INPUT_BITS
-# define INPUT_TO_GRID_Y(in, out) (out) = (in) >> (GLITTER_INPUT_BITS -
GRID_Y_BITS)
+# define INPUT_TO_GRID_Y(in, out) (out) = ((in) + ((GLITTER_INPUT_BITS -
GRID_Y_BITS) >> 1) - 1) >> (GLITTER_INPUT_BITS - GRID_Y_BITS)
#else
# define INPUT_TO_GRID_Y(in, out) INPUT_TO_GRID_general(in, out, GRID_Y)
#endif
#if !defined(INPUT_TO_GRID_X) && defined(GRID_X_BITS) && GRID_X_BITS <=
GLITTER_INPUT_BITS
-# define INPUT_TO_GRID_X(in, out) (out) = (in) >> (GLITTER_INPUT_BITS -
GRID_X_BITS)
+# define INPUT_TO_GRID_X(in, out) (out) = ((in) + ((GLITTER_INPUT_BITS -
GRID_X_BITS) >> 1) - 1) >> (GLITTER_INPUT_BITS - GRID_X_BITS)
#else
# define INPUT_TO_GRID_X(in, out) INPUT_TO_GRID_general(in, out, GRID_X)
#endif
#define INPUT_TO_GRID_general(in, out, grid_scale) do { \
- long long tmp__ = (long long)(grid_scale) * (in); \
+ long long tmp__ = (long long)(grid_scale) * (in) + ((grid_scale)+1)/2-1;
\
tmp__ >>= GLITTER_INPUT_BITS; \
(out) = tmp__; \
} while (0)</pre>
</div>
</p>
<hr>
<span>You are receiving this mail because:</span>
<ul>
<li>You are the QA Contact for the bug.</li>
</ul>
</body>
</html>