diff options
author | Armin Le Grand (allotropia) <armin.le.grand.extern@allotropia.de> | 2023-03-22 11:44:52 +0100 |
---|---|---|
committer | Armin Le Grand <Armin.Le.Grand@me.com> | 2023-03-22 14:28:19 +0000 |
commit | 9331d2d333feb911e16f20ce899f2de220bee2f1 (patch) | |
tree | 586696998f20a4ad6d8e3b1e9400c845267534b0 /drawinglayer/source/attribute | |
parent | 3545c0c0b991e5b9438d890f48dd10c4a60f2090 (diff) |
MCGR: Corrected error with Case16 wrong gradient shortcut
Also simplified using the test cases, these now depend on
an ENV VAR called MCGR_TEST. Fallback is no test. For
seeing a multi-color gradient use 1, for Case16 use 16.
If active, all gradients are replaced with the one active
for the test, 2D and 3D. This is temporary but also for
pro build to check for speed there.
Change-Id: I90f3c7e59d9d0a3e070a849af3f9ea1c9e5462a0
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/149316
Tested-by: Jenkins
Reviewed-by: Armin Le Grand <Armin.Le.Grand@me.com>
Diffstat (limited to 'drawinglayer/source/attribute')
-rw-r--r-- | drawinglayer/source/attribute/fillgradientattribute.cxx | 35 |
1 files changed, 35 insertions, 0 deletions
diff --git a/drawinglayer/source/attribute/fillgradientattribute.cxx b/drawinglayer/source/attribute/fillgradientattribute.cxx index 62bde03a29f6..b25a4dab2f25 100644 --- a/drawinglayer/source/attribute/fillgradientattribute.cxx +++ b/drawinglayer/source/attribute/fillgradientattribute.cxx @@ -154,6 +154,41 @@ namespace drawinglayer::attribute return mpFillGradientAttribute->hasSingleColor(); } + // MCGR: Check if rendering cannot be handled by old vcl stuff + bool FillGradientAttribute::cannotBeHandledByVCL() const + { + // MCGR: If GradientStops are used, use decomposition since vcl is not able + // to render multi-color gradients + if (getColorStops().size() != 2) + { + return true; + } + + // MCGR: If GradientStops do not start and stop at traditional Start/EndColor, + // use decomposition since vcl is not able to render this + if (!getColorStops().empty()) + { + if (!basegfx::fTools::equalZero(getColorStops().front().getStopOffset()) + || !basegfx::fTools::equal(getColorStops().back().getStopOffset(), 1.0)) + { + return true; + } + } + + // VCL should be able to handle all styles, but for tdf#133477 the VCL result + // is different from processing the gradient manually by drawinglayer + // (and the Writer unittest for it fails). Keep using the drawinglayer code + // until somebody founds out what's wrong and fixes it. + if (getStyle() != drawinglayer::attribute::GradientStyle::Linear + && getStyle() != drawinglayer::attribute::GradientStyle::Axial + && getStyle() != drawinglayer::attribute::GradientStyle::Radial) + { + return true; + } + + return false; + } + FillGradientAttribute& FillGradientAttribute::operator=(const FillGradientAttribute&) = default; FillGradientAttribute& FillGradientAttribute::operator=(FillGradientAttribute&&) = default; |