diff options
49 files changed, 387 insertions, 194 deletions
diff --git a/basegfx/CppunitTest_basegfx.mk b/basegfx/CppunitTest_basegfx.mk index 88f4966262f2..219025e8e3e6 100644 --- a/basegfx/CppunitTest_basegfx.mk +++ b/basegfx/CppunitTest_basegfx.mk @@ -31,6 +31,7 @@ $(eval $(call gb_CppunitTest_add_exception_objects,basegfx,\ basegfx/test/B2DPolygonToolsTest \ basegfx/test/B2DPolyPolygonTest \ basegfx/test/B2DPolyPolygonCutterTest \ + basegfx/test/B2DSizeTest \ basegfx/test/B1DRangeTest \ basegfx/test/B2XRangeTest \ basegfx/test/B2IBoxTest \ diff --git a/basegfx/source/tools/canvastools.cxx b/basegfx/source/tools/canvastools.cxx index 11ebe70dec28..d388356199a2 100644 --- a/basegfx/source/tools/canvastools.cxx +++ b/basegfx/source/tools/canvastools.cxx @@ -34,6 +34,7 @@ #include <basegfx/matrix/b2dhommatrix.hxx> #include <basegfx/matrix/b3dhommatrix.hxx> #include <basegfx/point/b2dpoint.hxx> +#include <basegfx/vector/b2dsize.hxx> #include <basegfx/range/b3drange.hxx> #include <basegfx/range/b2irange.hxx> #include <basegfx/polygon/b2dpolygon.hxx> @@ -373,10 +374,9 @@ namespace basegfx::unotools return output; } - geometry::RealSize2D size2DFromB2DSize( const ::basegfx::B2DVector& rVec ) + geometry::RealSize2D size2DFromB2DSize(const ::basegfx::B2DSize& rSize) { - return geometry::RealSize2D( rVec.getX(), - rVec.getY() ); + return geometry::RealSize2D(rSize.getWidth(), rSize.getHeight()); } geometry::RealPoint2D point2DFromB2DPoint( const ::basegfx::B2DPoint& rPoint ) diff --git a/basegfx/test/B2DPointTest.cxx b/basegfx/test/B2DPointTest.cxx index 29b73aebcc7e..97f350c7879f 100644 --- a/basegfx/test/B2DPointTest.cxx +++ b/basegfx/test/B2DPointTest.cxx @@ -20,6 +20,7 @@ #include <cppunit/TestFixture.h> #include <cppunit/extensions/HelperMacros.h> #include <basegfx/point/b2dpoint.hxx> +#include <basegfx/vector/b2dsize.hxx> #include <basegfx/matrix/b2dhommatrix.hxx> #include <cmath> #include <sstream> @@ -34,6 +35,7 @@ public: void testAssignment(); void testGetEmptyPoint(); void testOutputOperator(); + void testOperators(); CPPUNIT_TEST_SUITE(B2DPointTest); CPPUNIT_TEST(testCreation); @@ -43,6 +45,7 @@ public: CPPUNIT_TEST(testAssignment); CPPUNIT_TEST(testGetEmptyPoint); CPPUNIT_TEST(testOutputOperator); + CPPUNIT_TEST(testOperators); CPPUNIT_TEST_SUITE_END(); }; @@ -175,6 +178,17 @@ void B2DPointTest::testOutputOperator() CPPUNIT_ASSERT_EQUAL(std::string("(2,3)"), aResult); } +void B2DPointTest::testOperators() +{ + basegfx::B2DPoint aPoint(2.0, 3.0); + basegfx::B2DSize aSize(1.0, 1.0); + + CPPUNIT_ASSERT_EQUAL(true, basegfx::B2DPoint(3.0, 4.0) == aPoint + basegfx::B2DPoint(aSize)); + CPPUNIT_ASSERT_EQUAL(true, basegfx::B2DPoint(1.0, 2.0) == aPoint - basegfx::B2DPoint(aSize)); + CPPUNIT_ASSERT_EQUAL(true, basegfx::B2DPoint(2.0, 3.0) == aPoint * basegfx::B2DPoint(aSize)); + CPPUNIT_ASSERT_EQUAL(true, basegfx::B2DPoint(2.0, 3.0) == aPoint / basegfx::B2DPoint(aSize)); +} + CPPUNIT_TEST_SUITE_REGISTRATION(B2DPointTest); /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/basegfx/test/B2DSizeTest.cxx b/basegfx/test/B2DSizeTest.cxx new file mode 100644 index 000000000000..42d25c446d68 --- /dev/null +++ b/basegfx/test/B2DSizeTest.cxx @@ -0,0 +1,108 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/* + * This file is part of the LibreOffice project. + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. + * + * This file incorporates work covered by the following license notice: + * + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed + * with this work for additional information regarding copyright + * ownership. The ASF licenses this file to you under the Apache + * License, Version 2.0 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.apache.org/licenses/LICENSE-2.0 . + */ + +#include <cppunit/TestFixture.h> +#include <cppunit/extensions/HelperMacros.h> + +#include <basegfx/vector/b2dsize.hxx> + +namespace basegfx +{ +class B2DSizeTest : public CppUnit::TestFixture +{ +public: + void testOperatorAddition() + { + B2DSize aSize(4.0, 8.0); + aSize += { 2.0, 3.0 }; + + CPPUNIT_ASSERT_DOUBLES_EQUAL(6.0, aSize.getWidth(), 1e-2); + CPPUNIT_ASSERT_DOUBLES_EQUAL(11.0, aSize.getHeight(), 1e-2); + } + + void testOperatorSubstraction() + { + B2DSize aSize(4.0, 8.0); + aSize -= { 2.0, 3.0 }; + + CPPUNIT_ASSERT_DOUBLES_EQUAL(2.0, aSize.getWidth(), 1e-2); + CPPUNIT_ASSERT_DOUBLES_EQUAL(5.0, aSize.getHeight(), 1e-2); + } + + void testOperatorMultiply() + { + B2DSize aSize(4.0, 8.0); + aSize *= { 2.0, 3.0 }; + + CPPUNIT_ASSERT_DOUBLES_EQUAL(8.0, aSize.getWidth(), 1e-2); + CPPUNIT_ASSERT_DOUBLES_EQUAL(24.0, aSize.getHeight(), 1e-2); + + aSize *= 2.0; + + CPPUNIT_ASSERT_DOUBLES_EQUAL(16.0, aSize.getWidth(), 1e-2); + CPPUNIT_ASSERT_DOUBLES_EQUAL(48.0, aSize.getHeight(), 1e-2); + } + + void testOperatorDivide() + { + B2DSize aSize(4.0, 8.0); + aSize /= { 2.0, 8.0 }; + + CPPUNIT_ASSERT_DOUBLES_EQUAL(2.0, aSize.getWidth(), 1e-2); + CPPUNIT_ASSERT_DOUBLES_EQUAL(1.0, aSize.getHeight(), 1e-2); + } + + void testOperatorEqualUnequal() + { + B2DSize aSize(4.0, 8.0); + B2DSize aSize2 = aSize; + + CPPUNIT_ASSERT_EQUAL(true, aSize == aSize); + CPPUNIT_ASSERT_EQUAL(true, aSize == aSize2); + CPPUNIT_ASSERT_EQUAL(true, aSize == B2DSize(4.0, 8.0)); + CPPUNIT_ASSERT_EQUAL(false, aSize == B2DSize(4.0, 7.99)); + CPPUNIT_ASSERT_EQUAL(false, aSize == B2DSize(3.99, 8.0)); + } + + void testOperatorMinus() + { + B2DSize aSizeMinus = -B2DSize(4.0, 8.0); + CPPUNIT_ASSERT_DOUBLES_EQUAL(-4.0, aSizeMinus.getWidth(), 1e-2); + CPPUNIT_ASSERT_DOUBLES_EQUAL(-8.0, aSizeMinus.getHeight(), 1e-2); + + B2DSize aSizeZero = -B2DSize(0.0, 0.0); + CPPUNIT_ASSERT_DOUBLES_EQUAL(0.0, aSizeZero.getWidth(), 1e-2); + CPPUNIT_ASSERT_DOUBLES_EQUAL(0.0, aSizeZero.getHeight(), 1e-2); + } + + CPPUNIT_TEST_SUITE(B2DSizeTest); + CPPUNIT_TEST(testOperatorAddition); + CPPUNIT_TEST(testOperatorSubstraction); + CPPUNIT_TEST(testOperatorMultiply); + CPPUNIT_TEST(testOperatorDivide); + CPPUNIT_TEST(testOperatorEqualUnequal); + CPPUNIT_TEST(testOperatorMinus); + CPPUNIT_TEST_SUITE_END(); +}; + +} // namespace basegfx + +CPPUNIT_TEST_SUITE_REGISTRATION(basegfx::B2DSizeTest); + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/canvas/source/tools/canvascustomspritehelper.cxx b/canvas/source/tools/canvascustomspritehelper.cxx index 39c71b3a646d..975d62325d49 100644 --- a/canvas/source/tools/canvascustomspritehelper.cxx +++ b/canvas/source/tools/canvascustomspritehelper.cxx @@ -191,16 +191,14 @@ namespace canvas if( xBitmap->hasAlpha() ) return; - const geometry::IntegerSize2D& rInputSize( - xBitmap->getSize() ); - const ::basegfx::B2DSize& rOurSize( - rSprite->getSizePixel() ); + const geometry::IntegerSize2D& rInputSize(xBitmap->getSize()); + basegfx::B2DSize rOurSize(rSprite->getSizePixel().getX(), rSprite->getSizePixel().getY()); ::basegfx::B2DHomMatrix aTransform; if( tools::isInside( ::basegfx::B2DRectangle( 0.0,0.0, - rOurSize.getX(), - rOurSize.getY() ), + rOurSize.getWidth(), + rOurSize.getHeight() ), ::basegfx::B2DRectangle( 0.0,0.0, rInputSize.Width, rInputSize.Height ), diff --git a/canvas/source/vcl/spritecanvashelper.cxx b/canvas/source/vcl/spritecanvashelper.cxx index 94bb97a745e3..37f70a364267 100644 --- a/canvas/source/vcl/spritecanvashelper.cxx +++ b/canvas/source/vcl/spritecanvashelper.cxx @@ -60,7 +60,7 @@ namespace vclcanvas double calcNumPixel( const ::canvas::Sprite::Reference& rSprite ) { - const ::basegfx::B2DSize& rSize( + const ::basegfx::B2DVector& rSize( ::boost::polymorphic_downcast< Sprite* >(rSprite.get())->getSizePixel() ); return rSize.getX() * rSize.getY(); 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 ); } diff --git a/drawinglayer/source/tools/emfphelperdata.cxx b/drawinglayer/source/tools/emfphelperdata.cxx index 582b86fe72e9..91f07d88d765 100644 --- a/drawinglayer/source/tools/emfphelperdata.cxx +++ b/drawinglayer/source/tools/emfphelperdata.cxx @@ -1523,11 +1523,11 @@ namespace emfplushelper const basegfx::B2DHomMatrix aTransformMatrix = maMapTransform * basegfx::B2DHomMatrix( - /* Row 0, Column 0 */ aDstSize.getX(), + /* Row 0, Column 0 */ aDstSize.getWidth(), /* Row 0, Column 1 */ fShearX, /* Row 0, Column 2 */ aDstPoint.getX(), /* Row 1, Column 0 */ fShearY, - /* Row 1, Column 1 */ aDstSize.getY(), + /* Row 1, Column 1 */ aDstSize.getHeight(), /* Row 1, Column 2 */ aDstPoint.getY()); if (image->type == ImageDataTypeBitmap) @@ -1643,7 +1643,7 @@ namespace emfplushelper } const basegfx::B2DHomMatrix transformMatrix = basegfx::utils::createScaleTranslateB2DHomMatrix( - ::basegfx::B2DSize(font->emSize, font->emSize), + ::basegfx::B2DVector(font->emSize, font->emSize), ::basegfx::B2DPoint(lx + stringAlignmentHorizontalOffset, ly + stringAlignmentVerticalOffset)); @@ -2184,7 +2184,7 @@ namespace emfplushelper aDXArray.push_back(0); basegfx::B2DHomMatrix transformMatrix = basegfx::utils::createScaleTranslateB2DHomMatrix( - ::basegfx::B2DSize(font->emSize, font->emSize), + ::basegfx::B2DVector(font->emSize, font->emSize), ::basegfx::B2DPoint(charsPosX[pos], charsPosY[pos])); if (hasMatrix) transformMatrix *= transform; diff --git a/include/basegfx/point/b2dpoint.hxx b/include/basegfx/point/b2dpoint.hxx index 3bd6af90af9c..6252352fdebe 100644 --- a/include/basegfx/point/b2dpoint.hxx +++ b/include/basegfx/point/b2dpoint.hxx @@ -23,6 +23,7 @@ #include <basegfx/tuple/b2dtuple.hxx> #include <basegfx/point/b2ipoint.hxx> +#include <basegfx/vector/b2dsize.hxx> #include <basegfx/basegfxdllapi.h> namespace basegfx @@ -77,6 +78,11 @@ namespace basegfx : B2DTuple(rTuple) {} + /** create a point from a size object */ + explicit B2DPoint(Size2D<double> const& rSize) + : B2DTuple(rSize.getWidth(), rSize.getHeight()) + {} + /** *=operator to allow usage from B2DPoint, too */ B2DPoint& operator*=( const B2DPoint& rPnt ) diff --git a/include/basegfx/tuple/Size2D.hxx b/include/basegfx/tuple/Size2D.hxx index 87bd95330bb8..d4e2a2a784bc 100644 --- a/include/basegfx/tuple/Size2D.hxx +++ b/include/basegfx/tuple/Size2D.hxx @@ -22,7 +22,7 @@ public: { } - Size2D(Tuple2D<double> const& rTuple) + Size2D(Tuple2D<TYPE> const& rTuple) : Tuple2D<TYPE>(rTuple.getX(), rTuple.getY()) { } diff --git a/include/basegfx/utils/canvastools.hxx b/include/basegfx/utils/canvastools.hxx index 9b2f44dd3e14..228a1b0f504a 100644 --- a/include/basegfx/utils/canvastools.hxx +++ b/include/basegfx/utils/canvastools.hxx @@ -60,6 +60,7 @@ namespace basegfx class B2IRange; class B2DPolygon; class B2DPolyPolygon; + class B2DSize; } namespace basegfx::unotools @@ -119,7 +120,7 @@ namespace basegfx::unotools // Geometry conversions - BASEGFX_DLLPUBLIC css::geometry::RealSize2D size2DFromB2DSize( const ::basegfx::B2DVector& ); + BASEGFX_DLLPUBLIC css::geometry::RealSize2D size2DFromB2DSize( const ::basegfx::B2DSize& ); BASEGFX_DLLPUBLIC css::geometry::RealPoint2D point2DFromB2DPoint( const ::basegfx::B2DPoint& ); BASEGFX_DLLPUBLIC css::geometry::RealRectangle2D rectangle2DFromB2DRectangle( const ::basegfx::B2DRange& ); BASEGFX_DLLPUBLIC css::geometry::RealRectangle3D rectangle3DFromB3DRectangle( const ::basegfx::B3DRange& ); diff --git a/include/basegfx/vector/b2dsize.hxx b/include/basegfx/vector/b2dsize.hxx index 1179126991e0..e15158fbf9fd 100644 --- a/include/basegfx/vector/b2dsize.hxx +++ b/include/basegfx/vector/b2dsize.hxx @@ -19,15 +19,74 @@ #pragma once -#include <basegfx/vector/b2dvector.hxx> +#include <basegfx/tuple/Size2D.hxx> +#include <basegfx/matrix/b2dhommatrix.hxx> +#include <basegfx/vector/b2isize.hxx> +#include <basegfx/numeric/ftools.hxx> +#include <basegfx/basegfxdllapi.h> namespace basegfx { -// syntactic sugar: a B2DVector exactly models a Size object, -// thus, for interface clarity, we provide an alias name +class B2DSize : public Size2D<double> +{ +public: + B2DSize() + : Size2D(0.0, 0.0) + { + } + + B2DSize(double fX, double fY) + : Size2D(fX, fY) + { + } + + B2DSize(Size2D<double> const& rSize) + : Size2D(rSize) + { + } + + explicit B2DSize(B2ISize const& rSize) + : Size2D(rSize.getX(), rSize.getY()) + { + } + + /** Transform size by given transformation matrix. */ + B2DSize& operator*=(const B2DHomMatrix& rMatrix) + { + const double fTempX(rMatrix.get(0, 0) * getWidth() + rMatrix.get(0, 1) * getHeight()); + const double fTempY(rMatrix.get(1, 0) * getWidth() + rMatrix.get(1, 1) * getHeight()); + setWidth(fTempX); + setHeight(fTempY); + return *this; + } -/// Alias name for interface clarity (not everybody is aware of the identity) -typedef B2DVector B2DSize; + using Size2D<double>::operator+=; + using Size2D<double>::operator-=; + using Size2D<double>::operator*=; + using Size2D<double>::operator/=; + using Size2D<double>::operator-; + + double getLength() const + { + if (fTools::equalZero(getWidth())) + { + return fabs(getHeight()); + } + else if (fTools::equalZero(getHeight())) + { + return fabs(getWidth()); + } + + return hypot(getWidth(), getHeight()); + } +}; + +inline B2DSize operator*(B2DHomMatrix const& rMatrix, B2DSize const& rSize) +{ + B2DSize aRes(rSize); + aRes *= rMatrix; + return aRes; +} } /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/include/vcl/canvastools.hxx b/include/vcl/canvastools.hxx index 5a46886e59b4..778a092261a1 100644 --- a/include/vcl/canvastools.hxx +++ b/include/vcl/canvastools.hxx @@ -40,6 +40,7 @@ namespace basegfx class B2DRange; class B2IPoint; class B2IRange; + class B2DSize; } namespace com::sun::star::geometry @@ -150,7 +151,8 @@ namespace vcl::unotools Point VCL_DLLPUBLIC pointFromB2DPoint( const basegfx::B2DPoint& ); tools::Rectangle VCL_DLLPUBLIC rectangleFromB2DRectangle( const basegfx::B2DRange& ); - basegfx::B2DVector VCL_DLLPUBLIC b2DSizeFromSize( const Size& ); + VCL_DLLPUBLIC basegfx::B2DSize b2DSizeFromSize(const Size& rSize); + VCL_DLLPUBLIC basegfx::B2DVector b2DVectorFromSize(const Size& rSize); basegfx::B2DPoint VCL_DLLPUBLIC b2DPointFromPoint( const Point& ); basegfx::B2DRange VCL_DLLPUBLIC b2DRectangleFromRectangle( const tools::Rectangle& ); diff --git a/sd/source/ui/view/Outliner.cxx b/sd/source/ui/view/Outliner.cxx index 7c6684339c3f..3bb0afc7b406 100644 --- a/sd/source/ui/view/Outliner.cxx +++ b/sd/source/ui/view/Outliner.cxx @@ -713,8 +713,8 @@ basegfx::B2DRectangle getPDFSelection(const std::unique_ptr<VectorGraphicSearch> // coordinates to the page relative coordinates basegfx::B2DHomMatrix aB2DMatrix; - aB2DMatrix.scale(aObjectB2DRectHMM.getWidth() / aPdfPageSizeHMM.getX(), - aObjectB2DRectHMM.getHeight() / aPdfPageSizeHMM.getY()); + aB2DMatrix.scale(aObjectB2DRectHMM.getWidth() / aPdfPageSizeHMM.getWidth(), + aObjectB2DRectHMM.getHeight() / aPdfPageSizeHMM.getHeight()); aB2DMatrix.translate(aObjectB2DRectHMM.getMinX(), aObjectB2DRectHMM.getMinY()); diff --git a/slideshow/source/engine/animatedsprite.cxx b/slideshow/source/engine/animatedsprite.cxx index 615eb693e175..1720a1e6e54c 100644 --- a/slideshow/source/engine/animatedsprite.cxx +++ b/slideshow/source/engine/animatedsprite.cxx @@ -79,8 +79,8 @@ namespace slideshow::internal // aLinearTransform.translate(), since, as said above, the // last column of aLinearTransform is assumed [0 0 1] ::basegfx::B2DHomMatrix aLinearTransform( mpViewLayer->getTransformation() ); - aLinearTransform.set( 0, 2, maContentPixelOffset.getX() ); - aLinearTransform.set( 1, 2, maContentPixelOffset.getY() ); + aLinearTransform.set( 0, 2, maContentPixelOffset.getWidth() ); + aLinearTransform.set( 1, 2, maContentPixelOffset.getHeight() ); // apply linear part of canvas view transformation to sprite canvas pContentCanvas->setTransformation( aLinearTransform ); @@ -102,19 +102,19 @@ namespace slideshow::internal ::basegfx::B2DSize aNewSize( maEffectiveSpriteSizePixel ); bool bNeedResize( false ); - if( rSpriteSizePixel.getX() > maEffectiveSpriteSizePixel.getX() || - rSpriteSizePixel.getX() < 0.5*maEffectiveSpriteSizePixel.getX() ) + if( rSpriteSizePixel.getWidth() > maEffectiveSpriteSizePixel.getWidth() || + rSpriteSizePixel.getWidth() < 0.5 * maEffectiveSpriteSizePixel.getWidth() ) { // enlarge or shrink width - aNewSize.setX( ::canvas::tools::nextPow2( ::basegfx::fround(rSpriteSizePixel.getX()) ) ); + aNewSize.setWidth( ::canvas::tools::nextPow2( ::basegfx::fround(rSpriteSizePixel.getWidth()) ) ); bNeedResize = true; } - if( rSpriteSizePixel.getY() > maEffectiveSpriteSizePixel.getY() || - rSpriteSizePixel.getY() < 0.5*maEffectiveSpriteSizePixel.getY() ) + if( rSpriteSizePixel.getHeight() > maEffectiveSpriteSizePixel.getHeight() || + rSpriteSizePixel.getHeight() < 0.5*maEffectiveSpriteSizePixel.getHeight() ) { // enlarge or shrink height, by doubling it - aNewSize.setY( ::canvas::tools::nextPow2( ::basegfx::fround(rSpriteSizePixel.getY()) ) ); + aNewSize.setHeight( ::canvas::tools::nextPow2( ::basegfx::fround(rSpriteSizePixel.getHeight()) ) ); bNeedResize = true; } diff --git a/slideshow/source/engine/animationfactory.cxx b/slideshow/source/engine/animationfactory.cxx index 6ed7dc882969..081984144cc6 100644 --- a/slideshow/source/engine/animationfactory.cxx +++ b/slideshow/source/engine/animationfactory.cxx @@ -137,13 +137,12 @@ namespace slideshow::internal ENSURE_OR_RETURN_FALSE( mpAttrLayer && mpShape, "TupleAnimation::operator(): Invalid ShapeAttributeLayer" ); - ValueT aValue( rValue.getX(), - rValue.getY() ); + ValueT aValue(rValue.getX(), rValue.getY()); // Activities get values from the expression parser, // which returns _relative_ sizes/positions. // Convert back relative to reference coordinate system - aValue *= maReferenceSize; + aValue *= basegfx::B2DPoint(maReferenceSize); ((*mpAttrLayer).*mpSetValueFunc)( aValue ); @@ -163,19 +162,20 @@ namespace slideshow::internal // deviated from the (*shared_ptr).*mpFuncPtr // notation here, since gcc does not seem to parse // that as a member function call anymore. + basegfx::B2DPoint aPoint(maDefaultValue); aRetVal.setX( (mpAttrLayer.get()->*mpIs1stValidFunc)() ? (mpAttrLayer.get()->*mpGet1stValueFunc)() : - maDefaultValue.getX() ); + aPoint.getX() ); aRetVal.setY( (mpAttrLayer.get()->*mpIs2ndValidFunc)() ? (mpAttrLayer.get()->*mpGet2ndValueFunc)() : - maDefaultValue.getY() ); + aPoint.getY() ); // Activities get values from the expression // parser, which returns _relative_ // sizes/positions. Convert start value to the // same coordinate space (i.e. relative to given // reference size). - aRetVal /= maReferenceSize; + aRetVal /= basegfx::B2DPoint(maReferenceSize); return aRetVal; } @@ -211,7 +211,7 @@ namespace slideshow::internal mpShape(), mpAttrLayer(), mpShapeManager( rShapeManager ), - maPageSize( rSlideSize ), + maPageSize( rSlideSize.getX(), rSlideSize.getY() ), maShapeOrig(), mnFlags( nFlags ), mbAnimationStarted( false ), @@ -311,7 +311,7 @@ namespace slideshow::internal // absolute, or shape-relative. // interpret path as page-relative. Scale up with page size - rOutPos *= maPageSize; + rOutPos *= basegfx::B2DPoint(maPageSize); // TODO(F1): Determine whether the path origin is // absolute, or shape-relative. @@ -425,7 +425,7 @@ namespace slideshow::internal { mbAnimationStarted = true; - mpBox2DWorld->alertPhysicsAnimationStart(maPageSize, mpShapeManager); + mpBox2DWorld->alertPhysicsAnimationStart(basegfx::B2DVector(maPageSize.getWidth(), maPageSize.getHeight()), mpShapeManager); mpBox2DBody = mpBox2DWorld->makeShapeDynamic( mpShape->getXShape(), maStartVelocity, mfDensity, mfBounciness ); if( !(mnFlags & AnimationFactory::FLAG_NO_SPRITE) ) @@ -1334,8 +1334,8 @@ namespace slideshow::internal // Theoretically, our AttrLayer is way down the stack, and // we only have to consider _that_ value, not the one from // the top of the stack as returned by Shape::getBounds() - rBounds.getRange(), - rBounds.getRange(), + basegfx::B2DSize(rBounds.getRange().getX(), rBounds.getRange().getY()), + basegfx::B2DSize(rBounds.getRange().getX(), rBounds.getRange().getY()), &ShapeAttributeLayer::getWidth, &ShapeAttributeLayer::getHeight, &ShapeAttributeLayer::setSize ); @@ -1351,7 +1351,7 @@ namespace slideshow::internal // we only have to consider _that_ value, not the one from // the top of the stack as returned by Shape::getBounds() rBounds.getCenter(), - rSlideSize, + basegfx::B2DSize(rSlideSize.getX(), rSlideSize.getY()), &ShapeAttributeLayer::getPosX, &ShapeAttributeLayer::getPosY, &ShapeAttributeLayer::setPosition ); diff --git a/slideshow/source/engine/pointersymbol.cxx b/slideshow/source/engine/pointersymbol.cxx index 142c18ba12e4..50f4421add5c 100644 --- a/slideshow/source/engine/pointersymbol.cxx +++ b/slideshow/source/engine/pointersymbol.cxx @@ -107,7 +107,7 @@ void PointerSymbol::viewAdded( const UnoViewSharedPtr& rView ) try { const geometry::IntegerSize2D spriteSize( mxBitmap->getSize() ); - sprite = rView->createSprite( basegfx::B2DVector( spriteSize.Width, + sprite = rView->createSprite( basegfx::B2DSize( spriteSize.Width, spriteSize.Height ), 1000.0 ); // sprite should be in front of all // other sprites diff --git a/slideshow/source/engine/rehearsetimingsactivity.cxx b/slideshow/source/engine/rehearsetimingsactivity.cxx index 976c33eefe0b..67c18f8d7f14 100644 --- a/slideshow/source/engine/rehearsetimingsactivity.cxx +++ b/slideshow/source/engine/rehearsetimingsactivity.cxx @@ -319,8 +319,8 @@ basegfx::B2DRange RehearseTimingsActivity::calcSpriteRectangle( UnoViewSharedPtr spriteSize *= transformation; return basegfx::B2DRange( spritePos.getX(), spritePos.getY(), - spritePos.getX() + spriteSize.getX(), - spritePos.getY() + spriteSize.getY() ); + spritePos.getX() + spriteSize.getWidth(), + spritePos.getY() + spriteSize.getHeight() ); } void RehearseTimingsActivity::viewAdded( const UnoViewSharedPtr& rView ) diff --git a/slideshow/source/engine/shapeattributelayer.cxx b/slideshow/source/engine/shapeattributelayer.cxx index 6ddbbb513abd..c17c858d0855 100644 --- a/slideshow/source/engine/shapeattributelayer.cxx +++ b/slideshow/source/engine/shapeattributelayer.cxx @@ -259,7 +259,7 @@ namespace slideshow::internal double ShapeAttributeLayer::getWidth() const { return calcValue< double >( - maSize.getX(), + maSize.getWidth(), mbWidthValid, &ShapeAttributeLayer::isWidthValid, &ShapeAttributeLayer::getWidth ); @@ -270,7 +270,7 @@ namespace slideshow::internal ENSURE_OR_THROW( std::isfinite(rNewWidth), "ShapeAttributeLayer::setWidth(): Invalid width" ); - maSize.setX( rNewWidth ); + maSize.setWidth( rNewWidth ); mbWidthValid = true; ++mnTransformationState; } @@ -283,7 +283,7 @@ namespace slideshow::internal double ShapeAttributeLayer::getHeight() const { return calcValue< double >( - maSize.getY(), + maSize.getHeight(), mbHeightValid, &ShapeAttributeLayer::isHeightValid, &ShapeAttributeLayer::getHeight ); @@ -294,15 +294,15 @@ namespace slideshow::internal ENSURE_OR_THROW( std::isfinite(rNewHeight), "ShapeAttributeLayer::setHeight(): Invalid height" ); - maSize.setY( rNewHeight ); + maSize.setHeight( rNewHeight ); mbHeightValid = true; ++mnTransformationState; } void ShapeAttributeLayer::setSize( const ::basegfx::B2DSize& rNewSize ) { - ENSURE_OR_THROW( std::isfinite(rNewSize.getX()) && - std::isfinite(rNewSize.getY()), + ENSURE_OR_THROW( std::isfinite(rNewSize.getWidth()) && + std::isfinite(rNewSize.getHeight()), "ShapeAttributeLayer::setSize(): Invalid size" ); maSize = rNewSize; diff --git a/slideshow/source/engine/shapes/drawshape.cxx b/slideshow/source/engine/shapes/drawshape.cxx index 19d35e8f1790..ba6f2b0cbfb2 100644 --- a/slideshow/source/engine/shapes/drawshape.cxx +++ b/slideshow/source/engine/shapes/drawshape.cxx @@ -749,19 +749,19 @@ namespace slideshow::internal { const ::basegfx::B2DSize rShapeBorder( rViewShape->getAntialiasingBorder() ); - aAABorder.setX( ::std::max( - rShapeBorder.getX(), - aAABorder.getX() ) ); - aAABorder.setY( ::std::max( - rShapeBorder.getY(), - aAABorder.getY() ) ); + aAABorder.setWidth( ::std::max( + rShapeBorder.getWidth(), + aAABorder.getWidth() ) ); + aAABorder.setWidth( ::std::max( + rShapeBorder.getHeight(), + aAABorder.getHeight() ) ); } // add calculated AA border to aBounds - aBounds = ::basegfx::B2DRectangle( aBounds.getMinX() - aAABorder.getX(), - aBounds.getMinY() - aAABorder.getY(), - aBounds.getMaxX() + aAABorder.getX(), - aBounds.getMaxY() + aAABorder.getY() ); + aBounds = ::basegfx::B2DRectangle( aBounds.getMinX() - aAABorder.getWidth(), + aBounds.getMinY() - aAABorder.getHeight(), + aBounds.getMaxX() + aAABorder.getWidth(), + aBounds.getMaxY() + aAABorder.getHeight() ); } } } diff --git a/slideshow/source/engine/shapes/viewshape.cxx b/slideshow/source/engine/shapes/viewshape.cxx index 98d9c0614645..8c1ea9523061 100644 --- a/slideshow/source/engine/shapes/viewshape.cxx +++ b/slideshow/source/engine/shapes/viewshape.cxx @@ -349,7 +349,8 @@ namespace slideshow::internal // create (or resize) sprite with sprite's pixel size, if // not done already - const ::basegfx::B2DSize& rSpriteSizePixel(rSpriteBoundsPixel.getRange()); + auto aRange = rSpriteBoundsPixel.getRange(); + basegfx::B2DSize rSpriteSizePixel(aRange.getX(), aRange.getY()); if( !mpSprite ) { mpSprite = std::make_shared<AnimatedSprite>( mpViewLayer, @@ -387,8 +388,8 @@ namespace slideshow::internal // rSpriteBoundsPixel upper, left corner is: the offset we // have to move sprite output to the right, top (to make // the desired subset content visible at all) - const ::basegfx::B2DSize& rSpriteCorrectionOffset( - rSpriteBoundsPixel.getMinimum() - rNominalShapeBoundsPixel.getMinimum() ); + auto aDifference = rSpriteBoundsPixel.getMinimum() - rNominalShapeBoundsPixel.getMinimum(); + const basegfx::B2DSize rSpriteCorrectionOffset(aDifference.getX(), aDifference.getY()); // offset added top, left for anti-aliasing (otherwise, // shapes fully filling the sprite will have anti-aliased @@ -408,14 +409,14 @@ namespace slideshow::internal // nearest integer here, too mpSprite->setPixelOffset( aAAOffset - ::basegfx::B2DSize( - ::basegfx::fround( rSpriteCorrectionOffset.getX() ), - ::basegfx::fround( rSpriteCorrectionOffset.getY() ) ) ); + ::basegfx::fround( rSpriteCorrectionOffset.getWidth() ), + ::basegfx::fround( rSpriteCorrectionOffset.getHeight() ) ) ); // always set sprite position and transformation, since // they do not relate directly to the update flags // (e.g. sprite position changes when sprite size changes) mpSprite->movePixel( aSpritePosPixel ); - mpSprite->transform( getSpriteTransformation( rSpriteSizePixel, + mpSprite->transform( getSpriteTransformation( basegfx::B2DVector(rSpriteSizePixel.getWidth(), rSpriteSizePixel.getHeight()), rOrigBounds.getRange(), pAttr ) ); @@ -448,10 +449,10 @@ namespace slideshow::internal // make the clip 2*ANTIALIASING_EXTRA_SIZE larger // such that it's again centered over the sprite. - aViewTransform.scale(rSpriteSizePixel.getX()/ - (rSpriteSizePixel.getX()-2*::cppcanvas::Canvas::ANTIALIASING_EXTRA_SIZE), - rSpriteSizePixel.getY()/ - (rSpriteSizePixel.getY()-2*::cppcanvas::Canvas::ANTIALIASING_EXTRA_SIZE)); + aViewTransform.scale(rSpriteSizePixel.getWidth()/ + (rSpriteSizePixel.getWidth()-2*::cppcanvas::Canvas::ANTIALIASING_EXTRA_SIZE), + rSpriteSizePixel.getHeight()/ + (rSpriteSizePixel.getHeight()-2*::cppcanvas::Canvas::ANTIALIASING_EXTRA_SIZE)); // transform clip polygon from view to device // coordinate space diff --git a/slideshow/source/engine/slide/slideimpl.cxx b/slideshow/source/engine/slide/slideimpl.cxx index ad5a798369cb..bf07e18acf60 100644 --- a/slideshow/source/engine/slide/slideimpl.cxx +++ b/slideshow/source/engine/slide/slideimpl.cxx @@ -322,7 +322,7 @@ SlideImpl::SlideImpl( const uno::Reference< drawing::XDrawPage >& xDra xDrawPage)), mpSubsettableShapeManager( mpShapeManager ), mpBox2DWorld( std::make_shared<box2d::utils::box2DWorld>( - basegfx::B2DSize( getSlideSizeImpl() ) ) ), + basegfx::B2DVector( getSlideSizeImpl() ) ) ), maContext( mpSubsettableShapeManager, rEventQueue, rEventMultiplexer, @@ -336,7 +336,7 @@ SlideImpl::SlideImpl( const uno::Reference< drawing::XDrawPage >& xDra mpBox2DWorld ), mrCursorManager( rCursorManager ), maAnimations( maContext, - basegfx::B2DSize( getSlideSizeImpl() ) ), + basegfx::B2DVector( getSlideSizeImpl() ) ), maPolygons(std::move(rPolyPolygonVector)), maUserPaintColor(aUserPaintColor), mdUserPaintStrokeWidth(dUserPaintStrokeWidth), @@ -570,7 +570,7 @@ SlideBitmapSharedPtr SlideImpl::getCurrentSlideBitmap( const UnoViewSharedPtr& r SlideBitmapSharedPtr& rBitmap( aIter->second.at( meAnimationState )); const ::basegfx::B2ISize& rSlideSize( - getSlideSizePixel( ::basegfx::B2DSize( getSlideSize() ), + getSlideSizePixel( ::basegfx::B2DVector( getSlideSize() ), rView )); // is the bitmap valid (actually existent, and of correct @@ -920,7 +920,7 @@ void SlideImpl::applyShapeAttributes( extractValue( bVisible, rShapeProp.Value, pShape, - ::basegfx::B2DSize( getSlideSize() ) )) + basegfx::B2DVector(getSlideSize()) )) { pAttrShape->setVisibility( bVisible ); } diff --git a/slideshow/source/engine/slideshowimpl.cxx b/slideshow/source/engine/slideshowimpl.cxx index a9bc7607ddb4..1cbc167a4c4d 100644 --- a/slideshow/source/engine/slideshowimpl.cxx +++ b/slideshow/source/engine/slideshowimpl.cxx @@ -874,7 +874,7 @@ ActivitySharedPtr SlideShowImpl::createSlideTransition( 0.0, 0.0, ShapeSharedPtr(), - basegfx::B2DSize( rEnteringSlide->getSlideSize() ) ), + basegfx::B2DVector( rEnteringSlide->getSlideSize() ) ), pTransition, true )); } diff --git a/slideshow/source/engine/slideview.cxx b/slideshow/source/engine/slideview.cxx index d2e509b6dccc..26c4e0f971bb 100644 --- a/slideshow/source/engine/slideview.cxx +++ b/slideshow/source/engine/slideview.cxx @@ -112,7 +112,7 @@ basegfx::B2DPolyPolygon createClipPolygon( const basegfx::B2DPolyPolygon& rCl // ===================== // AW: Simplified - const basegfx::B2DRange aClipRange(0, 0, rUserSize.getX(), rUserSize.getY()); + const basegfx::B2DRange aClipRange(0, 0, rUserSize.getWidth(), rUserSize.getHeight()); if(rClip.count()) { @@ -446,8 +446,8 @@ public: // limit layer bounds to visible screen maLayerBounds.intersect( basegfx::B2DRange(0.0, 0.0, - maUserSize.getX(), - maUserSize.getY()) ); + maUserSize.getWidth(), + maUserSize.getHeight()) ); basegfx::B2IRange const& rNewLayerPixel( getLayerBoundsPixel(maLayerBounds, @@ -584,7 +584,7 @@ private: const basegfx::B2I64Tuple& rSpriteSize(maLayerBoundsPixel.getRange()); mpSprite = mpSpriteCanvas->createCustomSprite( - basegfx::B2DVector(sal::static_int_cast<sal_Int32>(rSpriteSize.getX()), + basegfx::B2DSize(sal::static_int_cast<sal_Int32>(rSpriteSize.getX()), sal::static_int_cast<sal_Int32>(rSpriteSize.getY())) ); mpSprite->setPriority( @@ -861,8 +861,8 @@ void SlideView::clear() const clearRect(getCanvas()->clone(), getLayerBoundsPixel( basegfx::B2DRange(0,0, - maUserSize.getX(), - maUserSize.getY()), + maUserSize.getWidth(), + maUserSize.getHeight()), getTransformation())); } @@ -945,7 +945,7 @@ basegfx::B2DHomMatrix SlideView::getTransformation() const osl::MutexGuard aGuard( m_aMutex ); basegfx::B2DHomMatrix aMatrix; - aMatrix.scale( 1.0/maUserSize.getX(), 1.0/maUserSize.getY() ); + aMatrix.scale( 1.0 / maUserSize.getWidth(), 1.0 / maUserSize.getHeight() ); return maViewTransform * aMatrix; } diff --git a/slideshow/source/engine/tools.cxx b/slideshow/source/engine/tools.cxx index dadf1cfbb193..3567fa5c146b 100644 --- a/slideshow/source/engine/tools.cxx +++ b/slideshow/source/engine/tools.cxx @@ -77,7 +77,7 @@ namespace slideshow::internal const ShapeAttributeLayerSharedPtr& pAttr ) { ::basegfx::B2DHomMatrix aTransform; - const ::basegfx::B2DSize& rSize( rShapeBounds.getRange() ); + const basegfx::B2DSize rSize(rShapeBounds.getRange().getX(), rShapeBounds.getRange().getY()); const double nShearX( pAttr->isShearXAngleValid() ? pAttr->getShearXAngle() : @@ -96,9 +96,9 @@ namespace slideshow::internal // ensure valid size (zero size will inevitably lead // to a singular transformation matrix) aTransform.scale( ::basegfx::pruneScaleValue( - rSize.getX() ), + rSize.getWidth() ), ::basegfx::pruneScaleValue( - rSize.getY() ) ); + rSize.getHeight() ) ); const bool bNeedShearX( !::basegfx::fTools::equalZero(nShearX) ); const bool bNeedShearY( !::basegfx::fTools::equalZero(nShearY) ); @@ -499,11 +499,11 @@ namespace slideshow::internal // ensure valid size (zero size will inevitably lead // to a singular transformation matrix). aTransform.scale( ::basegfx::pruneScaleValue( - aSize.getX() / + aSize.getWidth() / ::basegfx::pruneScaleValue( rOrigSize.getX() ) ), ::basegfx::pruneScaleValue( - aSize.getY() / + aSize.getHeight() / ::basegfx::pruneScaleValue( rOrigSize.getY() ) ) ); @@ -606,10 +606,10 @@ namespace slideshow::internal // (aka mirrored shapes) _still_ have the same bounds, // only with mirrored content. ::basegfx::B2DSize aSize; - aSize.setX( fabs( pAttr->isWidthValid() ? + aSize.setWidth( fabs( pAttr->isWidthValid() ? pAttr->getWidth() : rOrigBounds.getWidth() ) ); - aSize.setY( fabs( pAttr->isHeightValid() ? + aSize.setHeight( fabs( pAttr->isHeightValid() ? pAttr->getHeight() : rOrigBounds.getHeight() ) ); @@ -624,8 +624,8 @@ namespace slideshow::internal // the positional attribute retrieved from the // ShapeAttributeLayer actually denotes the _middle_ // of the shape (do it as the PPTs do...) - return ::basegfx::B2DRectangle( aPos - 0.5*aSize, - aPos + 0.5*aSize ); + return ::basegfx::B2DRectangle(aPos - 0.5 * basegfx::B2DPoint(aSize), + aPos + 0.5 * basegfx::B2DPoint(aSize)); } } diff --git a/slideshow/source/engine/transitions/clippingfunctor.cxx b/slideshow/source/engine/transitions/clippingfunctor.cxx index 19bb6cbba85f..78c7e71029b7 100644 --- a/slideshow/source/engine/transitions/clippingfunctor.cxx +++ b/slideshow/source/engine/transitions/clippingfunctor.cxx @@ -186,16 +186,16 @@ namespace slideshow::internal // scale polygon up to current shape size if( mbScaleIsotrophically ) { - const double nScale( ::std::max( rTargetSize.getX(), - rTargetSize.getY() ) ); + const double nScale( ::std::max( rTargetSize.getWidth(), + rTargetSize.getHeight() ) ); aMatrix.scale( nScale, nScale ); - aMatrix.translate( -(nScale-rTargetSize.getX())/2.0, - -(nScale-rTargetSize.getY())/2.0 ); + aMatrix.translate( -(nScale - rTargetSize.getWidth())/2.0, + -(nScale - rTargetSize.getHeight())/2.0 ); } else { - aMatrix.scale( rTargetSize.getX(), - rTargetSize.getY() ); + aMatrix.scale( rTargetSize.getWidth(), + rTargetSize.getHeight() ); } // apply cumulative transformation to clip polygon diff --git a/slideshow/source/engine/transitions/combtransition.cxx b/slideshow/source/engine/transitions/combtransition.cxx index 3fcdbb2e0d2c..b79046542000 100644 --- a/slideshow/source/engine/transitions/combtransition.cxx +++ b/slideshow/source/engine/transitions/combtransition.cxx @@ -54,8 +54,7 @@ basegfx::B2DPolyPolygon createClipPolygon( basegfx::B2DHomMatrix aMatrix(basegfx::utils::createRotateAroundPoint(0.5, 0.5, aUpVec.angle( rDirection ))); // blow up clip polygon to slide size - aMatrix.scale( rSlideSize.getX(), - rSlideSize.getY() ); + aMatrix.scale(rSlideSize.getWidth(), rSlideSize.getHeight()); aClipPoly.transform( aMatrix ); @@ -111,18 +110,18 @@ void CombTransition::renderComb( double t, // TODO(Q2): Use basegfx bitmaps here // TODO(F1): SlideBitmap is not fully portable between different canvases! - const basegfx::B2DSize enteringSizePixel( + const basegfx::B2DVector enteringSizePixel( getEnteringSlideSizePixel( rViewEntry.mpView) ); const basegfx::B2DVector aPushDirection( enteringSizePixel * maPushDirectionUnit ); const basegfx::B2DPolyPolygon aClipPolygon1 = createClipPolygon( maPushDirectionUnit, - enteringSizePixel, + basegfx::B2DSize(enteringSizePixel.getX(), enteringSizePixel.getY()), mnNumStripes, 0 ); const basegfx::B2DPolyPolygon aClipPolygon2 = createClipPolygon( maPushDirectionUnit, - enteringSizePixel, + basegfx::B2DSize(enteringSizePixel.getX(), enteringSizePixel.getY()), mnNumStripes, 1 ); SlideBitmapSharedPtr const & pLeavingBitmap = getLeavingBitmap(rViewEntry); diff --git a/slideshow/source/engine/transitions/shapetransitionfactory.cxx b/slideshow/source/engine/transitions/shapetransitionfactory.cxx index 934cefb98624..2df1b55a692a 100644 --- a/slideshow/source/engine/transitions/shapetransitionfactory.cxx +++ b/slideshow/source/engine/transitions/shapetransitionfactory.cxx @@ -159,8 +159,8 @@ bool ClippingAnimation::operator()( double nValue ) "ClippingAnimation::operator(): Invalid ShapeAttributeLayer" ); // set new clip - mpAttrLayer->setClip( maClippingFunctor( nValue, - mpShape->getDomBounds().getRange() ) ); + auto aBounds = mpShape->getDomBounds().getRange(); + mpAttrLayer->setClip( maClippingFunctor(nValue, basegfx::B2DSize(aBounds.getX(), aBounds.getY())) ); if( mpShape->isContentChanged() ) mpShapeManager->notifyShapeUpdate( mpShape ); diff --git a/slideshow/source/engine/transitions/slidechangebase.cxx b/slideshow/source/engine/transitions/slidechangebase.cxx index ade76df4a782..6c8a0ec9eef4 100644 --- a/slideshow/source/engine/transitions/slidechangebase.cxx +++ b/slideshow/source/engine/transitions/slidechangebase.cxx @@ -93,7 +93,7 @@ SlideBitmapSharedPtr SlideChangeBase::createBitmap( const UnoViewSharedPtr& // create empty, black-filled bitmap const basegfx::B2ISize slideSizePixel( - getSlideSizePixel( basegfx::B2DSize( mpEnteringSlide->getSlideSize() ), + getSlideSizePixel( basegfx::B2DVector( mpEnteringSlide->getSlideSize() ), rView )); cppcanvas::CanvasSharedPtr pCanvas( rView->getCanvas() ); @@ -137,7 +137,7 @@ SlideBitmapSharedPtr SlideChangeBase::createBitmap( const UnoViewSharedPtr& ::basegfx::B2ISize SlideChangeBase::getEnteringSlideSizePixel( const UnoViewSharedPtr& pView ) const { - return getSlideSizePixel( basegfx::B2DSize( mpEnteringSlide->getSlideSize() ), + return getSlideSizePixel( basegfx::B2DVector(mpEnteringSlide->getSlideSize().getX(), mpEnteringSlide->getSlideSize().getY()), pView ); } @@ -487,7 +487,7 @@ void SlideChangeBase::addSprites( ViewEntry& rEntry ) { // create entering sprite: const basegfx::B2ISize enteringSlideSizePixel( - getSlideSizePixel( basegfx::B2DSize( mpEnteringSlide->getSlideSize() ), + getSlideSizePixel( basegfx::B2DVector( mpEnteringSlide->getSlideSize() ), rEntry.mpView )); rEntry.mpInSprite = createSprite( rEntry.mpView, diff --git a/slideshow/source/engine/transitions/slidetransitionfactory.cxx b/slideshow/source/engine/transitions/slidetransitionfactory.cxx index 8e6bc0de0fed..fcee18e262c3 100644 --- a/slideshow/source/engine/transitions/slidetransitionfactory.cxx +++ b/slideshow/source/engine/transitions/slidetransitionfactory.cxx @@ -74,8 +74,8 @@ void fillPage( const ::cppcanvas::CanvasSharedPtr& rDestinationCanvas, ::basegfx::B2DRectangle( aOutputPosPixel.getX(), aOutputPosPixel.getY(), - aOutputPosPixel.getX() + rPageSizePixel.getX(), - aOutputPosPixel.getY() + rPageSizePixel.getY() ), + aOutputPosPixel.getX() + rPageSizePixel.getWidth(), + aOutputPosPixel.getY() + rPageSizePixel.getHeight() ), rFillColor.getIntegerColor() ); } @@ -619,7 +619,7 @@ void MovingSlideChange::performIn( rSprite->movePixel( aPageOrigin + ((t - 1.0) * - ::basegfx::B2DSize( getEnteringSlideSizePixel(rViewEntry.mpView) ) * + basegfx::B2DVector( getEnteringSlideSizePixel(rViewEntry.mpView) ) * maEnteringDirection) ); } @@ -650,7 +650,7 @@ void MovingSlideChange::performOut( // move sprite rSprite->movePixel( aPageOrigin + (t * - ::basegfx::B2DSize( getEnteringSlideSizePixel(rViewEntry.mpView) ) * + basegfx::B2DVector( getEnteringSlideSizePixel(rViewEntry.mpView) ) * maLeavingDirection) ); } diff --git a/slideshow/source/engine/waitsymbol.cxx b/slideshow/source/engine/waitsymbol.cxx index 619391fb3546..bbeda8eac558 100644 --- a/slideshow/source/engine/waitsymbol.cxx +++ b/slideshow/source/engine/waitsymbol.cxx @@ -111,7 +111,7 @@ void WaitSymbol::viewAdded( const UnoViewSharedPtr& rView ) try { const geometry::IntegerSize2D spriteSize( mxBitmap->getSize() ); - sprite = rView->createSprite( basegfx::B2DVector( spriteSize.Width, + sprite = rView->createSprite( basegfx::B2DSize( spriteSize.Width, spriteSize.Height ), 1000.0 ); // sprite should be in front of all // other sprites diff --git a/slideshow/source/inc/animatedsprite.hxx b/slideshow/source/inc/animatedsprite.hxx index 8f02bd186230..f298aaa52fb3 100644 --- a/slideshow/source/inc/animatedsprite.hxx +++ b/slideshow/source/inc/animatedsprite.hxx @@ -22,6 +22,7 @@ #include <basegfx/matrix/b2dhommatrix.hxx> #include <basegfx/point/b2dpoint.hxx> +#include <basegfx/vector/b2dsize.hxx> #include <basegfx/polygon/b2dpolypolygon.hxx> #include "viewlayer.hxx" diff --git a/slideshow/source/inc/viewlayer.hxx b/slideshow/source/inc/viewlayer.hxx index 4fe8aa4e03d3..bffe685f9d65 100644 --- a/slideshow/source/inc/viewlayer.hxx +++ b/slideshow/source/inc/viewlayer.hxx @@ -31,7 +31,7 @@ namespace basegfx class B2DVector; class B2DHomMatrix; class B2DPolyPolygon; - typedef B2DVector B2DSize; + class B2DSize; } namespace cppcanvas { diff --git a/slideshow/test/testview.cxx b/slideshow/test/testview.cxx index 237fb3d386b4..cb2ad820129c 100644 --- a/slideshow/test/testview.cxx +++ b/slideshow/test/testview.cxx @@ -159,7 +159,8 @@ public: virtual ::cppcanvas::CustomSpriteSharedPtr createSprite( const ::basegfx::B2DSize& rSpriteSizePixel, double nPriority ) const override { - maCreatedSprites.push_back( std::make_pair(rSpriteSizePixel,nPriority) ); + basegfx::B2DVector aSpriteSizeVector(rSpriteSizePixel.getWidth(), rSpriteSizePixel.getHeight()); + maCreatedSprites.emplace_back(aSpriteSizeVector, nPriority); return ::cppcanvas::CustomSpriteSharedPtr(); } diff --git a/svx/source/sdr/overlay/overlaytools.cxx b/svx/source/sdr/overlay/overlaytools.cxx index 3bb91506033b..f36d6dacfca1 100644 --- a/svx/source/sdr/overlay/overlaytools.cxx +++ b/svx/source/sdr/overlay/overlaytools.cxx @@ -57,8 +57,8 @@ OverlayStaticRectanglePrimitive::OverlayStaticRectanglePrimitive( void OverlayStaticRectanglePrimitive::create2DDecomposition(Primitive2DContainer& rContainer, const geometry::ViewInformation2D& /*rViewInformation*/) const { Primitive2DContainer aPrimitive2DSequence; - const double fHalfWidth = maSize.getX() * getDiscreteUnit() / 2.0; - const double fHalfHeight = maSize.getY() * getDiscreteUnit() / 2.0; + const double fHalfWidth = maSize.getWidth() * getDiscreteUnit() / 2.0; + const double fHalfHeight = maSize.getHeight() * getDiscreteUnit() / 2.0; basegfx::B2DRange aRange( maPosition.getX() - fHalfWidth, maPosition.getY() - fHalfHeight, diff --git a/svx/source/svdraw/svdpdf.cxx b/svx/source/svdraw/svdpdf.cxx index 56df7d94b437..16745d445e13 100644 --- a/svx/source/svdraw/svdpdf.cxx +++ b/svx/source/svdraw/svdpdf.cxx @@ -138,10 +138,7 @@ void ImpSdrPdfImport::DoObjects(SvdProgressInfo* pProgrInfo, sal_uInt32* pAction basegfx::B2DSize dPageSize = mpPdfDocument->getPageSize(nPageIndex); - const double dPageWidth = dPageSize.getX(); - const double dPageHeight = dPageSize.getY(); - - SetupPageScale(dPageWidth, dPageHeight); + SetupPageScale(dPageSize.getWidth(), dPageSize.getHeight()); // Load the page text to extract it when we get text elements. auto pTextPage = pPdfPage->getTextPage(); diff --git a/sw/source/core/docnode/ndnotxt.cxx b/sw/source/core/docnode/ndnotxt.cxx index cca2d75f71fa..e4641de22325 100644 --- a/sw/source/core/docnode/ndnotxt.cxx +++ b/sw/source/core/docnode/ndnotxt.cxx @@ -117,8 +117,8 @@ const tools::PolyPolygon *SwNoTextNode::HasContour() const if ( !bPixelGrf && m_bPixelContour ) { basegfx::B2DSize aDPI = GetGraphic().GetPPI(); - nGrfDPIx = aDPI.getX(); - nGrfDPIy = aDPI.getY(); + nGrfDPIx = aDPI.getWidth(); + nGrfDPIy = aDPI.getHeight(); } } OSL_ENSURE( !bPixelGrf || aGrfMap == aContourMap, diff --git a/sw/source/uibase/docvw/HeaderFooterWin.cxx b/sw/source/uibase/docvw/HeaderFooterWin.cxx index ba75b20ec3ff..33df6419b154 100644 --- a/sw/source/uibase/docvw/HeaderFooterWin.cxx +++ b/sw/source/uibase/docvw/HeaderFooterWin.cxx @@ -323,7 +323,7 @@ void SwHeaderFooterWin::PaintButton() // Create the 'plus' or 'arrow' primitive B2DRectangle aSignArea(B2DPoint(aRect.Right() - BUTTON_WIDTH, 0.0), - B2DSize(aRect.Right(), aRect.getOpenHeight())); + B2DVector(aRect.Right(), aRect.getOpenHeight())); B2DPolygon aSign; bool bIsEmptyHeaderFooter = IsEmptyHeaderFooter(); diff --git a/vcl/qa/cppunit/PDFiumLibraryTest.cxx b/vcl/qa/cppunit/PDFiumLibraryTest.cxx index 1f82f24acccf..ea662d2b3dae 100644 --- a/vcl/qa/cppunit/PDFiumLibraryTest.cxx +++ b/vcl/qa/cppunit/PDFiumLibraryTest.cxx @@ -77,8 +77,8 @@ void PDFiumLibraryTest::testDocument() CPPUNIT_ASSERT_EQUAL(1, pDocument->getPageCount()); auto aSize = pDocument->getPageSize(0); - CPPUNIT_ASSERT_EQUAL(612.0, aSize.getX()); - CPPUNIT_ASSERT_EQUAL(792.0, aSize.getY()); + CPPUNIT_ASSERT_EQUAL(612.0, aSize.getWidth()); + CPPUNIT_ASSERT_EQUAL(792.0, aSize.getHeight()); } void PDFiumLibraryTest::testPages() diff --git a/vcl/qa/cppunit/VectorGraphicSearchTest.cxx b/vcl/qa/cppunit/VectorGraphicSearchTest.cxx index 684493e9cd0c..59ce0fed5e67 100644 --- a/vcl/qa/cppunit/VectorGraphicSearchTest.cxx +++ b/vcl/qa/cppunit/VectorGraphicSearchTest.cxx @@ -58,8 +58,8 @@ void VectorGraphicSearchTest::test() CPPUNIT_ASSERT_EQUAL(34, aSearch.index()); basegfx::B2DSize aSize = aSearch.pageSize(); - CPPUNIT_ASSERT_DOUBLES_EQUAL(21590.00, aSize.getX(), 1E-2); - CPPUNIT_ASSERT_DOUBLES_EQUAL(27940.00, aSize.getY(), 1E-2); + CPPUNIT_ASSERT_DOUBLES_EQUAL(21590.00, aSize.getWidth(), 1E-2); + CPPUNIT_ASSERT_DOUBLES_EQUAL(27940.00, aSize.getHeight(), 1E-2); auto aRectangles = aSearch.getTextRectangles(); CPPUNIT_ASSERT_EQUAL(size_t(4), aRectangles.size()); diff --git a/vcl/qa/cppunit/pdfexport/pdfexport.cxx b/vcl/qa/cppunit/pdfexport/pdfexport.cxx index 1e056cc904d1..e2c6ae39784b 100644 --- a/vcl/qa/cppunit/pdfexport/pdfexport.cxx +++ b/vcl/qa/cppunit/pdfexport/pdfexport.cxx @@ -2422,7 +2422,7 @@ CPPUNIT_TEST_FIXTURE(PdfExportTest, testLargePage) // - Expected: 8503.94 // - Actual : 17007.875 // i.e. the value for 600 cm was larger than the 14 400 limit set in the spec. - CPPUNIT_ASSERT_DOUBLES_EQUAL(8503.94, aSize.getX(), 0.01); + CPPUNIT_ASSERT_DOUBLES_EQUAL(8503.94, aSize.getWidth(), 0.01); } CPPUNIT_TEST_FIXTURE(PdfExportTest, testPdfImageResourceInlineXObjectRef) diff --git a/vcl/source/filter/ipdf/pdfread.cxx b/vcl/source/filter/ipdf/pdfread.cxx index e99682e0c0e4..b810b943f98b 100644 --- a/vcl/source/filter/ipdf/pdfread.cxx +++ b/vcl/source/filter/ipdf/pdfread.cxx @@ -246,11 +246,11 @@ bool ImportPDF(SvStream& rStream, Graphic& rGraphic) namespace { -basegfx::B2DPoint convertFromPDFInternalToHMM(basegfx::B2DSize const& rInputPoint, +basegfx::B2DPoint convertFromPDFInternalToHMM(basegfx::B2DPoint const& rInputPoint, basegfx::B2DSize const& rPageSize) { double x = convertPointToMm100(rInputPoint.getX()); - double y = convertPointToMm100(rPageSize.getY() - rInputPoint.getY()); + double y = convertPointToMm100(rPageSize.getHeight() - rInputPoint.getY()); return { x, y }; } @@ -284,9 +284,9 @@ findAnnotations(const std::unique_ptr<vcl::pdf::PDFiumPage>& pPage, basegfx::B2D basegfx::B2DRectangle rRectangle = pAnnotation->getRectangle(); basegfx::B2DRectangle rRectangleHMM( convertPointToMm100(rRectangle.getMinX()), - convertPointToMm100(aPageSize.getY() - rRectangle.getMinY()), + convertPointToMm100(aPageSize.getHeight() - rRectangle.getMinY()), convertPointToMm100(rRectangle.getMaxX()), - convertPointToMm100(aPageSize.getY() - rRectangle.getMaxY())); + convertPointToMm100(aPageSize.getHeight() - rRectangle.getMaxY())); OUString sDateTimeString = pAnnotation->getString(vcl::pdf::constDictionaryKeyModificationDate); @@ -460,15 +460,17 @@ size_t ImportPDFUnloaded(const OUString& rURL, std::vector<PDFGraphicResult>& rG for (int nPageIndex = 0; nPageIndex < nPageCount; ++nPageIndex) { basegfx::B2DSize aPageSize = pPdfDocument->getPageSize(nPageIndex); - if (aPageSize.getX() <= 0.0 || aPageSize.getY() <= 0.0) + if (aPageSize.getWidth() <= 0.0 || aPageSize.getHeight() <= 0.0) continue; // Returned unit is points, convert that to twip // 1 pt = 20 twips constexpr double pointToTwipconversionRatio = 20; - tools::Long nPageWidth = convertTwipToMm100(aPageSize.getX() * pointToTwipconversionRatio); - tools::Long nPageHeight = convertTwipToMm100(aPageSize.getY() * pointToTwipconversionRatio); + tools::Long nPageWidth + = convertTwipToMm100(aPageSize.getWidth() * pointToTwipconversionRatio); + tools::Long nPageHeight + = convertTwipToMm100(aPageSize.getHeight() * pointToTwipconversionRatio); // Create the Graphic with the VectorGraphicDataPtr and link the original PDF stream. // We swap out this Graphic as soon as possible, and a later swap in diff --git a/vcl/source/filter/jpeg/JpegWriter.cxx b/vcl/source/filter/jpeg/JpegWriter.cxx index 026ab887b451..cc2dbf0a0374 100644 --- a/vcl/source/filter/jpeg/JpegWriter.cxx +++ b/vcl/source/filter/jpeg/JpegWriter.cxx @@ -245,7 +245,7 @@ bool JPEGWriter::Write( const Graphic& rGraphic ) if( !mbNative ) mpBuffer = new sal_uInt8[ AlignedWidth4Bytes( mbGreys ? mpReadAccess->Width() * 8L : mpReadAccess->Width() * 24L ) ]; - SAL_INFO("vcl", "\nJPEG Export - DPI X: " << rGraphic.GetPPI().getX() << "\nJPEG Export - DPI Y: " << rGraphic.GetPPI().getY()); + SAL_INFO("vcl", "\nJPEG Export - DPI X: " << rGraphic.GetPPI().getWidth() << "\nJPEG Export - DPI Y: " << rGraphic.GetPPI().getHeight()); bRet = WriteJPEG( this, &mrStream, mpReadAccess->Width(), mpReadAccess->Height(), rGraphic.GetPPI(), mbGreys, diff --git a/vcl/source/filter/jpeg/jpegc.cxx b/vcl/source/filter/jpeg/jpegc.cxx index a81037f97424..2b2f9713a695 100644 --- a/vcl/source/filter/jpeg/jpegc.cxx +++ b/vcl/source/filter/jpeg/jpegc.cxx @@ -384,15 +384,15 @@ bool WriteJPEG( JPEGWriter* pJPEGWriter, void* pOutputStream, jpeg_set_defaults( &cinfo ); jpeg_set_quality( &cinfo, static_cast<int>(nQualityPercent), FALSE ); - if (o3tl::convertsToAtMost(rPPI.getX(), 65535) && o3tl::convertsToAtMost(rPPI.getY(), 65535)) + if (o3tl::convertsToAtMost(rPPI.getWidth(), 65535) && o3tl::convertsToAtMost(rPPI.getHeight(), 65535)) { cinfo.density_unit = 1; - cinfo.X_density = rPPI.getX(); - cinfo.Y_density = rPPI.getY(); + cinfo.X_density = rPPI.getWidth(); + cinfo.Y_density = rPPI.getHeight(); } else { - SAL_WARN("vcl.filter", "ignoring too large PPI " << rPPI); + SAL_WARN("vcl.filter", "ignoring too large PPI (" << rPPI.getWidth() << ", " << rPPI.getHeight() << ")"); } if ( ( nWidth > 128 ) || ( nHeight > 128 ) ) diff --git a/vcl/source/graphic/VectorGraphicSearch.cxx b/vcl/source/graphic/VectorGraphicSearch.cxx index 69e69741ab42..c2f624417552 100644 --- a/vcl/source/graphic/VectorGraphicSearch.cxx +++ b/vcl/source/graphic/VectorGraphicSearch.cxx @@ -56,8 +56,8 @@ public: return aSize; basegfx::B2DSize aPDFSize = mpPdfDocument->getPageSize(mnPageIndex); - aSize = basegfx::B2DSize(convertPointToMm100(aPDFSize.getX()), - convertPointToMm100(aPDFSize.getY())); + aSize = basegfx::B2DSize(convertPointToMm100(aPDFSize.getWidth()), + convertPointToMm100(aPDFSize.getHeight())); return aSize; } @@ -159,7 +159,7 @@ public: if (nSize <= 0) return aRectangles; - double fPageHeight = getPageSize().getY(); + double fPageHeight = getPageSize().getHeight(); for (int nCount = 0; nCount < nSize; nCount++) { diff --git a/vcl/source/helper/canvastools.cxx b/vcl/source/helper/canvastools.cxx index d1a4f7cec473..595f12a959c8 100644 --- a/vcl/source/helper/canvastools.cxx +++ b/vcl/source/helper/canvastools.cxx @@ -30,6 +30,7 @@ #include <com/sun/star/rendering/ColorComponentTag.hpp> #include <basegfx/point/b2dpoint.hxx> +#include <basegfx/vector/b2dsize.hxx> #include <basegfx/range/b2drectangle.hxx> #include <basegfx/point/b2ipoint.hxx> #include <basegfx/range/b2irectangle.hxx> @@ -369,10 +370,14 @@ namespace vcl::unotools rRect.IsHeightEmpty() ? rRect.Top() : rRect.Bottom() ); } - basegfx::B2DVector b2DSizeFromSize( const ::Size& rSize ) + basegfx::B2DSize b2DSizeFromSize(const Size& rSize) { - return basegfx::B2DVector( rSize.Width(), - rSize.Height() ); + return basegfx::B2DSize(rSize.Width(), rSize.Height()); + } + + basegfx::B2DVector b2DVectorFromSize(const Size& rSize) + { + return basegfx::B2DVector(rSize.Width(), rSize.Height()); } basegfx::B2DPoint b2DPointFromPoint( const ::Point& rPoint ) |