summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorEirik Aavitsland <eirik.aavitsland@qt.io>2022-03-11 14:15:44 +0100
committerEirik Aavitsland <eirik.aavitsland@qt.io>2022-03-15 12:45:46 +0100
commitf46db29d8c5185e952f4665d6d141586373d3a0f (patch)
treef45baabb1c0e48c66b7b4636cffd390c1d6f5afc /src
parent182255052966d2163cfe0e16bf267925894abac8 (diff)
Painting: fix overriding and combining different clip types
In a recent improvement (6de36918c03e91933fbfb5bf7b53abbe03edf460) the last set clip region or path was stored in separate variables, in order to be set again if the aliasing mode changed. That solution was too simplistic, as it would break down as soon as more than one clip area was set, with the latter either replacing or intersecting the first. It was also unnecessary to introduce new storing of clip areas and transforms, as those are already recorded in the clipInfo stack in the painter state. This patch hence reverts much of that implementation. However the basic idea of setting the clip area again after AA change is good, so that part is kept, implementated instead by calling a pre-existing function to replay the clipInfo stack. One of the baseline test cases is extended to excercise the combination of clip areas. As a driveby, support for setClipRectF is added to the painting baseline test scripts, and the build of the manual lance tool is fixed. Fixes: QTBUG-101474 Pick-to: 6.3 6.2 Change-Id: Ide8b70d8cbf138deb06cbb84f69e62f7405886e6 Reviewed-by: Allan Sandfeld Jensen <allan.jensen@qt.io>
Diffstat (limited to 'src')
-rw-r--r--src/gui/painting/qpaintengine_raster.cpp24
-rw-r--r--src/gui/painting/qpaintengine_raster_p.h1
-rw-r--r--src/gui/painting/qpainter.cpp2
3 files changed, 1 insertions, 26 deletions
diff --git a/src/gui/painting/qpaintengine_raster.cpp b/src/gui/painting/qpaintengine_raster.cpp
index 6fbedabdbd..eb4fce2673 100644
--- a/src/gui/painting/qpaintengine_raster.cpp
+++ b/src/gui/painting/qpaintengine_raster.cpp
@@ -1223,7 +1223,6 @@ void QRasterPaintEngine::clip(const QVectorPath &path, Qt::ClipOperation op)
ensureOutlineMapper();
d->rasterize(d->outlineMapper->convertPath(path), qt_span_clip, &clipData, nullptr);
- newClip->clipTransform = s->matrix;
newClip->fixup();
if (s->flags.has_clip_ownership)
@@ -1308,7 +1307,6 @@ bool QRasterPaintEngine::setClipRectInDeviceCoords(const QRect &r, Qt::ClipOpera
return false;
}
- s->clip->clipTransform = s->matrix;
qrasterpaintengine_dirty_clip(d, s);
return true;
}
@@ -1364,7 +1362,6 @@ void QRasterPaintEngine::clip(const QRegion &region, Qt::ClipOperation op)
else if (curClip->hasRegionClip)
newClip->setClipRegion(r & curClip->clipRegion);
- newClip->clipTransform = s->matrix;
qrasterpaintengine_dirty_clip(d, s);
}
}
@@ -3704,27 +3701,8 @@ void QRasterPaintEnginePrivate::updateClipping()
if (!s->clipEnabled)
return;
- bool noClipPath = s->clipPath.isEmpty();
- bool noClipRegion = s->clipRegion.isEmpty();
-
- if (noClipPath && noClipRegion)
- return;
-
- if (!s->clip)
- return;
-
- const QTransform stateTransform = s->matrix;
- s->matrix = s->clip->clipTransform;
-
qrasterpaintengine_state_setNoClip(s);
-
- if (noClipRegion) {
- q->clip(qtVectorPathForPath(s->clipPath), s->clipOperation);
- } else {
- q->clip(s->clipRegion, s->clipOperation);
- }
-
- s->matrix = stateTransform;
+ replayClipOperations();
}
void QRasterPaintEnginePrivate::recalculateFastImages()
diff --git a/src/gui/painting/qpaintengine_raster_p.h b/src/gui/painting/qpaintengine_raster_p.h
index 4433c021e2..73dfd74031 100644
--- a/src/gui/painting/qpaintengine_raster_p.h
+++ b/src/gui/painting/qpaintengine_raster_p.h
@@ -374,7 +374,6 @@ public:
QRect clipRect;
QRegion clipRegion;
- QTransform clipTransform;
uint enabled : 1;
uint hasRectClip : 1;
diff --git a/src/gui/painting/qpainter.cpp b/src/gui/painting/qpainter.cpp
index 704b841b15..5883cc5bbe 100644
--- a/src/gui/painting/qpainter.cpp
+++ b/src/gui/painting/qpainter.cpp
@@ -2848,7 +2848,6 @@ void QPainter::setClipRegion(const QRegion &r, Qt::ClipOperation op)
d->state->clipInfo.clear();
d->state->clipInfo.append(QPainterClipInfo(r, op, d->state->matrix));
d->state->clipOperation = op;
- d->state->clipRegion = r;
return;
}
@@ -3063,7 +3062,6 @@ void QPainter::setClipPath(const QPainterPath &path, Qt::ClipOperation op)
d->state->clipInfo.clear();
d->state->clipInfo.append(QPainterClipInfo(path, op, d->state->matrix));
d->state->clipOperation = op;
- d->state->clipPath = path;
return;
}