From 40ae4a41ab449f1d95dbbf2c91ade05cac8348a4 Mon Sep 17 00:00:00 2001
From: Aaron Kennedy <aaron.kennedy@nokia.com>
Date: Fri, 15 May 2009 16:36:30 +1000
Subject: Clip text drawing to bounding rect

---
 src/declarative/fx/qfxtext.cpp | 9 +++++++++
 1 file changed, 9 insertions(+)

diff --git a/src/declarative/fx/qfxtext.cpp b/src/declarative/fx/qfxtext.cpp
index a43219d..bc3856d 100644
--- a/src/declarative/fx/qfxtext.cpp
+++ b/src/declarative/fx/qfxtext.cpp
@@ -749,7 +749,16 @@ void QFxText::paintContents(QPainter &p)
         break;
     }
 
+    bool needClip = !clip() && (d->imgCache.width() > width() || 
+                                d->imgCache.height() > height());
+
+    if (needClip) {
+        p.save();
+        p.setClipRect(boundingRect());
+    }
     p.drawImage(x, y, d->imgCache);
+    if (needClip)
+        p.restore();
 }
 
 #elif defined(QFX_RENDER_OPENGL2)
-- 
cgit v0.12