diff options
author | Eirik Aavitsland <eirik.aavitsland@qt.io> | 2017-08-04 16:22:23 +0200 |
---|---|---|
committer | Eirik Aavitsland <eirik.aavitsland@qt.io> | 2018-06-22 10:42:33 +0000 |
commit | f5fe9fc5a4136a696f07c4bd3567d85348ec42d9 (patch) | |
tree | cbfd3a39c9eeaa5ae11a8469bcd5431bedc06f77 /tests/auto/other | |
parent | 99d4f0026f90681974f6fd1d23941e5b69024796 (diff) |
Add ObjectMode coordinate mode to QGradient
The ObjectBoundingMode coordinate mode of QGradient allows specifying
the gradient coordinates relative to the object being painted. But if
the gradient brush also has a transformation, that transformation is
applied in the logical, not object, coordinate space. That behavior is
counterintuitive. However, changing it now would break existing
code. Instead, we introduce a new coordinate mode enum with the
expected behavior, and document the old one as deprecated.
This prepares to fix the bugs below in qtsvg, by making
it possible to specify the same behavior in Qt as SVG has.
[ChangeLog][QtGui][QGradient] Add ObjectMode coordinate mode
[ChangeLog][Important Behavior Changes] QDataStream version bumped up to 18 to account for changes in the serialization of QGradient.
Task-number: QTBUG-59978
Task-number: QTBUG-67995
Change-Id: I8820a2555359812f3e1a46e37d6ac2cc29a2091d
Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
Reviewed-by: Allan Sandfeld Jensen <allan.jensen@qt.io>
Diffstat (limited to 'tests/auto/other')
-rw-r--r-- | tests/auto/other/lancelot/paintcommands.cpp | 5 | ||||
-rw-r--r-- | tests/auto/other/lancelot/scripts/gradientxform_object.qps | 15 |
2 files changed, 18 insertions, 2 deletions
diff --git a/tests/auto/other/lancelot/paintcommands.cpp b/tests/auto/other/lancelot/paintcommands.cpp index 45429624f5..377b98fa41 100644 --- a/tests/auto/other/lancelot/paintcommands.cpp +++ b/tests/auto/other/lancelot/paintcommands.cpp @@ -106,7 +106,8 @@ const char *PaintCommands::spreadMethodTable[] = { const char *PaintCommands::coordinateMethodTable[] = { "LogicalMode", "StretchToDeviceMode", - "ObjectBoundingMode" + "ObjectBoundingMode", + "ObjectMode" }; const char *PaintCommands::sizeModeTable[] = { @@ -2394,7 +2395,7 @@ void PaintCommands::command_gradient_setSpread(QRegularExpressionMatch re) void PaintCommands::command_gradient_setCoordinateMode(QRegularExpressionMatch re) { - int coord = translateEnum(coordinateMethodTable, re.captured(1), 3); + int coord = translateEnum(coordinateMethodTable, re.captured(1), 4); if (m_verboseMode) printf(" -(lance) gradient_setCoordinateMode %d=[%s]\n", coord, diff --git a/tests/auto/other/lancelot/scripts/gradientxform_object.qps b/tests/auto/other/lancelot/scripts/gradientxform_object.qps index d785a008c0..dcc718072f 100644 --- a/tests/auto/other/lancelot/scripts/gradientxform_object.qps +++ b/tests/auto/other/lancelot/scripts/gradientxform_object.qps @@ -62,7 +62,22 @@ repeat_block row restore end_block block +save translate 400 0 brushRotate 30.0 brushScale 1.5 .5 repeat_block block +restore + +drawText 80 400 "BRUSH XFORM, OBJECT BOUNDING MODE" +drawText 500 400 "BRUSH XFORM, OBJECT MODE" + +translate 0 400 +brushTranslate 0.5 0.5 +brushRotate 180.0 +brushTranslate -0.5 -0.5 +repeat_block block + +translate 400 0 +gradient_setCoordinateMode ObjectMode +repeat_block block |