[cairo-bugs] [Bug 84396] cairo-tor-scan-converter is off by half of a subrow.

bugzilla-daemon at freedesktop.org bugzilla-daemon at freedesktop.org
Sun Sep 28 00:58:35 PDT 2014


https://bugs.freedesktop.org/show_bug.cgi?id=84396

--- Comment #3 from Chris Wilson <chris at chris-wilson.co.uk> ---
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)

-- 
You are receiving this mail because:
You are the QA Contact for the bug.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.cairographics.org/archives/cairo-bugs/attachments/20140928/1a77ac0a/attachment.html>


More information about the cairo-bugs mailing list