diff options
author | Xisco Fauli <xiscofauli@libreoffice.org> | 2024-11-19 14:25:01 +0100 |
---|---|---|
committer | Xisco Fauli <xiscofauli@libreoffice.org> | 2024-11-19 16:14:13 +0100 |
commit | d991795635784675f6659dc47265088b1803cd52 (patch) | |
tree | d3435e5c7f8f84ef30404808b2dde8dfb300f191 /canvas | |
parent | b20156432fcb2dadabff2decaa04537a7eebc042 (diff) |
canvas: simplify calcTransformedRectBounds
Change-Id: Ia0314a985ae2183727587ad254faec12ee49b66c
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/176769
Tested-by: Jenkins
Reviewed-by: Xisco Fauli <xiscofauli@libreoffice.org>
Diffstat (limited to 'canvas')
-rw-r--r-- | canvas/source/tools/canvascustomspritehelper.cxx | 6 | ||||
-rw-r--r-- | canvas/source/tools/canvastools.cxx | 9 | ||||
-rw-r--r-- | canvas/source/vcl/canvashelper.cxx | 3 | ||||
-rw-r--r-- | canvas/source/vcl/canvashelper_texturefill.cxx | 15 | ||||
-rw-r--r-- | canvas/source/vcl/impltools.cxx | 3 |
5 files changed, 12 insertions, 24 deletions
diff --git a/canvas/source/tools/canvascustomspritehelper.cxx b/canvas/source/tools/canvascustomspritehelper.cxx index 2517e05be947..d6aa4e06f0f5 100644 --- a/canvas/source/tools/canvascustomspritehelper.cxx +++ b/canvas/source/tools/canvascustomspritehelper.cxx @@ -70,8 +70,7 @@ namespace canvas // rectangular area which is actually covered by the sprite. // coordinates are relative to the sprite origin. - ::basegfx::B2DRectangle aSpriteRectPixel; - ::canvas::tools::calcTransformedRectBounds( aSpriteRectPixel, + ::basegfx::B2DRectangle aSpriteRectPixel = ::canvas::tools::calcTransformedRectBounds( aBounds, maTransform ); @@ -413,8 +412,7 @@ namespace canvas // transform bounds at origin, as the sprite transformation is // formulated that way - ::basegfx::B2DRectangle aTransformedBounds; - return ::canvas::tools::calcTransformedRectBounds( aTransformedBounds, + return ::canvas::tools::calcTransformedRectBounds( rBounds, aTransform ); } diff --git a/canvas/source/tools/canvastools.cxx b/canvas/source/tools/canvastools.cxx index 18d103cc1228..cf72e8fed401 100644 --- a/canvas/source/tools/canvastools.cxx +++ b/canvas/source/tools/canvastools.cxx @@ -821,9 +821,7 @@ namespace canvas::tools } // transform by given transformation - ::basegfx::B2DRectangle aTransformedRect; - - calcTransformedRectBounds( aTransformedRect, + ::basegfx::B2DRectangle aTransformedRect = calcTransformedRectBounds( i_srcRect, i_transformation ); @@ -837,11 +835,10 @@ namespace canvas::tools return o_transform; } - ::basegfx::B2DRange& calcTransformedRectBounds( ::basegfx::B2DRange& outRect, - const ::basegfx::B2DRange& inRect, + ::basegfx::B2DRange calcTransformedRectBounds( const ::basegfx::B2DRange& inRect, const ::basegfx::B2DHomMatrix& transformation ) { - outRect.reset(); + ::basegfx::B2DRange outRect; if( inRect.isEmpty() ) return outRect; diff --git a/canvas/source/vcl/canvashelper.cxx b/canvas/source/vcl/canvashelper.cxx index f398f6734f1a..a35a93bc1dba 100644 --- a/canvas/source/vcl/canvashelper.cxx +++ b/canvas/source/vcl/canvashelper.cxx @@ -795,8 +795,7 @@ namespace vclcanvas // modify output position, to account for the fact // that transformBitmap() always normalizes its output // bitmap into the smallest enclosing box. - ::basegfx::B2DRectangle aDestRect; - ::canvas::tools::calcTransformedRectBounds( aDestRect, + ::basegfx::B2DRectangle aDestRect = ::canvas::tools::calcTransformedRectBounds( ::basegfx::B2DRectangle(0, 0, aBmpSize.Width(), diff --git a/canvas/source/vcl/canvashelper_texturefill.cxx b/canvas/source/vcl/canvashelper_texturefill.cxx index f9501cf8d426..2a1ec6b88c9a 100644 --- a/canvas/source/vcl/canvashelper_texturefill.cxx +++ b/canvas/source/vcl/canvashelper_texturefill.cxx @@ -574,9 +574,8 @@ namespace vclcanvas // extra-verbosity { ::basegfx::B2DRectangle aRect(0.0, 0.0, 1.0, 1.0); - ::basegfx::B2DRectangle aTextureDeviceRect; ::basegfx::B2DHomMatrix aTextureTransform; - ::canvas::tools::calcTransformedRectBounds( aTextureDeviceRect, + ::basegfx::B2DRectangle aTextureDeviceRect = ::canvas::tools::calcTransformedRectBounds( aRect, aTextureTransform ); rOutDev.SetLineColor( COL_RED ); @@ -699,8 +698,7 @@ namespace vclcanvas aTotalTransform *= aTextureTransform; const ::basegfx::B2DRectangle aRect(0.0, 0.0, 1.0, 1.0); - ::basegfx::B2DRectangle aTextureDeviceRect; - ::canvas::tools::calcTransformedRectBounds( aTextureDeviceRect, + ::basegfx::B2DRectangle aTextureDeviceRect = ::canvas::tools::calcTransformedRectBounds( aRect, aTotalTransform ); @@ -806,8 +804,7 @@ namespace vclcanvas // modify output position, to account for the fact // that transformBitmap() always normalizes its output // bitmap into the smallest enclosing box. - ::basegfx::B2DRectangle aDestRect; - ::canvas::tools::calcTransformedRectBounds( aDestRect, + ::basegfx::B2DRectangle aDestRect = ::canvas::tools::calcTransformedRectBounds( ::basegfx::B2DRectangle(0, 0, aBmpSize.Width, @@ -867,8 +864,7 @@ namespace vclcanvas // Finally, the bound rect is transformed back to // device coordinate space, were we determine the // start point from it. - ::basegfx::B2DRectangle aTextureSpacePolygonRect; - ::canvas::tools::calcTransformedRectBounds( aTextureSpacePolygonRect, + ::basegfx::B2DRectangle aTextureSpacePolygonRect = ::canvas::tools::calcTransformedRectBounds( vcl::unotools::b2DRectangleFromRectangle(aPolygonDeviceRect), aInverseTextureTransform ); @@ -891,8 +887,7 @@ namespace vclcanvas nY1 + 1.0 ); // and convert back to device space - ::basegfx::B2DRectangle aSingleDeviceTextureRect; - ::canvas::tools::calcTransformedRectBounds( aSingleDeviceTextureRect, + ::basegfx::B2DRectangle aSingleDeviceTextureRect = ::canvas::tools::calcTransformedRectBounds( aSingleTextureRect, aPureTotalTransform ); diff --git a/canvas/source/vcl/impltools.cxx b/canvas/source/vcl/impltools.cxx index 854e8c1618e3..7b431bdf7258 100644 --- a/canvas/source/vcl/impltools.cxx +++ b/canvas/source/vcl/impltools.cxx @@ -223,13 +223,12 @@ namespace vclcanvas::tools // deleted from the transformation; this can be handled by // an offset when painting the bitmap const Size aBmpSize( rBitmap.GetSizePixel() ); - ::basegfx::B2DRectangle aDestRect; // calc effective transformation for bitmap const ::basegfx::B2DRectangle aSrcRect( 0, 0, aBmpSize.Width(), aBmpSize.Height() ); - ::canvas::tools::calcTransformedRectBounds( aDestRect, + ::basegfx::B2DRectangle aDestRect = ::canvas::tools::calcTransformedRectBounds( aSrcRect, rTransform ); |