summaryrefslogtreecommitdiff
path: root/include
diff options
context:
space:
mode:
authorMiklos Vajna <vmiklos@collabora.com>2020-09-18 17:52:41 +0200
committerMiklos Vajna <vmiklos@collabora.com>2020-09-22 09:00:27 +0200
commitef9b9de57c42ef91c47b1362804bd2be7ba1ae09 (patch)
treed3ef94a615900c3e10e27d3f3adf3b3a564aaf0a /include
parentbfb559d04a08d2a8ebb90d04772c0321e2aaf1dc (diff)
[API CHANGE] tdf#136836 emfio: set size hint on inner PDF if used as shape fill
The bugdoc has a shape, its bitmap fill is an EMF, which is actually a PDF. The PDF is has a height of 5cm, but the shape has a height of 14 cm. Inform vcl::RenderPDFBitmaps() about the size of the shape, so the result won't be blurry. This approach makes sure that we don't unconditionally render at higher resolution, i.e. the "load a PDF of 100 pages into Online" use-case won't use more memory than before. API CHANGE, because the EMF reader is only available via UNO, though it's likely that no actual external code would ever invoke it directly. (cherry picked from commit 01024ee24c6e89044c68051f6fd5f1264905e90c) Conflicts: emfio/qa/cppunit/emf/EmfImportTest.cxx include/vcl/pdfread.hxx include/vcl/vectorgraphicdata.hxx vcl/source/gdi/vectorgraphicdata.cxx Change-Id: If1d8def0136d408a31a0cc54777a7f26430a0ff3 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/103101 Tested-by: Jenkins CollaboraOffice <jenkinscollaboraoffice@gmail.com> Reviewed-by: Miklos Vajna <vmiklos@collabora.com>
Diffstat (limited to 'include')
-rw-r--r--include/vcl/pdfread.hxx3
-rw-r--r--include/vcl/vectorgraphicdata.hxx10
2 files changed, 12 insertions, 1 deletions
diff --git a/include/vcl/pdfread.hxx b/include/vcl/pdfread.hxx
index f1534c326ee6..69fec6241f23 100644
--- a/include/vcl/pdfread.hxx
+++ b/include/vcl/pdfread.hxx
@@ -16,6 +16,7 @@
#include <vcl/graph.hxx>
#include <basegfx/range/b2drectangle.hxx>
#include <com/sun/star/util/DateTime.hpp>
+#include <basegfx/tuple/b2dtuple.hxx>
namespace com::sun::star::uno
{
@@ -28,7 +29,7 @@ namespace vcl
/// Fills the rBitmaps vector with rendered pages.
VCL_DLLPUBLIC size_t RenderPDFBitmaps(const void* pBuffer, int nSize, std::vector<Bitmap>& rBitmaps,
size_t nFirstPage = 0, int nPages = 1,
- double fResolutionDPI = 96.);
+ const basegfx::B2DTuple* pSizeHint = nullptr);
/// Imports a PDF stream into rGraphic as VectorGraphicData.
VCL_DLLPUBLIC bool ImportPDF(SvStream& rStream, Graphic& rGraphic);
diff --git a/include/vcl/vectorgraphicdata.hxx b/include/vcl/vectorgraphicdata.hxx
index e81fd9d204fa..e671a17a26e0 100644
--- a/include/vcl/vectorgraphicdata.hxx
+++ b/include/vcl/vectorgraphicdata.hxx
@@ -74,6 +74,9 @@ private:
// If the vector format has more pages this denotes which page to render
sal_Int32 mnPageIndex;
+ /// Useful for PDF, which is vector-based, but still rendered to a bitmap.
+ basegfx::B2DTuple maSizeHint;
+
// on demand creators
void ensurePdfReplacement();
void ensureReplacement();
@@ -118,6 +121,13 @@ public:
mnPageIndex = nPageIndex;
}
+ void setSizeHint(const basegfx::B2DTuple& rSizeHint)
+ {
+ maSizeHint = rSizeHint;
+ }
+
+ const basegfx::B2DTuple& getSizeHint() const { return maSizeHint; }
+
bool isPrimitiveSequenceCreated() const { return mbSequenceCreated; }
};