From 01024ee24c6e89044c68051f6fd5f1264905e90c Mon Sep 17 00:00:00 2001 From: Miklos Vajna Date: Fri, 18 Sep 2020 17:52:41 +0200 Subject: [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. Change-Id: If1d8def0136d408a31a0cc54777a7f26430a0ff3 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/102996 Reviewed-by: Miklos Vajna Tested-by: Jenkins --- svx/source/sdr/properties/defaultproperties.cxx | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) (limited to 'svx/source') diff --git a/svx/source/sdr/properties/defaultproperties.cxx b/svx/source/sdr/properties/defaultproperties.cxx index fb0c4c59369f..e9a9934a9973 100644 --- a/svx/source/sdr/properties/defaultproperties.cxx +++ b/svx/source/sdr/properties/defaultproperties.cxx @@ -30,6 +30,7 @@ #include #include #include +#include namespace sdr::properties { @@ -155,6 +156,21 @@ namespace sdr::properties void DefaultProperties::SetObjectItemSet(const SfxItemSet& rSet) { + if (rSet.HasItem(XATTR_FILLBITMAP)) + { + const XFillBitmapItem* pItem = rSet.GetItem(XATTR_FILLBITMAP); + const std::shared_ptr& pVectorData + = pItem->GetGraphicObject().GetGraphic().getVectorGraphicData(); + if (pVectorData) + { + // Shape is filled by a vector graphic: tell it our size as a hint. + basegfx::B2DTuple aSizeHint; + aSizeHint.setX(GetSdrObject().GetSnapRect().getWidth()); + aSizeHint.setY(GetSdrObject().GetSnapRect().getHeight()); + pVectorData->setSizeHint(aSizeHint); + } + } + SfxWhichIter aWhichIter(rSet); sal_uInt16 nWhich(aWhichIter.FirstWhich()); const SfxPoolItem *pPoolItem; -- cgit