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

Miklos Vajna (via logerrit) logerrit at kemper.freedesktop.org
Wed Dec 16 08:08:01 UTC 2020


 include/vcl/filter/PDFiumLibrary.hxx |   18 +++++-------------
 vcl/source/pdf/PDFiumLibrary.cxx     |   28 +++++++++++++++++++++-------
 2 files changed, 26 insertions(+), 20 deletions(-)

New commits:
commit 3962f6ba4761e2021c8d6b91487259bc16b98671
Author:     Miklos Vajna <vmiklos at collabora.com>
AuthorDate: Tue Dec 15 21:04:16 2020 +0100
Commit:     Miklos Vajna <vmiklos at collabora.com>
CommitDate: Wed Dec 16 09:07:21 2020 +0100

    pdfium: rework to eliminate FPDF_PATHSEGMENT from the public interface
    
    Change-Id: Ibb782d7fe835a001ef13a80afe2f7cf351eda081
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/107793
    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 2acdecac763b..cc6d65c15362 100644
--- a/include/vcl/filter/PDFiumLibrary.hxx
+++ b/include/vcl/filter/PDFiumLibrary.hxx
@@ -119,21 +119,13 @@ public:
 
 class PDFiumTextPage;
 
-class VCL_DLLPUBLIC PDFiumPathSegment final
+class VCL_DLLPUBLIC PDFiumPathSegment
 {
-private:
-    FPDF_PATHSEGMENT mpPathSegment;
-
-    PDFiumPathSegment(const PDFiumPathSegment&) = delete;
-    PDFiumPathSegment& operator=(const PDFiumPathSegment&) = delete;
-
 public:
-    PDFiumPathSegment(FPDF_PATHSEGMENT pPathSegment);
-    ~PDFiumPathSegment();
-
-    basegfx::B2DPoint getPoint() const;
-    bool isClosed() const;
-    PDFSegmentType getType() const;
+    virtual ~PDFiumPathSegment() = default;
+    virtual basegfx::B2DPoint getPoint() const = 0;
+    virtual bool isClosed() const = 0;
+    virtual PDFSegmentType getType() const = 0;
 };
 
 class VCL_DLLPUBLIC PDFiumPageObject final
diff --git a/vcl/source/pdf/PDFiumLibrary.cxx b/vcl/source/pdf/PDFiumLibrary.cxx
index cf435ac419c8..01b1acf1bd1a 100644
--- a/vcl/source/pdf/PDFiumLibrary.cxx
+++ b/vcl/source/pdf/PDFiumLibrary.cxx
@@ -109,6 +109,22 @@ public:
     int getHeight() override;
     PDFBitmapType getFormat() override;
 };
+
+class PDFiumPathSegmentImpl final : public PDFiumPathSegment
+{
+private:
+    FPDF_PATHSEGMENT mpPathSegment;
+
+    PDFiumPathSegmentImpl(const PDFiumPathSegmentImpl&) = delete;
+    PDFiumPathSegmentImpl& operator=(const PDFiumPathSegmentImpl&) = delete;
+
+public:
+    PDFiumPathSegmentImpl(FPDF_PATHSEGMENT pPathSegment);
+
+    basegfx::B2DPoint getPoint() const override;
+    bool isClosed() const override;
+    PDFSegmentType getType() const override;
+};
 }
 
 OUString convertPdfDateToISO8601(OUString const& rInput)
@@ -568,7 +584,7 @@ std::unique_ptr<PDFiumPathSegment> PDFiumPageObject::getPathSegment(int index)
     FPDF_PATHSEGMENT pPathSegment = FPDFPath_GetPathSegment(mpPageObject, index);
     if (pPathSegment)
     {
-        pPDFiumPathSegment = std::make_unique<PDFiumPathSegment>(pPathSegment);
+        pPDFiumPathSegment = std::make_unique<PDFiumPathSegmentImpl>(pPathSegment);
     }
     return pPDFiumPathSegment;
 }
@@ -632,14 +648,12 @@ double PDFiumPage::getHeight() { return FPDF_GetPageHeight(mpPage); }
 
 bool PDFiumPage::hasTransparency() { return FPDFPage_HasTransparency(mpPage); }
 
-PDFiumPathSegment::PDFiumPathSegment(FPDF_PATHSEGMENT pPathSegment)
+PDFiumPathSegmentImpl::PDFiumPathSegmentImpl(FPDF_PATHSEGMENT pPathSegment)
     : mpPathSegment(pPathSegment)
 {
 }
 
-PDFiumPathSegment::~PDFiumPathSegment() {}
-
-basegfx::B2DPoint PDFiumPathSegment::getPoint() const
+basegfx::B2DPoint PDFiumPathSegmentImpl::getPoint() const
 {
     basegfx::B2DPoint aPoint;
     float fx, fy;
@@ -648,9 +662,9 @@ basegfx::B2DPoint PDFiumPathSegment::getPoint() const
     return aPoint;
 }
 
-bool PDFiumPathSegment::isClosed() const { return FPDFPathSegment_GetClose(mpPathSegment); }
+bool PDFiumPathSegmentImpl::isClosed() const { return FPDFPathSegment_GetClose(mpPathSegment); }
 
-PDFSegmentType PDFiumPathSegment::getType() const
+PDFSegmentType PDFiumPathSegmentImpl::getType() const
 {
     return static_cast<PDFSegmentType>(FPDFPathSegment_GetType(mpPathSegment));
 }


More information about the Libreoffice-commits mailing list