From c7af36a6504a192f72fcd3a30712ca8c14e12fa5 Mon Sep 17 00:00:00 2001 From: Miklos Vajna Date: Tue, 25 Feb 2020 11:28:44 +0100 Subject: SVG export: try to reuse original bitmap data for JPG and PNG bitmaps This has a number of benefits: 1) For a sample JPG photo, the SVG output is now 4,9MB, not 20MB. 2) Even the first export to SVG is fast, see commit 570be56b37e4ff105649e604ff4c8a6c368e2e79 (svx: cache PNG export of graphic shapes, 2020-02-25) for exact numbers. 3) Allow using less memory as the SdrGrafObj doesn't have to store a PNG result till the document is closed. We still require matching checksums, so in case anything problematic happens with the bitmap (grayscale filter applied, etc), then the optimization is meant to not help, but still produces correct output. Change-Id: Id3bc359a8dcc4c4d12d3b66ffb512cfa71939a26 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/89419 Reviewed-by: Miklos Vajna Tested-by: Jenkins --- svx/source/svdraw/svdograf.cxx | 22 ---------------------- 1 file changed, 22 deletions(-) (limited to 'svx/source/svdraw/svdograf.cxx') diff --git a/svx/source/svdraw/svdograf.cxx b/svx/source/svdraw/svdograf.cxx index f7c089d2232e..127de6a0c6f5 100644 --- a/svx/source/svdraw/svdograf.cxx +++ b/svx/source/svdraw/svdograf.cxx @@ -1276,26 +1276,4 @@ void SdrGrafObj::addCropHandles(SdrHdlList& rTarget) const rTarget.AddHdl(std::make_unique(Point(basegfx::fround(aPos.getX()), basegfx::fround(aPos.getY())), SdrHdlKind::LowerRight, fShearX, fRotate)); } -void SdrGrafObj::SetPNGPreviewChecksum(BitmapChecksum nPNGPreviewChecksum) -{ - mnPNGPreviewChecksum = nPNGPreviewChecksum; -} - -BitmapChecksum SdrGrafObj::GetPNGPreviewChecksum() const -{ - return mnPNGPreviewChecksum; -} - -void SdrGrafObj::SetPNGPreviewData(SvMemoryStream& rPNGPreviewData) -{ - rPNGPreviewData.Seek(0); - maPNGPreviewData.resize(rPNGPreviewData.remainingSize()); - rPNGPreviewData.ReadBytes(maPNGPreviewData.data(), maPNGPreviewData.size()); -} - -const std::vector& SdrGrafObj::GetPNGPreviewData() const -{ - return maPNGPreviewData; -} - /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ -- cgit v1.2.1