summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorSamuel Rødal <sroedal@trolltech.com>2009-08-18 11:35:30 (GMT)
committerSamuel Rødal <sroedal@trolltech.com>2009-08-18 12:27:08 (GMT)
commit5f2f444a9d8d80d778053c2af66534d582145055 (patch)
treeabd23791e363e3d0e31a44cfd721c338b0e85308 /src
parente1c9136214532cc41074449e3a894fdea020a41e (diff)
downloadQt-5f2f444a9d8d80d778053c2af66534d582145055.zip
Qt-5f2f444a9d8d80d778053c2af66534d582145055.tar.gz
Qt-5f2f444a9d8d80d778053c2af66534d582145055.tar.bz2
Fixed bug when rendering long lines of text without XRender.
XRectangle coordinates need to be clipped to the short integer range. Task-number: 250137 Reviewed-by: Trond
Diffstat (limited to 'src')
-rw-r--r--src/gui/painting/qpaintengine_x11.cpp16
1 files changed, 12 insertions, 4 deletions
diff --git a/src/gui/painting/qpaintengine_x11.cpp b/src/gui/painting/qpaintengine_x11.cpp
index 6816aac..a4d34b5 100644
--- a/src/gui/painting/qpaintengine_x11.cpp
+++ b/src/gui/painting/qpaintengine_x11.cpp
@@ -2459,15 +2459,23 @@ void QX11PaintEngine::drawFreetype(const QPointF &p, const QTextItemInt &ti)
XRectangle rects[rectcount];
int num_rects = 0;
+ QPoint delta(qRound(d->matrix.dx()), qRound(d->matrix.dy()));
+ QRect clip(d->polygonClipper.boundingRect());
for (int i=0; i < path.elementCount(); i+=5) {
int x = qRound(path.elementAt(i).x);
int y = qRound(path.elementAt(i).y);
int w = qRound(path.elementAt(i+1).x) - x;
int h = qRound(path.elementAt(i+2).y) - y;
- rects[num_rects].x = x + qRound(d->matrix.dx());
- rects[num_rects].y = y + qRound(d->matrix.dy());
- rects[num_rects].width = w;
- rects[num_rects].height = h;
+
+ QRect rect = QRect(x + delta.x(), y + delta.y(), w, h);
+ rect = rect.intersected(clip);
+ if (rect.isEmpty())
+ continue;
+
+ rects[num_rects].x = short(rect.x());
+ rects[num_rects].y = short(rect.y());
+ rects[num_rects].width = ushort(rect.width());
+ rects[num_rects].height = ushort(rect.height());
++num_rects;
if (num_rects == rectcount) {
XFillRectangles(d->dpy, d->hd, d->gc, rects, num_rects);