summaryrefslogtreecommitdiff
path: root/vcl
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 /vcl
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 'vcl')
-rw-r--r--vcl/qa/cppunit/PDFiumLibraryTest.cxx4
-rw-r--r--vcl/qa/cppunit/VectorGraphicSearchTest.cxx4
-rw-r--r--vcl/qa/cppunit/pdfexport/pdfexport.cxx2
-rw-r--r--vcl/source/filter/ipdf/pdfread.cxx16
-rw-r--r--vcl/source/filter/jpeg/JpegWriter.cxx2
-rw-r--r--vcl/source/filter/jpeg/jpegc.cxx8
-rw-r--r--vcl/source/graphic/VectorGraphicSearch.cxx6
-rw-r--r--vcl/source/helper/canvastools.cxx11
8 files changed, 30 insertions, 23 deletions
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 )