[Libreoffice-commits] core.git: include/vcl vcl/source
Miklos Vajna (via logerrit)
logerrit at kemper.freedesktop.org
Wed Oct 28 09:56:31 UTC 2020
include/vcl/filter/PDFiumLibrary.hxx | 4 +++-
vcl/source/filter/ipdf/pdfread.cxx | 4 ++--
vcl/source/pdf/PDFiumLibrary.cxx | 7 +++++++
3 files changed, 12 insertions(+), 3 deletions(-)
New commits:
commit 49a39d1abccc61b6dace3e92059ae50a6a2c298d
Author: Miklos Vajna <vmiklos at collabora.com>
AuthorDate: Wed Oct 28 08:37:32 2020 +0100
Commit: Miklos Vajna <vmiklos at collabora.com>
CommitDate: Wed Oct 28 10:55:45 2020 +0100
pdfium: add an FPDF_RenderPageBitmap() wrapper
Change-Id: I2238aeb4b2f7483440ded2600a328436f861f178
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/104917
Reviewed-by: Miklos Vajna <vmiklos at collabora.com>
Tested-by: Jenkins
diff --git a/include/vcl/filter/PDFiumLibrary.hxx b/include/vcl/filter/PDFiumLibrary.hxx
index 43cbdb2f9a12..84cfccae2aa2 100644
--- a/include/vcl/filter/PDFiumLibrary.hxx
+++ b/include/vcl/filter/PDFiumLibrary.hxx
@@ -62,6 +62,8 @@ public:
std::unique_ptr<PDFiumBitmap> createBitmap(int nWidth, int nHeight, int nAlpha);
};
+class PDFiumPage;
+
class VCL_DLLPUBLIC PDFiumBitmap final
{
private:
@@ -75,6 +77,7 @@ public:
~PDFiumBitmap();
FPDF_BITMAP getPointer() { return mpBitmap; }
void fillRect(int left, int top, int width, int height, sal_uInt32 nColor);
+ void renderPageBitmap(PDFiumPage* pPage, int nStartX, int nStartY, int nSizeX, int nSizeY);
};
class VCL_DLLPUBLIC PDFiumAnnotation final
@@ -109,7 +112,6 @@ public:
std::vector<basegfx::B2DPoint> getLineGeometry();
};
-class PDFiumPage;
class PDFiumTextPage;
class VCL_DLLPUBLIC PDFiumPathSegment final
diff --git a/vcl/source/filter/ipdf/pdfread.cxx b/vcl/source/filter/ipdf/pdfread.cxx
index 3e0207e86bd5..c027acb38777 100644
--- a/vcl/source/filter/ipdf/pdfread.cxx
+++ b/vcl/source/filter/ipdf/pdfread.cxx
@@ -180,8 +180,8 @@ size_t RenderPDFBitmaps(const void* pBuffer, int nSize, std::vector<BitmapEx>& r
}
const sal_uInt32 nColor = bTransparent ? 0x00000000 : 0xFFFFFFFF;
pPdfBitmap->fillRect(0, 0, nPageWidth, nPageHeight, nColor);
- FPDF_RenderPageBitmap(pPdfBitmap->getPointer(), pPdfPage->getPointer(), /*start_x=*/0,
- /*start_y=*/0, nPageWidth, nPageHeight, /*rotate=*/0, /*flags=*/0);
+ pPdfBitmap->renderPageBitmap(pPdfPage.get(), /*start_x=*/0,
+ /*start_y=*/0, nPageWidth, nPageHeight);
// Save the buffer as a bitmap.
Bitmap aBitmap(Size(nPageWidth, nPageHeight), 24);
diff --git a/vcl/source/pdf/PDFiumLibrary.cxx b/vcl/source/pdf/PDFiumLibrary.cxx
index 607ad7ab9d2c..c3deee13d889 100644
--- a/vcl/source/pdf/PDFiumLibrary.cxx
+++ b/vcl/source/pdf/PDFiumLibrary.cxx
@@ -503,6 +503,13 @@ void PDFiumBitmap::fillRect(int left, int top, int width, int height, sal_uInt32
FPDFBitmap_FillRect(mpBitmap, left, top, width, height, nColor);
}
+void PDFiumBitmap::renderPageBitmap(PDFiumPage* pPage, int nStartX, int nStartY, int nSizeX,
+ int nSizeY)
+{
+ FPDF_RenderPageBitmap(mpBitmap, pPage->getPointer(), nStartX, nStartY, nSizeX, nSizeY,
+ /*rotate=*/0, /*flags=*/0);
+}
+
PDFiumAnnotation::PDFiumAnnotation(FPDF_ANNOTATION pAnnotation)
: mpAnnotation(pAnnotation)
{
More information about the Libreoffice-commits
mailing list