summaryrefslogtreecommitdiffstats
path: root/src/plugins
diff options
context:
space:
mode:
authorMichael Dominic K <mdk@codethink.co.uk>2010-12-08 12:44:03 (GMT)
committerSamuel Rødal <samuel.rodal@nokia.com>2010-12-08 12:44:03 (GMT)
commit299e27838df58153e76e5b3d9bee46dc2a867dec (patch)
treec63c12e0950d8080a59eec7359ee0a0e637df5c4 /src/plugins
parent07b3a1c3d38d5870009e76de6315a9025e8f7915 (diff)
downloadQt-299e27838df58153e76e5b3d9bee46dc2a867dec.zip
Qt-299e27838df58153e76e5b3d9bee46dc2a867dec.tar.gz
Qt-299e27838df58153e76e5b3d9bee46dc2a867dec.tar.bz2
Use a different dither distribution matrix + a bit of rand.
Also don't dither on edges. Improves dithering over tiles/scaled smooth gradients. Merge-request: 971 Reviewed-by: Samuel Rødal <samuel.rodal@nokia.com>
Diffstat (limited to 'src/plugins')
-rw-r--r--src/plugins/graphicssystems/meego/dithering.cpp11
1 files changed, 7 insertions, 4 deletions
diff --git a/src/plugins/graphicssystems/meego/dithering.cpp b/src/plugins/graphicssystems/meego/dithering.cpp
index 1a2e3fa..ca303a8 100644
--- a/src/plugins/graphicssystems/meego/dithering.cpp
+++ b/src/plugins/graphicssystems/meego/dithering.cpp
@@ -154,7 +154,10 @@ unsigned short* convertRGB32_to_RGB565(const unsigned char *in, int width, int h
// Add the diffusion for this pixel we stored in the accumulator.
// >> 7 because the values in accumulator are stored * 128
- component[c] += accumulator[c][x] >> 7;
+ if (x != 0 && x != (width - 1)) {
+ if (accumulator[c][x] >> 7 != 0)
+ component[c] += rand() % accumulator[c][x] >> 7;
+ }
// Make sure we're not over the boundaries.
CLAMP_256(component[c]);
@@ -172,10 +175,10 @@ unsigned short* convertRGB32_to_RGB565(const unsigned char *in, int width, int h
// Distribute the difference according to the matrix in the
// accumulation bufffer.
- ACCUMULATE(accumulator[c], x + 1, 0, width, diff * 7);
- ACCUMULATE(accumulator[c], x - 1, 1, width, diff * 3);
+ ACCUMULATE(accumulator[c], x + 1, 0, width, diff * 3);
+ ACCUMULATE(accumulator[c], x - 1, 1, width, diff * 5);
ACCUMULATE(accumulator[c], x, 1, width, diff * 5);
- ACCUMULATE(accumulator[c], x + 1, 1, width, diff * 1);
+ ACCUMULATE(accumulator[c], x + 1, 1, width, diff * 3);
}
// Write the newly produced pixel