summaryrefslogtreecommitdiff
path: root/drawinglayer
diff options
context:
space:
mode:
authorNoel Grandin <noel.grandin@collabora.co.uk>2022-09-02 12:03:26 +0200
committerNoel Grandin <noel.grandin@collabora.co.uk>2022-09-02 13:22:13 +0200
commitdabaf2879673fe4bbe874a2917e7a9200737ba81 (patch)
tree6f8e0168e0b1a72c5dc6323817ba461d09eecb93 /drawinglayer
parentffd404384ec7f2c41451783f999a636f4e581441 (diff)
tdf#136370 Very large Shape with pattern/hatch makes scrolling slow
reduce some time spent in the 3-d rendering Change-Id: I5d622799bc101b5b988d382a039b5a3b03818d1c Reviewed-on: https://gerrit.libreoffice.org/c/core/+/139256 Tested-by: Jenkins Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
Diffstat (limited to 'drawinglayer')
-rw-r--r--drawinglayer/source/texture/texture.cxx30
1 files changed, 28 insertions, 2 deletions
diff --git a/drawinglayer/source/texture/texture.cxx b/drawinglayer/source/texture/texture.cxx
index b3477f642880..4a92e443c275 100644
--- a/drawinglayer/source/texture/texture.cxx
+++ b/drawinglayer/source/texture/texture.cxx
@@ -627,8 +627,34 @@ namespace drawinglayer::texture
double GeoTexSvxHatch::getDistanceToHatch(const basegfx::B2DPoint& rUV) const
{
- const basegfx::B2DPoint aCoor(getBackTextureTransform() * rUV);
- return fmod(aCoor.getY(), mfDistance);
+ // the below is an inlined and optimised version of
+ // const basegfx::B2DPoint aCoor(getBackTextureTransform() * rUV);
+ // return fmod(aCoor.getY(), mfDistance);
+
+ const basegfx::B2DHomMatrix& rMat = getBackTextureTransform();
+ double fX = rUV.getX();
+ double fY = rUV.getY();
+
+ double fTempY(
+ rMat.get(1, 0) * fX +
+ rMat.get(1, 1) * fY +
+ rMat.get(1, 2));
+
+ if(!rMat.isLastLineDefault())
+ {
+ const double fOne(1.0);
+ const double fTempM(
+ rMat.get(2, 0) * fX +
+ rMat.get(2, 1) * fY +
+ rMat.get(2, 2));
+
+ if(!basegfx::fTools::equalZero(fTempM) && !basegfx::fTools::equal(fOne, fTempM))
+ {
+ fTempY /= fTempM;
+ }
+ }
+
+ return fmod(fTempY, mfDistance);
}
const basegfx::B2DHomMatrix& GeoTexSvxHatch::getBackTextureTransform() const