summaryrefslogtreecommitdiff
path: root/drawinglayer
diff options
context:
space:
mode:
authorArmin Le Grand (allotropia) <armin.le.grand.extern@allotropia.de>2023-04-04 14:57:06 +0200
committerArmin Le Grand <Armin.Le.Grand@me.com>2023-04-04 18:55:49 +0200
commit4b5203ebf4ca5894f4d7dd37a141832df26e8b9a (patch)
treee3f3497bdc121eade2d9c812ae26c3d8d0c8d718 /drawinglayer
parent37928bef1c23f30df04bc7e95fcbc202c8cb4299 (diff)
MCGR: Improve performance for texture-mapped MCGR processing
Change-Id: I20b32e7c272112c6c3d9f7ee0ef59c6d4d006d94 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/150020 Tested-by: Jenkins Reviewed-by: Armin Le Grand <Armin.Le.Grand@me.com>
Diffstat (limited to 'drawinglayer')
-rw-r--r--drawinglayer/inc/texture/texture.hxx4
-rw-r--r--drawinglayer/source/texture/texture.cxx13
2 files changed, 11 insertions, 6 deletions
diff --git a/drawinglayer/inc/texture/texture.hxx b/drawinglayer/inc/texture/texture.hxx
index 54ace6ba3b47..01d3ec5c64c5 100644
--- a/drawinglayer/inc/texture/texture.hxx
+++ b/drawinglayer/inc/texture/texture.hxx
@@ -52,6 +52,10 @@ namespace drawinglayer::texture
basegfx::ColorStops mnColorStops;
double mfBorder;
+ // provide a single buffer entry used for gradient texture
+ // mapping, see ::modifyBColor implementations
+ mutable basegfx::ColorStopRange maLastColorStopRange;
+
// check if we need last-ColorStop-correction
bool checkPenultimate();
diff --git a/drawinglayer/source/texture/texture.cxx b/drawinglayer/source/texture/texture.cxx
index 1390ee3d82bf..0960ffbbbde3 100644
--- a/drawinglayer/source/texture/texture.cxx
+++ b/drawinglayer/source/texture/texture.cxx
@@ -78,6 +78,7 @@ namespace drawinglayer::texture
, mnRequestedSteps(nRequestedSteps)
, mnColorStops(rColorStops)
, mfBorder(fBorder)
+ , maLastColorStopRange()
{
}
@@ -265,7 +266,7 @@ namespace drawinglayer::texture
// texture-back-transform X/Y -> t [0.0..1.0] and determine color
const double fScaler(basegfx::utils::getLinearGradientAlpha(rUV, maGradientInfo));
- rBColor = basegfx::utils::modifyBColor(mnColorStops, fScaler, mnRequestedSteps);
+ rBColor = basegfx::utils::modifyBColor(mnColorStops, fScaler, mnRequestedSteps, maLastColorStopRange);
}
GeoTexSvxGradientAxial::GeoTexSvxGradientAxial(
@@ -392,7 +393,7 @@ namespace drawinglayer::texture
const double fScaler(basegfx::utils::getAxialGradientAlpha(rUV, maGradientInfo));
// we use the reverse ColorSteps here, so mirror scaler value
- rBColor = basegfx::utils::modifyBColor(mnColorStops, 1.0 - fScaler, mnRequestedSteps);
+ rBColor = basegfx::utils::modifyBColor(mnColorStops, 1.0 - fScaler, mnRequestedSteps, maLastColorStopRange);
}
@@ -484,7 +485,7 @@ namespace drawinglayer::texture
// texture-back-transform X/Y -> t [0.0..1.0] and determine color
const double fScaler(basegfx::utils::getRadialGradientAlpha(rUV, maGradientInfo));
- rBColor = basegfx::utils::modifyBColor(mnColorStops, fScaler, mnRequestedSteps);
+ rBColor = basegfx::utils::modifyBColor(mnColorStops, fScaler, mnRequestedSteps, maLastColorStopRange);
}
@@ -585,7 +586,7 @@ namespace drawinglayer::texture
// texture-back-transform X/Y -> t [0.0..1.0] and determine color
const double fScaler(basegfx::utils::getEllipticalGradientAlpha(rUV, maGradientInfo));
- rBColor = basegfx::utils::modifyBColor(mnColorStops, fScaler, mnRequestedSteps);
+ rBColor = basegfx::utils::modifyBColor(mnColorStops, fScaler, mnRequestedSteps, maLastColorStopRange);
}
@@ -679,7 +680,7 @@ namespace drawinglayer::texture
// texture-back-transform X/Y -> t [0.0..1.0] and determine color
const double fScaler(basegfx::utils::getSquareGradientAlpha(rUV, maGradientInfo));
- rBColor = basegfx::utils::modifyBColor(mnColorStops, fScaler, mnRequestedSteps);
+ rBColor = basegfx::utils::modifyBColor(mnColorStops, fScaler, mnRequestedSteps, maLastColorStopRange);
}
@@ -780,7 +781,7 @@ namespace drawinglayer::texture
// texture-back-transform X/Y -> t [0.0..1.0] and determine color
const double fScaler(basegfx::utils::getRectangularGradientAlpha(rUV, maGradientInfo));
- rBColor = basegfx::utils::modifyBColor(mnColorStops, fScaler, mnRequestedSteps);
+ rBColor = basegfx::utils::modifyBColor(mnColorStops, fScaler, mnRequestedSteps, maLastColorStopRange);
}