diff options
author | Armin Le Grand (allotropia) <armin.le.grand.extern@allotropia.de> | 2023-03-27 12:35:07 +0200 |
---|---|---|
committer | Armin Le Grand <Armin.Le.Grand@me.com> | 2023-03-27 12:42:28 +0000 |
commit | 13c37d2c0f0a172d2522b255c0416a4ade639b7a (patch) | |
tree | 3167d60542b6ec15ff98615baed7bc1e1f6e24c2 /svx | |
parent | b653556f8dc5a65805a0ef091f654b95caa20a63 (diff) |
MCGR: More corrections fo sortAndCorrectColorStops
Handle cases where gradient snippets overlap Start/End-
Color to preverve input information.
Added more test cases to createNewSdrFillAttribute to
check these cases.
All 27 look good, so add this changes.
Change-Id: I6b2ba190ac8cf5a00c5a27865cea6bb41efe5110
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/149624
Tested-by: Jenkins
Reviewed-by: Armin Le Grand <Armin.Le.Grand@me.com>
Diffstat (limited to 'svx')
-rw-r--r-- | svx/source/sdr/primitive2d/sdrattributecreator.cxx | 106 |
1 files changed, 106 insertions, 0 deletions
diff --git a/svx/source/sdr/primitive2d/sdrattributecreator.cxx b/svx/source/sdr/primitive2d/sdrattributecreator.cxx index 344e16e95a8e..a7670606adff 100644 --- a/svx/source/sdr/primitive2d/sdrattributecreator.cxx +++ b/svx/source/sdr/primitive2d/sdrattributecreator.cxx @@ -644,6 +644,112 @@ namespace drawinglayer::primitive2d break; } + case 17: + { + // check case with single stop < 0.0 + aColorStops.clear(); + aColorStops.emplace_back(-0.5, COL_LIGHTRED.getBColor()); // red + break; + } + + case 18: + { + // check case with single stop > 1.0 + aColorStops.clear(); + aColorStops.emplace_back(1.5, COL_LIGHTRED.getBColor()); // red + break; + } + + case 19: + { + // check case with stops overlapping 0.0 + aColorStops.clear(); + aColorStops.emplace_back(-0.5, COL_LIGHTRED.getBColor()); // red + aColorStops.emplace_back(0.5, COL_LIGHTBLUE.getBColor()); // blue + break; + } + + case 20: + { + // check case with stops overlapping 1.0 + aColorStops.clear(); + aColorStops.emplace_back(0.5, COL_LIGHTRED.getBColor()); // red + aColorStops.emplace_back(1.5, COL_LIGHTBLUE.getBColor()); // blue + break; + } + + case 21: + { + // check case with multiple stops < 0.0 + aColorStops.clear(); + aColorStops.emplace_back(-0.5, COL_LIGHTRED.getBColor()); // red + aColorStops.emplace_back(-0.4, COL_LIGHTBLUE.getBColor()); // blue + aColorStops.emplace_back(-0.3, COL_LIGHTGREEN.getBColor()); // green + break; + } + + case 22: + { + // check case with multiple stops > 1.0 + aColorStops.clear(); + aColorStops.emplace_back(1.3, COL_LIGHTRED.getBColor()); // red + aColorStops.emplace_back(1.4, COL_LIGHTBLUE.getBColor()); // blue + aColorStops.emplace_back(1.5, COL_LIGHTGREEN.getBColor()); // green + break; + } + + case 23: + { + // check case with stops overlapping 0.0 and 1.0 + aColorStops.clear(); + aColorStops.emplace_back(-0.5, COL_LIGHTRED.getBColor()); // red + aColorStops.emplace_back(0.5, COL_LIGHTBLUE.getBColor()); // blue + aColorStops.emplace_back(0.5, COL_LIGHTGREEN.getBColor()); // green + aColorStops.emplace_back(1.5, COL_LIGHTRED.getBColor()); // red + break; + } + + case 24: + { + // check case with stops overlapping 0.0 and 1.0 and multiple entries + aColorStops.clear(); + aColorStops.emplace_back(-0.5, COL_LIGHTGREEN.getBColor()); // green + aColorStops.emplace_back(-0.5, COL_LIGHTRED.getBColor()); // red + aColorStops.emplace_back(0.4, COL_LIGHTBLUE.getBColor()); // blue + aColorStops.emplace_back(0.5, COL_YELLOW.getBColor()); // yellow + aColorStops.emplace_back(0.6, COL_LIGHTGREEN.getBColor()); // green + aColorStops.emplace_back(1.5, COL_LIGHTRED.getBColor()); // red + aColorStops.emplace_back(1.5, COL_LIGHTGREEN.getBColor()); // green + break; + } + + case 25: + { + // check case with just two stops overlapping 0.0 and 1.0 + aColorStops.clear(); + aColorStops.emplace_back(-0.5, COL_LIGHTRED.getBColor()); // red + aColorStops.emplace_back(1.5, COL_LIGHTGREEN.getBColor()); // green + break; + } + + case 26: + { + // check case with just two stops overlapping 0.0 and 1.0 faaaar out + aColorStops.clear(); + aColorStops.emplace_back(-5.5, COL_LIGHTRED.getBColor()); // red + aColorStops.emplace_back(5.5, COL_LIGHTGREEN.getBColor()); // green + break; + } + + case 27: + { + // check case with just two stops overlapping 0.0 and 1.0 faaaar out but closer to one + aColorStops.clear(); + aColorStops.emplace_back(-1.5, COL_LIGHTRED.getBColor()); // red + aColorStops.emplace_back(5.5, COL_LIGHTGREEN.getBColor()); // green + break; + } + default: { break; |