diff options
| author | Eirik Aavitsland <[email protected]> | 2022-03-11 14:15:44 +0100 |
|---|---|---|
| committer | Eirik Aavitsland <[email protected]> | 2022-03-15 12:45:46 +0100 |
| commit | f46db29d8c5185e952f4665d6d141586373d3a0f (patch) | |
| tree | f45baabb1c0e48c66b7b4636cffd390c1d6f5afc /tests/baseline/shared/paintcommands.cpp | |
| parent | 182255052966d2163cfe0e16bf267925894abac8 (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 <[email protected]>
Diffstat (limited to 'tests/baseline/shared/paintcommands.cpp')
| -rw-r--r-- | tests/baseline/shared/paintcommands.cpp | 27 |
1 files changed, 25 insertions, 2 deletions
diff --git a/tests/baseline/shared/paintcommands.cpp b/tests/baseline/shared/paintcommands.cpp index d2e48688f93..2ece71a1fcc 100644 --- a/tests/baseline/shared/paintcommands.cpp +++ b/tests/baseline/shared/paintcommands.cpp @@ -564,8 +564,12 @@ void PaintCommands::staticInit() "setClipPath mypath ReplaceClip"); DECL_PAINTCOMMAND("setClipRect", command_setClipRect, "^setClipRect\\s+(-?\\w*)\\s+(-?\\w*)\\s+(-?\\w*)\\s+(-?\\w*)\\s*(\\w*)$", - "setClipRect <x1> <y1> <x2> <y2> <clip operation enum>", - "setClipRect 0.0 0.0 10.0 10.0 ReplaceClip"); + "setClipRect <x> <y> <w> <h> <clip operation enum>", + "setClipRect 0 0 10 10 ReplaceClip"); + DECL_PAINTCOMMAND("setClipRectF", command_setClipRectF, + "^setClipRectF\\s+(-?[.\\w]*)\\s+(-?[.\\w]*)\\s+(-?[.\\w]*)\\s+(-?[.\\w]*)\\s*(\\w.*)$", + "setClipRectF <x> <y> <w> <h> <clip operation enum>", + "setClipRectF 0.1 0.2 10.3 10.4 ReplaceClip"); DECL_PAINTCOMMAND("setClipping", command_setClipping, "^setClipping\\s+(\\w*)$", "setClipping <true|false>", @@ -2082,6 +2086,25 @@ void PaintCommands::command_setClipRect(QRegularExpressionMatch re) } /***************************************************************************************************/ +void PaintCommands::command_setClipRectF(QRegularExpressionMatch re) +{ + QStringList caps = re.capturedTexts(); + double x = convertToDouble(caps.at(1)); + double y = convertToDouble(caps.at(2)); + double w = convertToDouble(caps.at(3)); + double h = convertToDouble(caps.at(4)); + + int combine = translateEnum(clipOperationTable, caps.at(5), Qt::IntersectClip + 1); + if (combine == -1) + combine = Qt::ReplaceClip; + + if (m_verboseMode) + printf(" -(lance) setClipRectF(%f, %f, %f, %f), %s\n", x, y, w, h, clipOperationTable[combine]); + + m_painter->setClipRect(QRectF(x, y, w, h), Qt::ClipOperation(combine)); +} + +/***************************************************************************************************/ void PaintCommands::command_setClipPath(QRegularExpressionMatch re) { int combine = translateEnum(clipOperationTable, re.captured(2), Qt::IntersectClip + 1); |
