[Libreoffice-commits] core.git: include/vcl svx/source vcl/source

Miklos Vajna (via logerrit) logerrit at kemper.freedesktop.org
Thu Jan 14 08:11:15 UTC 2021


 include/vcl/filter/PDFiumLibrary.hxx |    1 +
 svx/source/svdraw/svdpdf.cxx         |   13 +++----------
 vcl/source/pdf/PDFiumLibrary.cxx     |    7 +++++++
 3 files changed, 11 insertions(+), 10 deletions(-)

New commits:
commit 06322b0922972fec4b9e5f57e8dbab18ca9bd676
Author:     Miklos Vajna <vmiklos at collabora.com>
AuthorDate: Wed Jan 13 21:30:24 2021 +0100
Commit:     Miklos Vajna <vmiklos at collabora.com>
CommitDate: Thu Jan 14 09:10:34 2021 +0100

    pdfium: add an FPDFPageObj_GetStrokeWidth() wrapper
    
    Change-Id: If411b788b3ea07c29377e01052ee6a48893ca482
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/109250
    Tested-by: Jenkins
    Reviewed-by: Miklos Vajna <vmiklos at collabora.com>

diff --git a/include/vcl/filter/PDFiumLibrary.hxx b/include/vcl/filter/PDFiumLibrary.hxx
index aff5ad6ad8af..eee97e39bf9a 100644
--- a/include/vcl/filter/PDFiumLibrary.hxx
+++ b/include/vcl/filter/PDFiumLibrary.hxx
@@ -148,6 +148,7 @@ public:
     PDFTextRenderMode getTextRenderMode();
     Color getFillColor();
     Color getStrokeColor();
+    double getStrokeWidth();
     // Path
     int getPathSegmentCount();
     std::unique_ptr<PDFiumPathSegment> getPathSegment(int index);
diff --git a/svx/source/svdraw/svdpdf.cxx b/svx/source/svdraw/svdpdf.cxx
index 00969a90904c..e266609bd295 100644
--- a/svx/source/svdraw/svdpdf.cxx
+++ b/svx/source/svdraw/svdpdf.cxx
@@ -1007,8 +1007,7 @@ void ImpSdrPdfImport::ImportPath(std::unique_ptr<vcl::pdf::PDFiumPageObject> con
         basegfx::utils::createScaleTranslateB2DHomMatrix(mfScaleX, mfScaleY, maOfs.X(), maOfs.Y()));
     aPolyPoly.transform(aTransform);
 
-    float fWidth = 1;
-    FPDFPageObj_GetStrokeWidth(pPageObject->getPointer(), &fWidth);
+    float fWidth = pPageObject->getStrokeWidth();
     const double dWidth = 0.5 * fabs(sqrt2(aPathMatrix.a(), aPathMatrix.c()) * fWidth);
     mnLineWidth = convertPointToMm100(dWidth);
 
@@ -1024,17 +1023,11 @@ void ImpSdrPdfImport::ImportPath(std::unique_ptr<vcl::pdf::PDFiumPageObject> con
             mpVD->SetDrawMode(DrawModeFlags::NoFill);
     }
 
-    unsigned int nR;
-    unsigned int nG;
-    unsigned int nB;
-    unsigned int nA;
-    FPDFPageObj_GetFillColor(pPageObject->getPointer(), &nR, &nG, &nB, &nA);
-    mpVD->SetFillColor(Color(nR, nG, nB));
+    mpVD->SetFillColor(pPageObject->getFillColor());
 
     if (bStroke)
     {
-        FPDFPageObj_GetStrokeColor(pPageObject->getPointer(), &nR, &nG, &nB, &nA);
-        mpVD->SetLineColor(Color(nR, nG, nB));
+        mpVD->SetLineColor(pPageObject->getStrokeColor());
     }
     else
         mpVD->SetLineColor(COL_TRANSPARENT);
diff --git a/vcl/source/pdf/PDFiumLibrary.cxx b/vcl/source/pdf/PDFiumLibrary.cxx
index 3165f669f41d..755c19684183 100644
--- a/vcl/source/pdf/PDFiumLibrary.cxx
+++ b/vcl/source/pdf/PDFiumLibrary.cxx
@@ -666,6 +666,13 @@ Color PDFiumPageObject::getStrokeColor()
     return aColor;
 }
 
+double PDFiumPageObject::getStrokeWidth()
+{
+    float fWidth = 1;
+    FPDFPageObj_GetStrokeWidth(mpPageObject, &fWidth);
+    return fWidth;
+}
+
 int PDFiumPageObject::getPathSegmentCount() { return FPDFPath_CountSegments(mpPageObject); }
 
 std::unique_ptr<PDFiumPathSegment> PDFiumPageObject::getPathSegment(int index)


More information about the Libreoffice-commits mailing list