summaryrefslogtreecommitdiff
path: root/svx
diff options
context:
space:
mode:
authorMiklos Vajna <vmiklos@collabora.com>2020-02-25 09:04:10 +0100
committerMiklos Vajna <vmiklos@collabora.com>2020-02-25 10:59:18 +0100
commit22394a468eb8d594501e443bdb84608b6552a8a1 (patch)
tree7b208686c007b7912b22fa5d84768d2ff1870dbb /svx
parent968fe71f654937727e0708d1070ffabf90b9e527 (diff)
svx: cache PNG export of graphic shapes
One scenario where this is useful is: manipulate a JPEG photo in Online's Impress, e.g. resize it multiple times. Each time we generate an SVG preview of the shape, which includes the PNG export of the bitmap itself. This helps with a desktop CPU: debug:9976:9974: SVGFilter::filter finished in 3422 ms debug:9976:9974: SVGFilter::filter finished in 176 ms But it is meant to help on mobile, too, where writing such a bitmap as PNG takes 16-17 seconds without this. (This works because SVG writes the original bitmap, even if it's scaled. If that invariant will be broken in the future, we still emit correct output, but then the cache will be less useful.) Conflicts: filter/source/svg/svgwriter.cxx include/svx/svdograf.hxx include/svx/unoshape.hxx Change-Id: I7204b04efeeb42c6eec67f04dfdb8a4ed50443a9 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/89411 Tested-by: Jenkins CollaboraOffice <jenkinscollaboraoffice@gmail.com> Reviewed-by: Miklos Vajna <vmiklos@collabora.com>
Diffstat (limited to 'svx')
-rw-r--r--svx/source/svdraw/svdograf.cxx22
1 files changed, 22 insertions, 0 deletions
diff --git a/svx/source/svdraw/svdograf.cxx b/svx/source/svdraw/svdograf.cxx
index 0e4413b3764f..b68aec25b2a3 100644
--- a/svx/source/svdraw/svdograf.cxx
+++ b/svx/source/svdraw/svdograf.cxx
@@ -1265,4 +1265,26 @@ void SdrGrafObj::addCropHandles(SdrHdlList& rTarget) const
rTarget.AddHdl(o3tl::make_unique<SdrCropHdl>(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<sal_Int8>& SdrGrafObj::GetPNGPreviewData() const
+{
+ return maPNGPreviewData;
+}
+
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */