From 1081b16a6c238434c7cec28aa925600a892a47bb Mon Sep 17 00:00:00 2001 From: Kovid Goyal Date: Mon, 9 May 2016 09:08:38 +0530 Subject: [PATCH] ... --- src/calibre/utils/imageops/quantize.cpp | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/src/calibre/utils/imageops/quantize.cpp b/src/calibre/utils/imageops/quantize.cpp index 664f7e5fd9..5a30fb389e 100644 --- a/src/calibre/utils/imageops/quantize.cpp +++ b/src/calibre/utils/imageops/quantize.cpp @@ -245,10 +245,8 @@ static void dither_image(const QImage &img, QImage &ans, QVector &color_ta line = reinterpret_cast(img.constScanLine(r)); bits = ans.scanLine(r); is_odd = r & 1; - start = is_odd ? iwidth - 1 : 0; - delta = is_odd ? -1 : 1; - line1 = is_odd ? &err2 : &err1; - line2 = is_odd ? &err1 : &err2; + if (is_odd) { start = iwidth - 1; delta = -1; line1 = &err2; line2 = &err1; } + else { start = 0; delta = 1; line1 = &err1; line2 = &err2; } line2->fill(zero); for (c = start; 0 < (is_odd ? c + 1 : iwidth - c); c += delta) { pixel = *(line + c);