svx/source/svdraw/svdpdf.cxx | 16 +++++++--------- vcl/qa/cppunit/pdfexport/pdfexport.cxx | 22 ++++++++-------------- 2 files changed, 15 insertions(+), 23 deletions(-)
New commits: commit 106a9e98c864fe07bf91331d510dd41e3801c6eb Author: Miklos Vajna <[email protected]> AuthorDate: Wed Dec 9 21:58:36 2020 +0100 Commit: Miklos Vajna <[email protected]> CommitDate: Thu Dec 10 09:17:55 2020 +0100 pdfium: no need to use FPDFPageObj_GetBounds() directly Change-Id: I74f968e0b76a2992d5f07524a29a7c8600983d3c Reviewed-on: https://gerrit.libreoffice.org/c/core/+/107509 Tested-by: Jenkins Reviewed-by: Miklos Vajna <[email protected]> diff --git a/svx/source/svdraw/svdpdf.cxx b/svx/source/svdraw/svdpdf.cxx index 6f2f1de42f72..e1ae905cef33 100644 --- a/svx/source/svdraw/svdpdf.cxx +++ b/svx/source/svdraw/svdpdf.cxx @@ -914,15 +914,13 @@ void ImpSdrPdfImport::ImportImage(std::unique_ptr<vcl::pdf::PDFiumPageObject> co break; } - float left; - float bottom; - float right; - float top; - if (!FPDFPageObj_GetBounds(pPageObject->getPointer(), &left, &bottom, &right, &top)) - { - SAL_WARN("sd.filter", "FAILED to get image bounds"); - } - + basegfx::B2DRectangle aBounds = pPageObject->getBounds(); + float left = aBounds.getMinX(); + // Upside down. + float bottom = aBounds.getMinY(); + float right = aBounds.getMaxX(); + // Upside down. + float top = aBounds.getMaxY(); tools::Rectangle aRect = PointsToLogic(left, right, top, bottom); aRect.AdjustRight(1); aRect.AdjustBottom(1); diff --git a/vcl/qa/cppunit/pdfexport/pdfexport.cxx b/vcl/qa/cppunit/pdfexport/pdfexport.cxx index 7af85573be40..69b7d17711a2 100644 --- a/vcl/qa/cppunit/pdfexport/pdfexport.cxx +++ b/vcl/qa/cppunit/pdfexport/pdfexport.cxx @@ -1535,9 +1535,8 @@ CPPUNIT_TEST_FIXTURE(PdfExportTest, testTdf106702) if (pPageObject->getType() != vcl::pdf::PDFPageObjectType::Image) continue; - float fLeft = 0, fBottom = 0, fRight = 0, fTop = 0; - FPDFPageObj_GetBounds(pPageObject->getPointer(), &fLeft, &fBottom, &fRight, &fTop); - nExpected = fTop; + // Top, but upside down. + nExpected = pPageObject->getBounds().getMaxY(); break; } @@ -1552,9 +1551,8 @@ CPPUNIT_TEST_FIXTURE(PdfExportTest, testTdf106702) if (pPageObject->getType() != vcl::pdf::PDFPageObjectType::Image) continue; - float fLeft = 0, fBottom = 0, fRight = 0, fTop = 0; - FPDFPageObj_GetBounds(pPageObject->getPointer(), &fLeft, &fBottom, &fRight, &fTop); - nActual = fTop; + // Top, but upside down. + nActual = pPageObject->getBounds().getMaxY(); break; } @@ -1593,9 +1591,7 @@ CPPUNIT_TEST_FIXTURE(PdfExportTest, testTdf113143) if (pPageObject->getType() != vcl::pdf::PDFPageObjectType::Image) continue; - float fLeft = 0, fBottom = 0, fRight = 0, fTop = 0; - FPDFPageObj_GetBounds(pPageObject->getPointer(), &fLeft, &fBottom, &fRight, &fTop); - nLarger = fRight - fLeft; + nLarger = pPageObject->getBounds().getWidth(); break; } @@ -1610,9 +1606,7 @@ CPPUNIT_TEST_FIXTURE(PdfExportTest, testTdf113143) if (pPageObject->getType() != vcl::pdf::PDFPageObjectType::Image) continue; - float fLeft = 0, fBottom = 0, fRight = 0, fTop = 0; - FPDFPageObj_GetBounds(pPageObject->getPointer(), &fLeft, &fBottom, &fRight, &fTop); - nSmaller = fRight - fLeft; + nSmaller = pPageObject->getBounds().getWidth(); break; } @@ -1652,8 +1646,8 @@ CPPUNIT_TEST_FIXTURE(PdfExportTest, testTdf115262) for (int i = 0; i < nPageObjectCount; ++i) { std::unique_ptr<vcl::pdf::PDFiumPageObject> pPageObject = pPdfPage->getObject(i); - float fLeft = 0, fBottom = 0, fRight = 0, fTop = 0; - FPDFPageObj_GetBounds(pPageObject->getPointer(), &fLeft, &fBottom, &fRight, &fTop); + // Top, but upside down. + float fTop = pPageObject->getBounds().getMaxY(); if (pPageObject->getType() == vcl::pdf::PDFPageObjectType::Image) { _______________________________________________ Libreoffice-commits mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits
