[Libreoffice-commits] core.git: 2 commits - basegfx/source drawinglayer/source sc/source sw/source

2018-09-03 Thread Libreoffice Gerrit user
 basegfx/source/matrix/b3dhommatrix.cxx |   15 +--
 drawinglayer/source/primitive2d/svggradientprimitive2d.cxx |   17 +++--
 sc/source/filter/inc/lotattr.hxx   |2 -
 sc/source/filter/lotus/lotattr.cxx |6 ++--
 sc/source/ui/attrdlg/scdlgfact.cxx |2 -
 sc/source/ui/attrdlg/scdlgfact.hxx |4 +--
 sw/source/core/layout/wsfrm.cxx|   14 +-
 7 files changed, 26 insertions(+), 34 deletions(-)

New commits:
commit 437d5d30422014c0a6def06e432a41e3f2e5c4c5
Author: Noel Grandin 
AuthorDate: Fri Aug 31 16:49:22 2018 +0200
Commit: Noel Grandin 
CommitDate: Mon Sep 3 12:41:46 2018 +0200

move identity checks into B3DHomMatrix::operator*=

and consequently simplify some call-sites

Change-Id: I301fc4c88fdfb8af75a348a41593a27f4c6567c5
Reviewed-on: https://gerrit.libreoffice.org/59916
Tested-by: Jenkins
Reviewed-by: Noel Grandin 

diff --git a/basegfx/source/matrix/b3dhommatrix.cxx 
b/basegfx/source/matrix/b3dhommatrix.cxx
index d23aed896120..e3f3d3d28475 100644
--- a/basegfx/source/matrix/b3dhommatrix.cxx
+++ b/basegfx/source/matrix/b3dhommatrix.cxx
@@ -117,9 +117,20 @@ namespace basegfx
 
 B3DHomMatrix& B3DHomMatrix::operator*=(const B3DHomMatrix& rMat)
 {
-if(!rMat.isIdentity())
+if(rMat.isIdentity())
+{
+// multiply with identity, no change -> nothing to do
+}
+else if(isIdentity())
+{
+// we are identity, result will be rMat -> assign
+*this = rMat;
+}
+else
+{
+// multiply
 mpImpl->doMulMatrix(*rMat.mpImpl);
-
+}
 return *this;
 }
 
diff --git a/drawinglayer/source/primitive2d/svggradientprimitive2d.cxx 
b/drawinglayer/source/primitive2d/svggradientprimitive2d.cxx
index 12eef36c16ac..6e2ab2e16b3e 100644
--- a/drawinglayer/source/primitive2d/svggradientprimitive2d.cxx
+++ b/drawinglayer/source/primitive2d/svggradientprimitive2d.cxx
@@ -404,14 +404,11 @@ namespace drawinglayer
 aUnitGradientToObject.rotate(atan2(aVector.getY(), 
aVector.getX()));
 aUnitGradientToObject.translate(getStart().getX(), 
getStart().getY());
 
-if(!getGradientTransform().isIdentity())
-{
-aUnitGradientToObject = getGradientTransform() * 
aUnitGradientToObject;
-}
+aUnitGradientToObject *= getGradientTransform();
 
 // create full transform from unit gradient coordinates to 
object coordinates
 // including the SvgGradient transformation
-aUnitGradientToObject = aObjectTransform * 
aUnitGradientToObject;
+aUnitGradientToObject *= aObjectTransform;
 }
 else
 {
@@ -424,10 +421,7 @@ namespace drawinglayer
 aUnitGradientToObject.rotate(atan2(aVector.getY(), 
aVector.getX()));
 aUnitGradientToObject.translate(aStart.getX(), 
aStart.getY());
 
-if(!getGradientTransform().isIdentity())
-{
-aUnitGradientToObject = getGradientTransform() * 
aUnitGradientToObject;
-}
+aUnitGradientToObject *= getGradientTransform();
 }
 
 // create inverse from it
@@ -757,10 +751,7 @@ namespace drawinglayer
 aUnitGradientToObject.scale(fRadius, fRadius);
 aUnitGradientToObject.translate(aStart.getX(), 
aStart.getY());
 
-if(!getGradientTransform().isIdentity())
-{
-aUnitGradientToObject = getGradientTransform() * 
aUnitGradientToObject;
-}
+aUnitGradientToObject *= getGradientTransform();
 }
 
 // create inverse from it
diff --git a/sw/source/core/layout/wsfrm.cxx b/sw/source/core/layout/wsfrm.cxx
index cdce7870a536..bc41904eea2c 100644
--- a/sw/source/core/layout/wsfrm.cxx
+++ b/sw/source/core/layout/wsfrm.cxx
@@ -274,18 +274,8 @@ void TransformableSwFrame::restoreFrameAreas()
 // transform by given B2DHomMatrix
 void TransformableSwFrame::transform(const basegfx::B2DHomMatrix aTransform)
 {
-if(!aTransform.isIdentity())
-{
-if(!maFrameAreaTransformation.isIdentity())
-{
-maFrameAreaTransformation *= aTransform;
-}
-
-if(!maFramePrintAreaTransformation.isIdentity())
-{
-maFramePrintAreaTransformation *= aTransform;
-}
-}
+maFrameAreaTransformation *= aTransform;
+maFramePrintAreaTransformation *= aTransform;
 }
 
 SwFrame::SwFrame( SwModify *pMod, SwFrame* pSib )
commit 

[Libreoffice-commits] core.git: 2 commits - basegfx/source drawinglayer/source

2014-08-07 Thread Armin Le Grand
 basegfx/source/polygon/b2dpolygonclipper.cxx   |   73 +
 drawinglayer/source/processor2d/vclmetafileprocessor2d.cxx |   65 +--
 2 files changed, 84 insertions(+), 54 deletions(-)

New commits:
commit 5554be7f4cddcfeb450bfe41d0b588c8e8f6de76
Author: Armin Le Grand a...@apache.org
Date:   Wed Aug 6 10:42:28 2014 +

Related: #i125349# refined to exclude possible recursive calls

(cherry picked from commit a02eb39b84d130e5923f72edb2abb3b21adf6fff)

Change-Id: Id068928f77a6efed44da9b83ecbf547302826591

diff --git a/basegfx/source/polygon/b2dpolygonclipper.cxx 
b/basegfx/source/polygon/b2dpolygonclipper.cxx
index e73c388..c9f1587 100644
--- a/basegfx/source/polygon/b2dpolygonclipper.cxx
+++ b/basegfx/source/polygon/b2dpolygonclipper.cxx
@@ -341,71 +341,6 @@ namespace basegfx
 
 if(rCandidate.count()  rClip.count())
 {
-// #125349# detect if both given PolyPolygons are indeed ranges
-bool bBothRectangle(false);
-
-if(basegfx::tools::isRectangle(rCandidate))
-{
-if(basegfx::tools::isRectangle(rClip))
-{
-// both are ranges
-bBothRectangle = true;
-}
-else
-{
-// rCandidate is rectangle - clip rClip on 
rRectangle, use the much
-// cheaper and numerically more stable clipping 
against a range
-// This simplification (exchanging content and clip) 
is valid
-// since we do a logical AND operation
-return clipPolyPolygonOnRange(rClip, 
rCandidate.getB2DRange(), bInside, bStroke);
-}
-}
-else if(basegfx::tools::isRectangle(rClip))
-{
-if(basegfx::tools::isRectangle(rCandidate))
-{
-// both are ranges
-bBothRectangle = true;
-}
-else
-{
-// rClip is rectangle - clip rCandidate on 
rRectangle, use the much
-// cheaper and numerically more stable clipping 
against a range
-return clipPolyPolygonOnRange(rCandidate, 
rClip.getB2DRange(), bInside, bStroke);
-}
-}
-
-if(bBothRectangle)
-{
-// both are rectangle
-if(rCandidate.getB2DRange().equal(rClip.getB2DRange()))
-{
-// if both are equal - no change
-return rCandidate;
-}
-else
-{
-// not equal - create new intersection from both 
ranges,
-// but much cheaper based on the ranges
-basegfx::B2DRange 
aIntersectionRange(rCandidate.getB2DRange());
-
-aIntersectionRange.intersect(rClip.getB2DRange());
-
-if(aIntersectionRange.isEmpty())
-{
-// no common IntersectionRange - the clip will be 
empty
-return B2DPolyPolygon();
-}
-else
-{
-// use common aIntersectionRange as result, convert
-// to expected PolyPolygon form
-return basegfx::B2DPolyPolygon(
-
basegfx::tools::createPolygonFromRect(aIntersectionRange));
-}
-}
-}
-
 // one or both are no rectangle - go the hard way and clip 
PolyPolygon
 // against PolyPolygon...
 if(bStroke)
@@ -476,6 +411,77 @@ namespace basegfx
 }
 else
 {
+// check for simplification with ranges if !bStroke 
(handling as stroke is more simple),
+// but also only when bInside, else the simplification may 
lead to recursive calls (see
+// calls to clipPolyPolygonOnPolyPolygon in 
clipPolyPolygonOnRange and clipPolygonOnRange)
+if(bInside)
+{
+// #i125349# detect if both given PolyPolygons are 
indeed ranges
+bool bBothRectangle(false);
+
+if(basegfx::tools::isRectangle(rCandidate))
+{
+if(basegfx::tools::isRectangle(rClip))
+{
+// both are ranges
+bBothRectangle = true;
+