summaryrefslogtreecommitdiff
path: root/svx/source/svdraw/svdograf.cxx
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:03:10 +0100
commit570be56b37e4ff105649e604ff4c8a6c368e2e79 (patch)
tree1c27a73f269ce4c7d548f3d2455f9c350ad21182 /svx/source/svdraw/svdograf.cxx
parentd0487363753960faccb8ba464414e18786dcd915 (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.) Change-Id: I7204b04efeeb42c6eec67f04dfdb8a4ed50443a9 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/89377 Reviewed-by: Miklos Vajna <vmiklos@collabora.com> Tested-by: Jenkins
Diffstat (limited to 'svx/source/svdraw/svdograf.cxx')
-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 127de6a0c6f5..f7c089d2232e 100644
--- a/svx/source/svdraw/svdograf.cxx
+++ b/svx/source/svdraw/svdograf.cxx
@@ -1276,4 +1276,26 @@ void SdrGrafObj::addCropHandles(SdrHdlList& rTarget) const
rTarget.AddHdl(std::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: */