summaryrefslogtreecommitdiff
path: root/cppcanvas
diff options
context:
space:
mode:
authorTomaž Vajngerl <tomaz.vajngerl@collabora.co.uk>2022-09-08 11:12:27 +0200
committerTomaž Vajngerl <quikee@gmail.com>2022-09-11 17:16:59 +0200
commitc747486335c089baf440b8f040d3ffdc14aa5049 (patch)
tree0d173f69ac82099cfb8bde3ac2831a682665391d /cppcanvas
parent5f5f2f8107b6176654bfb9a30c21b7d5e0c62c6f (diff)
basegfx: replace typedef with a class B2DSize based on Size2D
Change-Id: Id8b3c2bcf0bf4be5aba2812b0edda479bc20c6a9 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/139683 Tested-by: Jenkins Reviewed-by: Tomaž Vajngerl <quikee@gmail.com>
Diffstat (limited to 'cppcanvas')
-rw-r--r--cppcanvas/source/mtfrenderer/implrenderer.cxx24
-rw-r--r--cppcanvas/source/mtfrenderer/textaction.cxx48
-rw-r--r--cppcanvas/source/mtfrenderer/textlineshelper.cxx2
-rw-r--r--cppcanvas/source/mtfrenderer/transparencygroupaction.cxx14
4 files changed, 43 insertions, 45 deletions
diff --git a/cppcanvas/source/mtfrenderer/implrenderer.cxx b/cppcanvas/source/mtfrenderer/implrenderer.cxx
index e4da6ee67513..3046d880125e 100644
--- a/cppcanvas/source/mtfrenderer/implrenderer.cxx
+++ b/cppcanvas/source/mtfrenderer/implrenderer.cxx
@@ -825,7 +825,7 @@ namespace cppcanvas::internal
else
aFontMatrix.m11 *= nScaleY / nScaleX;
}
- aFontRequest.CellSize = (rState.mapModeTransform * vcl::unotools::b2DSizeFromSize(rFontSizeLog)).getY();
+ aFontRequest.CellSize = (rState.mapModeTransform * vcl::unotools::b2DSizeFromSize(rFontSizeLog)).getHeight();
if (rFont.GetEmphasisMark() != FontEmphasisMark::NONE)
{
@@ -2137,10 +2137,8 @@ namespace cppcanvas::internal
std::shared_ptr<Action> pBmpAction(
internal::BitmapActionFactory::createBitmapAction(
BitmapEx(pAct->GetBitmap()),
- rStates.getState().mapModeTransform *
- vcl::unotools::b2DPointFromPoint( pAct->GetPoint() ),
- rStates.getState().mapModeTransform *
- vcl::unotools::b2DSizeFromSize( pAct->GetSize() ),
+ rStates.getState().mapModeTransform * vcl::unotools::b2DPointFromPoint( pAct->GetPoint() ),
+ rStates.getState().mapModeTransform * vcl::unotools::b2DVectorFromSize( pAct->GetSize() ),
rCanvas,
rStates.getState() ) );
@@ -2172,7 +2170,7 @@ namespace cppcanvas::internal
rStates.getState().mapModeTransform *
vcl::unotools::b2DPointFromPoint( pAct->GetDestPoint() ),
rStates.getState().mapModeTransform *
- vcl::unotools::b2DSizeFromSize( pAct->GetDestSize() ),
+ vcl::unotools::b2DVectorFromSize( pAct->GetDestSize() ),
rCanvas,
rStates.getState() ) );
@@ -2220,7 +2218,7 @@ namespace cppcanvas::internal
rStates.getState().mapModeTransform *
vcl::unotools::b2DPointFromPoint( pAct->GetPoint() ),
rStates.getState().mapModeTransform *
- vcl::unotools::b2DSizeFromSize( pAct->GetSize() ),
+ vcl::unotools::b2DVectorFromSize( pAct->GetSize() ),
rCanvas,
rStates.getState() ) );
@@ -2252,7 +2250,7 @@ namespace cppcanvas::internal
rStates.getState().mapModeTransform *
vcl::unotools::b2DPointFromPoint( pAct->GetDestPoint() ),
rStates.getState().mapModeTransform *
- vcl::unotools::b2DSizeFromSize( pAct->GetDestSize() ),
+ vcl::unotools::b2DVectorFromSize( pAct->GetDestSize() ),
rCanvas,
rStates.getState() ) );
@@ -2312,7 +2310,7 @@ namespace cppcanvas::internal
rStates.getState().mapModeTransform *
vcl::unotools::b2DPointFromPoint( pAct->GetPoint() ),
rStates.getState().mapModeTransform *
- vcl::unotools::b2DSizeFromSize( pAct->GetSize() ),
+ vcl::unotools::b2DVectorFromSize( pAct->GetSize() ),
rCanvas,
rStates.getState() ) );
@@ -2349,7 +2347,7 @@ namespace cppcanvas::internal
rStates.getState().mapModeTransform *
vcl::unotools::b2DPointFromPoint( pAct->GetDestPoint() ),
rStates.getState().mapModeTransform *
- vcl::unotools::b2DSizeFromSize( pAct->GetDestSize() ),
+ vcl::unotools::b2DVectorFromSize( pAct->GetDestSize() ),
rCanvas,
rStates.getState() ) );
@@ -2422,7 +2420,7 @@ namespace cppcanvas::internal
rStates.getState().mapModeTransform *
vcl::unotools::b2DPointFromPoint( pAct->GetPoint() ),
rStates.getState().mapModeTransform *
- vcl::unotools::b2DSizeFromSize( pAct->GetSize() ),
+ vcl::unotools::b2DVectorFromSize( pAct->GetSize() ),
rCanvas,
rStates.getState() ) );
@@ -2496,8 +2494,8 @@ namespace cppcanvas::internal
rState.mapModeTransform *
::basegfx::B2DPoint(
vcl::unotools::b2DPointFromPoint(pAct->GetStartPoint()) +
- vcl::unotools::b2DSizeFromSize(aBaselineOffset)),
- aSize.getX(),
+ vcl::unotools::b2DVectorFromSize(aBaselineOffset)),
+ aSize.getWidth(),
tools::createTextLineInfo( rVDev,
rState )),
rCanvas,
diff --git a/cppcanvas/source/mtfrenderer/textaction.cxx b/cppcanvas/source/mtfrenderer/textaction.cxx
index 6d0e982248e2..f7844c802452 100644
--- a/cppcanvas/source/mtfrenderer/textaction.cxx
+++ b/cppcanvas/source/mtfrenderer/textaction.cxx
@@ -269,7 +269,7 @@ namespace cppcanvas::internal
static_cast<sal_uInt16>(rStringContext.Length) ),
0 );
- return (rState.mapModeTransform * aSize).getX();
+ return (rState.mapModeTransform * aSize).getWidth();
}
uno::Sequence< double >
@@ -504,8 +504,8 @@ namespace cppcanvas::internal
rendering::RenderState aShadowState( rRenderState );
::basegfx::B2DHomMatrix aTranslate;
- aTranslate.translate( rShadowOffset.getX(),
- rShadowOffset.getY() );
+ aTranslate.translate(rShadowOffset.getWidth(),
+ rShadowOffset.getHeight());
::canvas::tools::appendToRenderState(aShadowState, aTranslate);
@@ -522,8 +522,8 @@ namespace cppcanvas::internal
rendering::RenderState aReliefState( rRenderState );
::basegfx::B2DHomMatrix aTranslate;
- aTranslate.translate( rReliefOffset.getX(),
- rReliefOffset.getY() );
+ aTranslate.translate(rReliefOffset.getWidth(),
+ rReliefOffset.getHeight());
::canvas::tools::appendToRenderState(aReliefState, aTranslate);
@@ -556,15 +556,15 @@ namespace cppcanvas::internal
// TODO(Q3): Provide this functionality at the B2DRange
::basegfx::B2DRange aTotalBounds( aBounds );
aTotalBounds.expand(
- ::basegfx::B2DRange( aBounds.getMinX() + rReliefOffset.getX(),
- aBounds.getMinY() + rReliefOffset.getY(),
- aBounds.getMaxX() + rReliefOffset.getX(),
- aBounds.getMaxY() + rReliefOffset.getY() ) );
+ ::basegfx::B2DRange( aBounds.getMinX() + rReliefOffset.getWidth(),
+ aBounds.getMinY() + rReliefOffset.getHeight(),
+ aBounds.getMaxX() + rReliefOffset.getWidth(),
+ aBounds.getMaxY() + rReliefOffset.getHeight() ) );
aTotalBounds.expand(
- ::basegfx::B2DRange( aBounds.getMinX() + rShadowOffset.getX(),
- aBounds.getMinY() + rShadowOffset.getY(),
- aBounds.getMaxX() + rShadowOffset.getX(),
- aBounds.getMaxY() + rShadowOffset.getY() ) );
+ ::basegfx::B2DRange( aBounds.getMinX() + rShadowOffset.getWidth(),
+ aBounds.getMinY() + rShadowOffset.getHeight(),
+ aBounds.getMaxX() + rShadowOffset.getWidth(),
+ aBounds.getMaxY() + rShadowOffset.getHeight() ) );
return tools::calcDevicePixelBounds( aTotalBounds,
rViewState,
@@ -580,8 +580,8 @@ namespace cppcanvas::internal
const ::basegfx::B2DPolyPolygon aPoly(
tools::createTextLinesPolyPolygon( 0.0, nLineWidth,
rLineInfo ) );
-
- o_rOverallSize = ::basegfx::utils::getRange( aPoly ).getRange();
+ auto aRange = basegfx::utils::getRange( aPoly ).getRange();
+ o_rOverallSize = basegfx::B2DSize(aRange.getX(), aRange.getY());
o_rTextLines = ::basegfx::unotools::xPolyPolygonFromB2DPolyPolygon(
rCanvas->getUNOCanvas()->getDevice(),
@@ -980,8 +980,8 @@ namespace cppcanvas::internal
return calcEffectTextBounds( ::basegfx::unotools::b2DRectangleFromRealRectangle2D(
queryTextBounds() ),
::basegfx::B2DRange( 0,0,
- maLinesOverallSize.getX(),
- maLinesOverallSize.getY() ),
+ maLinesOverallSize.getWidth(),
+ maLinesOverallSize.getHeight() ),
maReliefOffset,
maShadowOffset,
aLocalState,
@@ -1506,9 +1506,9 @@ namespace cppcanvas::internal
return calcEffectTextBounds( ::basegfx::unotools::b2DRectangleFromRealRectangle2D(
mxTextLayout->queryTextBounds() ),
- ::basegfx::B2DRange( 0,0,
- aSize.getX(),
- aSize.getY() ),
+ basegfx::B2DRange(0, 0,
+ aSize.getWidth(),
+ aSize.getHeight()),
maReliefOffset,
maShadowOffset,
aLocalState,
@@ -1643,7 +1643,7 @@ namespace cppcanvas::internal
rVDev.GetFont().GetFontHeight() / 64.0 );
const double nOutlineWidth(
- (rState.mapModeTransform * aFontSize).getY() );
+ (rState.mapModeTransform * aFontSize).getHeight() );
return nOutlineWidth < 1.0 ? 1.0 : nOutlineWidth;
}
@@ -1926,9 +1926,9 @@ namespace cppcanvas::internal
::canvas::tools::prependToRenderState(aLocalState, rTransformation);
return calcEffectTextBounds( maOutlineBounds,
- ::basegfx::B2DRange( 0,0,
- maLinesOverallSize.getX(),
- maLinesOverallSize.getY() ),
+ ::basegfx::B2DRange(0, 0,
+ maLinesOverallSize.getWidth(),
+ maLinesOverallSize.getHeight()),
maReliefOffset,
maShadowOffset,
aLocalState,
diff --git a/cppcanvas/source/mtfrenderer/textlineshelper.cxx b/cppcanvas/source/mtfrenderer/textlineshelper.cxx
index 1120f12273be..125c3385afec 100644
--- a/cppcanvas/source/mtfrenderer/textlineshelper.cxx
+++ b/cppcanvas/source/mtfrenderer/textlineshelper.cxx
@@ -75,7 +75,7 @@ void TextLinesHelper::init(double nLineWidth, const tools::TextLineInfo& rLineIn
mxStrikeout = ::basegfx::unotools::xPolyPolygonFromB2DPolyPolygon(xDevice, aStrikeout);
}
- maOverallSize = aRange.getRange();
+ maOverallSize = basegfx::B2DSize(aRange.getRange().getX(), aRange.getRange().getY());
initLineStyleWaveline(rLineInfo.mnOverlineStyle, mbOverlineWaveline, mbOverlineWavelineBold);
diff --git a/cppcanvas/source/mtfrenderer/transparencygroupaction.cxx b/cppcanvas/source/mtfrenderer/transparencygroupaction.cxx
index e0562361e3ce..248a87e77b3e 100644
--- a/cppcanvas/source/mtfrenderer/transparencygroupaction.cxx
+++ b/cppcanvas/source/mtfrenderer/transparencygroupaction.cxx
@@ -143,7 +143,7 @@ namespace cppcanvas::internal
const OutDevState& rState ) :
mpGroupMtf( std::move(rGroupMtf) ),
mpAlphaGradient( std::move(rAlphaGradient) ),
- maDstSize( rDstSize ),
+ maDstSize(rDstSize.getX(), rDstSize.getY()),
mpCanvas( rCanvas )
{
tools::initRenderState(maState,rState);
@@ -216,12 +216,12 @@ namespace cppcanvas::internal
DBG_TESTSOLARMUTEX();
// output size of metafile
- ::Size aOutputSizePixel( ::basegfx::fround( aScale.getX() * maDstSize.getX() ),
- ::basegfx::fround( aScale.getY() * maDstSize.getY() ) );
+ ::Size aOutputSizePixel( ::basegfx::fround( aScale.getX() * maDstSize.getWidth() ),
+ ::basegfx::fround( aScale.getY() * maDstSize.getHeight() ) );
// pixel size of cache bitmap: round up to nearest int
- ::Size aBitmapSizePixel( static_cast<sal_Int32>( aScale.getX() * maDstSize.getX() )+1,
- static_cast<sal_Int32>( aScale.getY() * maDstSize.getY() )+1 );
+ ::Size aBitmapSizePixel( static_cast<sal_Int32>( aScale.getX() * maDstSize.getWidth() )+1,
+ static_cast<sal_Int32>( aScale.getY() * maDstSize.getHeight() )+1 );
::Point aEmptyPoint;
@@ -423,8 +423,8 @@ namespace cppcanvas::internal
return tools::calcDevicePixelBounds(
::basegfx::B2DRange( 0,0,
- maDstSize.getX(),
- maDstSize.getY() ),
+ maDstSize.getWidth(),
+ maDstSize.getHeight() ),
mpCanvas->getViewState(),
aLocalState );
}