summaryrefslogtreecommitdiffstats
path: root/src/gui/painting/qpaintengine_raster.cpp
diff options
context:
space:
mode:
authorOlivier Goffart <olivier.goffart@nokia.com>2010-12-20 09:47:02 (GMT)
committerOlivier Goffart <olivier.goffart@nokia.com>2010-12-20 09:47:02 (GMT)
commit10c90522d6e3807baac3c4bfca4eedc51a4251f5 (patch)
tree92005b547e3b92eb9e640fae8c78fdcdc13b6dd9 /src/gui/painting/qpaintengine_raster.cpp
parent64e1f888586f2c988b08bcc93579990e970b7206 (diff)
parent97b039438bc31bb420138d72549372adb1244dc8 (diff)
downloadQt-10c90522d6e3807baac3c4bfca4eedc51a4251f5.zip
Qt-10c90522d6e3807baac3c4bfca4eedc51a4251f5.tar.gz
Qt-10c90522d6e3807baac3c4bfca4eedc51a4251f5.tar.bz2
Merge remote branch 'origin/4.7' into qt-master-from-4.7
Conflicts: demos/declarative/minehunt/minehunt.pro src/opengl/gl2paintengineex/qtextureglyphcache_gl.cpp src/plugins/phonon/mmf/mmf.pro src/s60installs/s60installs.pro tests/auto/qapplication/test/test.pro tests/auto/qgraphicsview/tst_qgraphicsview.cpp
Diffstat (limited to 'src/gui/painting/qpaintengine_raster.cpp')
-rw-r--r--src/gui/painting/qpaintengine_raster.cpp33
1 files changed, 23 insertions, 10 deletions
diff --git a/src/gui/painting/qpaintengine_raster.cpp b/src/gui/painting/qpaintengine_raster.cpp
index 97dfddf..dd14e66 100644
--- a/src/gui/painting/qpaintengine_raster.cpp
+++ b/src/gui/painting/qpaintengine_raster.cpp
@@ -1211,7 +1211,7 @@ void QRasterPaintEngine::clip(const QVectorPath &path, Qt::ClipOperation op)
// There are some cases that are not supported by clip(QRect)
if (op != Qt::UniteClip && (op != Qt::IntersectClip || !s->clip
|| s->clip->hasRectClip || s->clip->hasRegionClip)) {
- if (s->matrix.type() <= QTransform::TxTranslate
+ if (s->matrix.type() <= QTransform::TxScale
&& ((path.shape() == QVectorPath::RectangleHint)
|| (isRect(points, path.elementCount())
&& (!types || (types[0] == QPainterPath::MoveToElement
@@ -1223,8 +1223,8 @@ void QRasterPaintEngine::clip(const QVectorPath &path, Qt::ClipOperation op)
#endif
QRectF r(points[0], points[1], points[4]-points[0], points[5]-points[1]);
- clip(r.toRect(), op);
- return;
+ if (setClipRectInDeviceCoords(s->matrix.mapRect(r).toRect(), op))
+ return;
}
}
@@ -1285,7 +1285,6 @@ void QRasterPaintEngine::clip(const QRect &rect, Qt::ClipOperation op)
qDebug() << "QRasterPaintEngine::clip(): " << rect << op;
#endif
- Q_D(QRasterPaintEngine);
QRasterPaintEngineState *s = state();
if (op == Qt::NoClip) {
@@ -1295,11 +1294,23 @@ void QRasterPaintEngine::clip(const QRect &rect, Qt::ClipOperation op)
QPaintEngineEx::clip(rect, op);
return;
- } else if (op == Qt::ReplaceClip || s->clip == 0) {
+ } else if (!setClipRectInDeviceCoords(s->matrix.mapRect(rect), op)) {
+ QPaintEngineEx::clip(rect, op);
+ return;
+ }
+}
+
+
+bool QRasterPaintEngine::setClipRectInDeviceCoords(const QRect &r, Qt::ClipOperation op)
+{
+ Q_D(QRasterPaintEngine);
+ QRect clipRect = r & d->deviceRect;
+ QRasterPaintEngineState *s = state();
+
+ if (op == Qt::ReplaceClip || s->clip == 0) {
// No current clip, hence we intersect with sysclip and be
// done with it...
- QRect clipRect = s->matrix.mapRect(rect) & d->deviceRect;
QRegion clipRegion = systemClip();
QClipData *clip = new QClipData(d->rasterBuffer->height());
@@ -1315,12 +1326,11 @@ void QRasterPaintEngine::clip(const QRect &rect, Qt::ClipOperation op)
s->clip->enabled = true;
s->flags.has_clip_ownership = true;
- } else { // intersect clip with current clip
+ } else if (op == Qt::IntersectClip){ // intersect clip with current clip
QClipData *base = s->clip;
Q_ASSERT(base);
if (base->hasRectClip || base->hasRegionClip) {
- QRect clipRect = s->matrix.mapRect(rect) & d->deviceRect;
if (!s->flags.has_clip_ownership) {
s->clip = new QClipData(d->rasterBuffer->height());
s->flags.has_clip_ownership = true;
@@ -1331,11 +1341,14 @@ void QRasterPaintEngine::clip(const QRect &rect, Qt::ClipOperation op)
s->clip->setClipRegion(base->clipRegion & clipRect);
s->clip->enabled = true;
} else {
- QPaintEngineEx::clip(rect, op);
- return;
+ return false;
}
+ } else {
+ return false;
}
+
qrasterpaintengine_dirty_clip(d, s);
+ return true;
}