summaryrefslogtreecommitdiff
path: root/vcl/source
diff options
context:
space:
mode:
authorMiklos Vajna <vmiklos@collabora.co.uk>2018-05-02 17:22:30 +0200
committerCaolán McNamara <caolanm@redhat.com>2018-05-04 17:27:31 +0200
commite0ae55f7cefe74039f8ade1696d1861e90d73c04 (patch)
treea3a2218925b03b3a8aab2daf3e0e098d939a0425 /vcl/source
parent46b49b0f3f539d9a8645c6447a8c4b2e0b463cac (diff)
tdf#109143 PDF export: don't reuse compressed bitmaps for cropped images
PDF wants to loose the pixels masked out by cropping, so the "reuse original compressed image" optimization should not be used in that case. (cherry picked from commit be3ef7b0e5e51c1d97309ce3b6d5cac1fbd025d0) Conflicts: vcl/source/gdi/pdfextoutdevdata.cxx Change-Id: Ifdf2cc4ff6bff0ed456a2159395314817c1cf417 Reviewed-on: https://gerrit.libreoffice.org/53772 Tested-by: Jenkins <ci@libreoffice.org> Reviewed-by: Caolán McNamara <caolanm@redhat.com> Tested-by: Caolán McNamara <caolanm@redhat.com>
Diffstat (limited to 'vcl/source')
-rw-r--r--vcl/source/gdi/pdfextoutdevdata.cxx12
1 files changed, 9 insertions, 3 deletions
diff --git a/vcl/source/gdi/pdfextoutdevdata.cxx b/vcl/source/gdi/pdfextoutdevdata.cxx
index 8974c6f5a645..71ef583cda58 100644
--- a/vcl/source/gdi/pdfextoutdevdata.cxx
+++ b/vcl/source/gdi/pdfextoutdevdata.cxx
@@ -404,13 +404,13 @@ bool PageSyncData::PlaySyncPageAct( PDFWriter& rWriter, sal_uInt32& rCurGDIMtfAc
GfxLinkType eType = rGraphic.GetLink().GetType();
if ( eType == GfxLinkType::NativeJpg )
{
- mbGroupIgnoreGDIMtfActions = rOutDevData.HasAdequateCompression(rGraphic);
+ mbGroupIgnoreGDIMtfActions = rOutDevData.HasAdequateCompression(rGraphic, mParaRects[0], mParaRects[1]);
if ( !mbGroupIgnoreGDIMtfActions )
mCurrentGraphic = rGraphic;
}
else if ( eType == GfxLinkType::NativePng || eType == GfxLinkType::NativePdf )
{
- if ( eType == GfxLinkType::NativePdf || rOutDevData.HasAdequateCompression(rGraphic) )
+ if ( eType == GfxLinkType::NativePdf || rOutDevData.HasAdequateCompression(rGraphic, mParaRects[0], mParaRects[1]) )
mCurrentGraphic = rGraphic;
}
}
@@ -797,13 +797,19 @@ void PDFExtOutDevData::EndGroup( const Graphic& rGraphic,
}
// Avoids expensive de-compression and re-compression of large images.
-bool PDFExtOutDevData::HasAdequateCompression( const Graphic &rGraphic ) const
+bool PDFExtOutDevData::HasAdequateCompression( const Graphic &rGraphic,
+ const tools::Rectangle & rOutputRect,
+ const tools::Rectangle & rVisibleOutputRect ) const
{
assert(rGraphic.IsLink() &&
(rGraphic.GetLink().GetType() == GfxLinkType::NativeJpg ||
rGraphic.GetLink().GetType() == GfxLinkType::NativePng ||
rGraphic.GetLink().GetType() == GfxLinkType::NativePdf));
+ if (rOutputRect != rVisibleOutputRect)
+ // rOutputRect is the crop rectangle, re-compress cropped image.
+ return false;
+
if (rGraphic.GetLink().GetDataSize() == 0)
return false;