qpa: Fix rendering issue in blitter paint engine
authorJulien Brianceau <jbrianceau@nds.com>
Fri, 5 Oct 2012 13:41:28 +0000 (15:41 +0200)
committerThe Qt Project <gerrit-noreply@qt-project.org>
Mon, 8 Oct 2012 06:14:37 +0000 (08:14 +0200)
Take into account brush transformation for TexturePattern fill.
Example : arrows are not rendered propery in
http://www.youtube.com/leanback website.

Change-Id: I5d4bc7410d1d589a27cf17e84062096cfbdb4d6f
Reviewed-by: Samuel Rødal <samuel.rodal@digia.com>
src/gui/painting/qpaintengine_blitter.cpp

index b29c588..1acdf8c 100644 (file)
@@ -558,7 +558,8 @@ void QBlitterPaintEngine::fillRect(const QRectF &rect, const QBrush &brush)
         && qbrush_color(brush).alpha() == 0xff
         && d->caps.canBlitterFillRect()) {
         d->fillRect(rect, qbrush_color(brush), false);
-    } else if (brush.style() == Qt::TexturePattern &&
+    } else if ((brush.style() == Qt::TexturePattern) &&
+               (brush.transform().type() <= QTransform::TxTranslate) &&
                 ((d->caps.canBlitterDrawPixmapOpacity(brush.texture())) ||
                  (d->caps.canBlitterDrawPixmap(rect, brush.texture(), rect)))) {
         bool rectIsFilled = false;
@@ -567,11 +568,11 @@ void QBlitterPaintEngine::fillRect(const QRectF &rect, const QBrush &brush)
         qreal y = transformedRect.y();
         QPixmap pm = brush.texture();
         d->unlock();
-        int srcX = int(rect.x() - state()->brushOrigin.x()) % pm.width();
+        int srcX = int(rect.x() - state()->brushOrigin.x() - brush.transform().dx()) % pm.width();
         if (srcX < 0)
             srcX = pm.width() + srcX;
         const int startX = srcX;
-        int srcY = int(rect.y() - state()->brushOrigin.y()) % pm.height();
+        int srcY = int(rect.y() - state()->brushOrigin.y() - brush.transform().dy()) % pm.height();
         if (srcY < 0)
             srcY = pm.height() + srcY;
         while (!rectIsFilled) {
@@ -685,7 +686,7 @@ void QBlitterPaintEngine::drawPixmap(const QRectF &r, const QPixmap &pm, const Q
     }
 }
 
-// Overridden methods to lock the graphics memory
+// Overriden methods to lock the graphics memory
 void QBlitterPaintEngine::drawPolygon(const QPointF *points, int pointCount, PolygonDrawMode mode)
 {
     Q_D(QBlitterPaintEngine);