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>
This commit is contained in:
parent
b20156432f
commit
d991795635
14 changed files with 27 additions and 62 deletions
|
@ -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 );
|
||||
}
|
||||
|
|
|
@ -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;
|
||||
|
|
|
@ -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(),
|
||||
|
|
|
@ -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 );
|
||||
|
||||
|
|
|
@ -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 );
|
||||
|
||||
|
|
|
@ -634,9 +634,7 @@ namespace cppcanvas::tools
|
|||
viewState,
|
||||
renderState );
|
||||
|
||||
::basegfx::B2DRange aTransformedBounds;
|
||||
return ::canvas::tools::calcTransformedRectBounds( aTransformedBounds,
|
||||
rBounds,
|
||||
return ::canvas::tools::calcTransformedRectBounds(rBounds,
|
||||
aTransform );
|
||||
}
|
||||
|
||||
|
|
|
@ -176,18 +176,15 @@ namespace canvas
|
|||
specified input rectangle, and returns the bounding box of
|
||||
the resulting output area.
|
||||
|
||||
@param o_Rect
|
||||
Output rectangle
|
||||
|
||||
@param i_Rect
|
||||
Input rectangle
|
||||
|
||||
@param i_Transformation
|
||||
Transformation to apply to the input rectangle
|
||||
|
||||
@return a reference to the resulting rectangle
|
||||
@return the resulting rectangle
|
||||
*/
|
||||
CANVASTOOLS_DLLPUBLIC ::basegfx::B2DRange& calcTransformedRectBounds( ::basegfx::B2DRange& o_Rect,
|
||||
CANVASTOOLS_DLLPUBLIC ::basegfx::B2DRange calcTransformedRectBounds(
|
||||
const ::basegfx::B2DRange& i_Rect,
|
||||
const ::basegfx::B2DHomMatrix& i_Transformation );
|
||||
|
||||
|
|
|
@ -164,8 +164,7 @@ namespace slideshow::internal
|
|||
// resize surrounding window and applet to current shape size
|
||||
// ==========================================================
|
||||
|
||||
::basegfx::B2DRange aTmpRange;
|
||||
::canvas::tools::calcTransformedRectBounds( aTmpRange,
|
||||
::basegfx::B2DRange aTmpRange = ::canvas::tools::calcTransformedRectBounds(
|
||||
rBounds,
|
||||
mpViewLayer->getTransformation() );
|
||||
const ::basegfx::B2IRange aPixelBounds(
|
||||
|
@ -230,8 +229,7 @@ namespace slideshow::internal
|
|||
if( !mxFrame.is() )
|
||||
return false;
|
||||
|
||||
::basegfx::B2DRange aTmpRange;
|
||||
::canvas::tools::calcTransformedRectBounds( aTmpRange,
|
||||
::basegfx::B2DRange aTmpRange = ::canvas::tools::calcTransformedRectBounds(
|
||||
rBounds,
|
||||
mpViewLayer->getTransformation() );
|
||||
const ::basegfx::B2IRange aPixelBounds(
|
||||
|
|
|
@ -61,8 +61,7 @@ namespace slideshow::internal
|
|||
// buffered bitmap is invalid, re-create
|
||||
|
||||
// determine transformed page bounds
|
||||
::basegfx::B2DRectangle aTmpRect;
|
||||
::canvas::tools::calcTransformedRectBounds( aTmpRect,
|
||||
::basegfx::B2DRectangle aTmpRect = ::canvas::tools::calcTransformedRectBounds(
|
||||
maBounds,
|
||||
aCanvasTransform );
|
||||
|
||||
|
|
|
@ -228,8 +228,7 @@ namespace slideshow::internal
|
|||
maWindowOffset.Y = aRect.Y;
|
||||
}
|
||||
|
||||
::basegfx::B2DRange aTmpRange;
|
||||
::canvas::tools::calcTransformedRectBounds( aTmpRange,
|
||||
::basegfx::B2DRange aTmpRange = ::canvas::tools::calcTransformedRectBounds(
|
||||
rNewBounds,
|
||||
mpViewLayer->getTransformation() );
|
||||
const ::basegfx::B2IRange aRangePix(
|
||||
|
@ -422,9 +421,7 @@ namespace slideshow::internal
|
|||
|
||||
if( pWindow )
|
||||
{
|
||||
::basegfx::B2DRange aTmpRange;
|
||||
::canvas::tools::calcTransformedRectBounds( aTmpRange,
|
||||
rBounds,
|
||||
::basegfx::B2DRange aTmpRange = ::canvas::tools::calcTransformedRectBounds( rBounds,
|
||||
mpViewLayer->getTransformation() );
|
||||
const ::basegfx::B2IRange aRangePix(
|
||||
::basegfx::unotools::b2ISurroundingRangeFromB2DRange( aTmpRange ));
|
||||
|
|
|
@ -248,8 +248,7 @@ namespace slideshow::internal
|
|||
// transformation might result in smaller
|
||||
// overall bounds.
|
||||
|
||||
::basegfx::B2DRectangle aBoundsPixel;
|
||||
::canvas::tools::calcTransformedRectBounds( aBoundsPixel,
|
||||
::basegfx::B2DRectangle aBoundsPixel = ::canvas::tools::calcTransformedRectBounds(
|
||||
rUntransformedArea,
|
||||
rCanvasTransformation );
|
||||
|
||||
|
@ -339,11 +338,9 @@ namespace slideshow::internal
|
|||
// char scaling). NOTE: to cancel the shape translation,
|
||||
// contained in rSpriteBoundsPixel, this is _without_ any
|
||||
// translational component.
|
||||
::basegfx::B2DRectangle aLogShapeBounds;
|
||||
const ::basegfx::B2DRectangle aNominalShapeBoundsPixel(
|
||||
shapeArea2AreaPixel( aCanvasTransform,
|
||||
::canvas::tools::calcTransformedRectBounds(
|
||||
aLogShapeBounds,
|
||||
::basegfx::B2DRectangle(0.0,0.0,1.0,1.0),
|
||||
aNonTranslationalShapeTransformation ) ) );
|
||||
|
||||
|
@ -582,8 +579,7 @@ namespace slideshow::internal
|
|||
// area_ in device pixel
|
||||
const ::basegfx::B2DHomMatrix aCanvasTransform(
|
||||
rDestinationCanvas->getTransformation() );
|
||||
::basegfx::B2DRectangle aTmpRect;
|
||||
::canvas::tools::calcTransformedRectBounds( aTmpRect,
|
||||
::basegfx::B2DRectangle aTmpRect = ::canvas::tools::calcTransformedRectBounds(
|
||||
rUpdateBounds,
|
||||
aCanvasTransform );
|
||||
|
||||
|
|
|
@ -72,8 +72,7 @@ basegfx::B2IVector getSlideSizePixel(const basegfx::B2DVector& rSlideSize,
|
|||
{
|
||||
const basegfx::B2DRange aRect(0, 0, rSlideSize.getX(), rSlideSize.getY());
|
||||
|
||||
basegfx::B2DRange aTmpRect;
|
||||
canvas::tools::calcTransformedRectBounds(aTmpRect, aRect, rTransformation);
|
||||
basegfx::B2DRange aTmpRect = canvas::tools::calcTransformedRectBounds(aRect, rTransformation);
|
||||
|
||||
// #i42440# Returned slide size is one pixel too small, as
|
||||
// rendering happens one pixel to the right and below the
|
||||
|
|
|
@ -213,8 +213,7 @@ void clearRect( ::cppcanvas::CanvasSharedPtr const& pCanvas,
|
|||
basegfx::B2IRange getLayerBoundsPixel( basegfx::B2DRange const& rLayerBounds,
|
||||
basegfx::B2DHomMatrix const& rTransformation )
|
||||
{
|
||||
::basegfx::B2DRange aTmpRect;
|
||||
::canvas::tools::calcTransformedRectBounds( aTmpRect,
|
||||
::basegfx::B2DRange aTmpRect = ::canvas::tools::calcTransformedRectBounds(
|
||||
rLayerBounds,
|
||||
rTransformation );
|
||||
|
||||
|
@ -464,8 +463,7 @@ public:
|
|||
|
||||
virtual css::geometry::IntegerSize2D getTranslationOffset() const override
|
||||
{
|
||||
basegfx::B2DRectangle aTmpRect;
|
||||
canvas::tools::calcTransformedRectBounds( aTmpRect,
|
||||
basegfx::B2DRectangle aTmpRect = canvas::tools::calcTransformedRectBounds(
|
||||
maLayerBounds,
|
||||
maTransformation );
|
||||
geometry::IntegerSize2D offset(0, 0);
|
||||
|
@ -514,8 +512,7 @@ private:
|
|||
{
|
||||
// Offset given transformation by left, top border of given
|
||||
// range (after transformation through given transformation)
|
||||
basegfx::B2DRectangle aTmpRect;
|
||||
canvas::tools::calcTransformedRectBounds( aTmpRect,
|
||||
basegfx::B2DRectangle aTmpRect = canvas::tools::calcTransformedRectBounds(
|
||||
maLayerBounds,
|
||||
maTransformation );
|
||||
|
||||
|
|
|
@ -561,11 +561,8 @@ namespace slideshow::internal
|
|||
|
||||
aTransform *= rShapeTransform;
|
||||
|
||||
::basegfx::B2DRectangle aRes;
|
||||
|
||||
// apply shape transformation to unit rect
|
||||
return ::canvas::tools::calcTransformedRectBounds(
|
||||
aRes,
|
||||
rUnitBounds,
|
||||
aTransform );
|
||||
}
|
||||
|
@ -764,8 +761,7 @@ namespace slideshow::internal
|
|||
const basegfx::B2DRange aRect( 0,0,
|
||||
rSlideSize.getX(),
|
||||
rSlideSize.getY() );
|
||||
basegfx::B2DRange aTmpRect;
|
||||
canvas::tools::calcTransformedRectBounds( aTmpRect,
|
||||
basegfx::B2DRange aTmpRect = canvas::tools::calcTransformedRectBounds(
|
||||
aRect,
|
||||
pView->getTransformation() );
|
||||
|
||||
|
|
Loading…
Reference in a new issue