summaryrefslogtreecommitdiffstats
path: root/src/plugins
diff options
context:
space:
mode:
authorMichael Dominic K <mdk@codethink.co.uk>2010-11-02 10:35:42 (GMT)
committerSamuel Rødal <samuel.rodal@nokia.com>2010-11-02 10:35:42 (GMT)
commita1aee0f169614b31a7fde201a3d1c64010198218 (patch)
tree705fe474b9655f2ce6d89caf950a6d9e5fd66f30 /src/plugins
parent01ea458a0c568d9e08133290f23c74a9fbbcb994 (diff)
downloadQt-a1aee0f169614b31a7fde201a3d1c64010198218.zip
Qt-a1aee0f169614b31a7fde201a3d1c64010198218.tar.gz
Qt-a1aee0f169614b31a7fde201a3d1c64010198218.tar.bz2
One more fix for dithering.
Merge-request: 2499 Reviewed-by: Samuel Rødal <samuel.rodal@nokia.com>
Diffstat (limited to 'src/plugins')
-rw-r--r--src/plugins/graphicssystems/meego/dithering.cpp16
1 files changed, 8 insertions, 8 deletions
diff --git a/src/plugins/graphicssystems/meego/dithering.cpp b/src/plugins/graphicssystems/meego/dithering.cpp
index c0b4b53..76d15a3 100644
--- a/src/plugins/graphicssystems/meego/dithering.cpp
+++ b/src/plugins/graphicssystems/meego/dithering.cpp
@@ -68,7 +68,7 @@
// Writes(ads) a new value to the diffusion accumulator. accumulator is a short.
// x, y is a position in the accumulation buffer. y can be 0 or 1 -- we operate on two lines at time.
-#define ACCUMULATE(accumulator, x, y, width, v) if (x < width && x > 0) accumulator[(y * width) + x] += v
+#define ACCUMULATE(accumulator, x, y, width, v) if (x < width && x >= 0) accumulator[(y * width) + x] += v
// Clamps a value to be in 0..255 range.
#define CLAMP_256(v) if (v > 255) v = 255; if (v < 0) v = 0;
@@ -110,18 +110,18 @@ unsigned short* convertRGB32_to_RGB565(const unsigned char *in, int width, int h
// Produce the conversion lookup tables.
for (i = 0; i < 256; i++) {
lookup_8bit_to_5bit[i] = round(i / 8.0);
- if (lookup_8bit_to_5bit[i] > 31)
- lookup_8bit_to_5bit[i] -= 1;
// Before bitshifts: (i * 8) - (... * 8 * 8)
lookup_8bit_to_5bit_diff[i] = (i << 3) - (lookup_8bit_to_5bit[i] << 6);
+ if (lookup_8bit_to_5bit[i] > 31)
+ lookup_8bit_to_5bit[i] -= 1;
lookup_8bit_to_6bit[i] = round(i / 4.0);
- if (lookup_8bit_to_6bit[i] > 63)
- lookup_8bit_to_6bit[i] -= 1;
// Before bitshifts: (i * 8) - (... * 4 * 8)
lookup_8bit_to_6bit_diff[i] = (i << 3) - (lookup_8bit_to_6bit[i] << 5);
+ if (lookup_8bit_to_6bit[i] > 63)
+ lookup_8bit_to_6bit[i] -= 1;
}
// Clear the accumulators
@@ -221,11 +221,11 @@ unsigned short* convertARGB32_to_RGBA4444(const unsigned char *in, int width, in
// Produce the conversion lookup tables.
for (i = 0; i < 256; i++) {
lookup_8bit_to_4bit[i] = round(i / 16.0);
- if (lookup_8bit_to_4bit[i] > 15)
- lookup_8bit_to_4bit[i] -= 1;
-
// Before bitshifts: (i * 8) - (... * 16 * 8)
lookup_8bit_to_4bit_diff[i] = (i << 3) - (lookup_8bit_to_4bit[i] << 7);
+
+ if (lookup_8bit_to_4bit[i] > 15)
+ lookup_8bit_to_4bit[i] = 15;
}
// Clear the accumulators