diff options
author | Armin Le Grand (allotropia) <armin.le.grand.extern@allotropia.de> | 2023-02-24 17:34:53 +0100 |
---|---|---|
committer | Armin Le Grand <Armin.Le.Grand@me.com> | 2023-02-27 17:43:13 +0000 |
commit | 16e728a8a88a7a04acec069512a5268ae89cf420 (patch) | |
tree | e1fe9c3ffb38daca8ac025ffdc2a7fcd8f08420f /basegfx/source/tools/gradienttools.cxx | |
parent | 9027920783dd04db925c41b559abe6442cedf39e (diff) |
MCGR: Adapted other Gradient* to make use of MCGR
Added to make
GeoTexSvxGradientElliptical
GeoTexSvxGradientSquare
GeoTexSvxGradientRect
work using the MCGR. It is still 100%
backward-compatible, so as long as there is no
source using this it will stay invisible - by
purpose.
Tests look good with all three, see the static
variable nUseGradientSteps.
NOTE: GeoTexSvxGradientElliptical still looks not
optimal due to texture back-mapping method
getEllipticalGradientAlpha, see notes in
commit "MCGR: Adapted GradientRadial to make use
of MCGR" ac824594c577ab4880177b3411a25297b1d08074
Change-Id: I56b82b867af88fe532f840dde15e0f5c299ed6a3
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/147662
Tested-by: Jenkins
Reviewed-by: Armin Le Grand <Armin.Le.Grand@me.com>
Diffstat (limited to 'basegfx/source/tools/gradienttools.cxx')
-rw-r--r-- | basegfx/source/tools/gradienttools.cxx | 27 |
1 files changed, 2 insertions, 25 deletions
diff --git a/basegfx/source/tools/gradienttools.cxx b/basegfx/source/tools/gradienttools.cxx index 37671374262c..f35f91f5a79a 100644 --- a/basegfx/source/tools/gradienttools.cxx +++ b/basegfx/source/tools/gradienttools.cxx @@ -544,13 +544,6 @@ namespace basegfx t = 1.0 - std::hypot(aCoor.getX(), aCoor.getY() * fAspectRatio); } - const sal_uInt32 nSteps(rGradInfo.getRequestedSteps()); - - if(nSteps && t < 1.0) - { - return floor(t * nSteps) / double(nSteps - 1); - } - return t; } @@ -571,15 +564,7 @@ namespace basegfx return 0.0; } - const double t(1.0 - std::max(fAbsX, fAbsY)); - const sal_uInt32 nSteps(rGradInfo.getRequestedSteps()); - - if(nSteps && t < 1.0) - { - return floor(t * nSteps) / double(nSteps - 1); - } - - return t; + return 1.0 - std::max(fAbsX, fAbsY); } double getRectangularGradientAlpha(const B2DPoint& rUV, const ODFGradientInfo& rGradInfo) @@ -643,15 +628,7 @@ namespace basegfx fAbsY = ((fAbsY - 1) / fAspectRatio) + 1; } - const double t(1.0 - std::max(fAbsX, fAbsY)); - const sal_uInt32 nSteps(rGradInfo.getRequestedSteps()); - - if(nSteps && t < 1.0) - { - return floor(t * nSteps) / double(nSteps - 1); - } - - return t; + return 1.0 - std::max(fAbsX, fAbsY); } } // namespace utils } // namespace basegfx |