aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--src/quick/items/context2d/qquickcontext2dcommandbuffer.cpp4
-rw-r--r--tests/auto/quick/qquickcanvasitem/data/tst_image.qml14
2 files changed, 17 insertions, 1 deletions
diff --git a/src/quick/items/context2d/qquickcontext2dcommandbuffer.cpp b/src/quick/items/context2d/qquickcontext2dcommandbuffer.cpp
index f6b9a1afeb..6f20b699c9 100644
--- a/src/quick/items/context2d/qquickcontext2dcommandbuffer.cpp
+++ b/src/quick/items/context2d/qquickcontext2dcommandbuffer.cpp
@@ -409,7 +409,11 @@ void QQuickContext2DCommandBuffer::replay(QPainter* p, QQuickContext2D::State& s
qreal shadow_dy = dy + (state.shadowOffsetX < 0? state.shadowOffsetY:0);
p->drawImage(shadow_dx, shadow_dy, shadow);
}
+
+ //Strange OpenGL painting behavior here, without beginNativePainting/endNativePainting, only the first image is painted.
+ p->beginNativePainting();
p->drawImage(dx, dy, image);
+ p->endNativePainting();
}
break;
}
diff --git a/tests/auto/quick/qquickcanvasitem/data/tst_image.qml b/tests/auto/quick/qquickcanvasitem/data/tst_image.qml
index 5853c034c4..71931acae8 100644
--- a/tests/auto/quick/qquickcanvasitem/data/tst_image.qml
+++ b/tests/auto/quick/qquickcanvasitem/data/tst_image.qml
@@ -692,4 +692,16 @@ CanvasTestCase {
comparePixel(ctx, 50,25, 0,255,0,255, 2);
}
-}
+ function test_multiple_painting(row) {
+ var canvas = createCanvasObject(row);
+ var ctx = canvas.getContext('2d');
+ loadImages(canvas);
+
+ ctx.fillStyle = '#0f0';
+ ctx.fillRect(0, 0, 100, 50);
+ ctx.drawImage('red.png', 0, 0, 50, 50);
+ ctx.drawImage('red.png', 50, 0, 100, 50);
+ comparePixel(ctx, 25,25, 255,0,0,255, 2);
+ comparePixel(ctx, 75,25, 255,0,0,255, 2);
+ }
+} \ No newline at end of file