From b20156432fcb2dadabff2decaa04537a7eebc042 Mon Sep 17 00:00:00 2001 From: Xisco Fauli Date: Tue, 19 Nov 2024 14:37:36 +0100 Subject: canvas: simplify calcRectToOriginTransform Change-Id: I851d9d11c9d3f3c34353913a146ad168a98dc3d5 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/176771 Reviewed-by: Xisco Fauli Tested-by: Jenkins --- canvas/source/tools/canvastools.cxx | 6 +++--- canvas/source/vcl/impltools.cxx | 3 +-- include/canvas/canvastools.hxx | 8 ++------ 3 files changed, 6 insertions(+), 11 deletions(-) diff --git a/canvas/source/tools/canvastools.cxx b/canvas/source/tools/canvastools.cxx index 4b227c0b1c0d..18d103cc1228 100644 --- a/canvas/source/tools/canvastools.cxx +++ b/canvas/source/tools/canvastools.cxx @@ -810,10 +810,10 @@ namespace canvas::tools // rSpriteSize is mapped with its left,top corner to (0,0) // again. This is required to properly render sprite // animations to buffer bitmaps. - ::basegfx::B2DHomMatrix& calcRectToOriginTransform( ::basegfx::B2DHomMatrix& o_transform, - const ::basegfx::B2DRange& i_srcRect, - const ::basegfx::B2DHomMatrix& i_transformation ) + ::basegfx::B2DHomMatrix calcRectToOriginTransform( const ::basegfx::B2DRange& i_srcRect, + const ::basegfx::B2DHomMatrix& i_transformation ) { + ::basegfx::B2DHomMatrix o_transform; if( i_srcRect.isEmpty() ) { o_transform = i_transformation; diff --git a/canvas/source/vcl/impltools.cxx b/canvas/source/vcl/impltools.cxx index cafc59a9b83f..854e8c1618e3 100644 --- a/canvas/source/vcl/impltools.cxx +++ b/canvas/source/vcl/impltools.cxx @@ -237,8 +237,7 @@ namespace vclcanvas::tools // aligned with (0,0). The method takes the given // rectangle, and calculates a transformation that maps // this rectangle unscaled to the origin. - ::basegfx::B2DHomMatrix aLocalTransform; - ::canvas::tools::calcRectToOriginTransform( aLocalTransform, + ::basegfx::B2DHomMatrix aLocalTransform = ::canvas::tools::calcRectToOriginTransform( aSrcRect, rTransform ); diff --git a/include/canvas/canvastools.hxx b/include/canvas/canvastools.hxx index be6f55aafebb..c82f0541a6db 100644 --- a/include/canvas/canvastools.hxx +++ b/include/canvas/canvastools.hxx @@ -199,10 +199,6 @@ namespace canvas the upper, left corner to the origin, and leaving the size untouched. - @param o_transform - Output parameter, to receive the resulting transformation - matrix. - @param i_srcRect Input parameter, specifies the original source rectangle. The resulting transformation will exactly map @@ -213,12 +209,12 @@ namespace canvas translations (if necessary), to exactly map the source rectangle to the origin. - @return a reference to the resulting transformation matrix + @return the resulting transformation matrix @see calcRectToRectTransform() @see calcTransformedRectBounds() */ - CANVASTOOLS_DLLPUBLIC ::basegfx::B2DHomMatrix& calcRectToOriginTransform( ::basegfx::B2DHomMatrix& o_transform, + CANVASTOOLS_DLLPUBLIC ::basegfx::B2DHomMatrix calcRectToOriginTransform( const ::basegfx::B2DRange& i_srcRect, const ::basegfx::B2DHomMatrix& i_transformation ); -- cgit v1.2.3