diff options
author | Paul Olav Tvete <paul.tvete@nokia.com> | 2009-09-07 07:17:55 (GMT) |
---|---|---|
committer | Paul Olav Tvete <paul.tvete@nokia.com> | 2009-09-07 07:28:58 (GMT) |
commit | bd4771a8a135bf2307c6fb2e27ccdac64637992d (patch) | |
tree | 835a78c2b50e101e90df52a3191c4b7596ed35ee /src/gui/painting | |
parent | a8586e786cb2aab173ddb419b1b1151aecae84e0 (diff) | |
download | Qt-bd4771a8a135bf2307c6fb2e27ccdac64637992d.zip Qt-bd4771a8a135bf2307c6fb2e27ccdac64637992d.tar.gz Qt-bd4771a8a135bf2307c6fb2e27ccdac64637992d.tar.bz2 |
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
Diffstat (limited to 'src/gui/painting')
-rw-r--r-- | src/gui/painting/qdrawhelper.cpp | 11 |
1 files changed, 7 insertions, 4 deletions
diff --git a/src/gui/painting/qdrawhelper.cpp b/src/gui/painting/qdrawhelper.cpp index ab192c5..e9b1bd3 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) { |