summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPaul Olav Tvete <paul.tvete@nokia.com>2009-09-07 09:17:55 +0200
committerPaul Olav Tvete <paul.tvete@nokia.com>2009-09-07 09:28:58 +0200
commitbd4771a8a135bf2307c6fb2e27ccdac64637992d (patch)
tree835a78c2b50e101e90df52a3191c4b7596ed35ee
parenta8586e786cb2aab173ddb419b1b1151aecae84e0 (diff)
Fix tiled blit in 16-bit mode
Optimizations in change 8e447e8a did not handle the case when the target width is less than the width of a tile. Task-number: 260759 Reviewed-by: Samuel
-rw-r--r--src/gui/painting/qdrawhelper.cpp11
1 files changed, 7 insertions, 4 deletions
diff --git a/src/gui/painting/qdrawhelper.cpp b/src/gui/painting/qdrawhelper.cpp
index ab192c5a32..e9b1bd3939 100644
--- a/src/gui/painting/qdrawhelper.cpp
+++ b/src/gui/painting/qdrawhelper.cpp
@@ -4953,15 +4953,18 @@ Q_STATIC_TEMPLATE_FUNCTION void blendTiled(int count, const QSpan *spans, void *
if (modeSource && coverage == 255) {
// Copy the first texture block
- length = image_width;
+ length = qMin(image_width,length);
+ int tx = x;
while (length) {
int l = qMin(image_width - sx, length);
if (buffer_size < l)
l = buffer_size;
- DST *dest = ((DST*)data->rasterBuffer->scanLine(spans->y)) + x;
+ DST *dest = ((DST*)data->rasterBuffer->scanLine(spans->y)) + tx;
const SRC *src = (SRC*)data->texture.scanLine(sy) + sx;
+
qt_memconvert<DST, SRC>(dest, src, l);
length -= l;
+ tx += l;
sx = 0;
}
@@ -4971,8 +4974,8 @@ Q_STATIC_TEMPLATE_FUNCTION void blendTiled(int count, const QSpan *spans, void *
// We are dealing with one block of data
// - More likely to fit in the cache
// - can use memcpy
- int copy_image_width = image_width;
- length = spans->len - image_width;
+ int copy_image_width = qMin(image_width, int(spans->len));
+ length = spans->len - copy_image_width;
DST *src = ((DST*)data->rasterBuffer->scanLine(spans->y)) + x;
DST *dest = src + copy_image_width;
while (copy_image_width < length) {