canvas: simplify calcRectToOriginTransform

Change-Id: I851d9d11c9d3f3c34353913a146ad168a98dc3d5
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/176771
Reviewed-by: Xisco Fauli <xiscofauli@libreoffice.org>
Tested-by: Jenkins
This commit is contained in:
Xisco Fauli 2024-11-19 14:37:36 +01:00
parent e289fdedeb
commit b20156432f
3 changed files with 6 additions and 11 deletions

View file

@ -810,10 +810,10 @@ namespace canvas::tools
// rSpriteSize is mapped with its left,top corner to (0,0) // rSpriteSize is mapped with its left,top corner to (0,0)
// again. This is required to properly render sprite // again. This is required to properly render sprite
// animations to buffer bitmaps. // animations to buffer bitmaps.
::basegfx::B2DHomMatrix& calcRectToOriginTransform( ::basegfx::B2DHomMatrix& o_transform, ::basegfx::B2DHomMatrix calcRectToOriginTransform( const ::basegfx::B2DRange& i_srcRect,
const ::basegfx::B2DRange& i_srcRect,
const ::basegfx::B2DHomMatrix& i_transformation ) const ::basegfx::B2DHomMatrix& i_transformation )
{ {
::basegfx::B2DHomMatrix o_transform;
if( i_srcRect.isEmpty() ) if( i_srcRect.isEmpty() )
{ {
o_transform = i_transformation; o_transform = i_transformation;

View file

@ -237,8 +237,7 @@ namespace vclcanvas::tools
// aligned with (0,0). The method takes the given // aligned with (0,0). The method takes the given
// rectangle, and calculates a transformation that maps // rectangle, and calculates a transformation that maps
// this rectangle unscaled to the origin. // this rectangle unscaled to the origin.
::basegfx::B2DHomMatrix aLocalTransform; ::basegfx::B2DHomMatrix aLocalTransform = ::canvas::tools::calcRectToOriginTransform(
::canvas::tools::calcRectToOriginTransform( aLocalTransform,
aSrcRect, aSrcRect,
rTransform ); rTransform );

View file

@ -199,10 +199,6 @@ namespace canvas
the upper, left corner to the origin, and leaving the size the upper, left corner to the origin, and leaving the size
untouched. untouched.
@param o_transform
Output parameter, to receive the resulting transformation
matrix.
@param i_srcRect @param i_srcRect
Input parameter, specifies the original source Input parameter, specifies the original source
rectangle. The resulting transformation will exactly map rectangle. The resulting transformation will exactly map
@ -213,12 +209,12 @@ namespace canvas
translations (if necessary), to exactly map the source translations (if necessary), to exactly map the source
rectangle to the origin. rectangle to the origin.
@return a reference to the resulting transformation matrix @return the resulting transformation matrix
@see calcRectToRectTransform() @see calcRectToRectTransform()
@see calcTransformedRectBounds() @see calcTransformedRectBounds()
*/ */
CANVASTOOLS_DLLPUBLIC ::basegfx::B2DHomMatrix& calcRectToOriginTransform( ::basegfx::B2DHomMatrix& o_transform, CANVASTOOLS_DLLPUBLIC ::basegfx::B2DHomMatrix calcRectToOriginTransform(
const ::basegfx::B2DRange& i_srcRect, const ::basegfx::B2DRange& i_srcRect,
const ::basegfx::B2DHomMatrix& i_transformation ); const ::basegfx::B2DHomMatrix& i_transformation );