diff options
author | Miklos Vajna <vmiklos@collabora.com> | 2020-02-25 09:04:10 +0100 |
---|---|---|
committer | Miklos Vajna <vmiklos@collabora.com> | 2020-02-25 10:03:10 +0100 |
commit | 570be56b37e4ff105649e604ff4c8a6c368e2e79 (patch) | |
tree | 1c27a73f269ce4c7d548f3d2455f9c350ad21182 /include | |
parent | d0487363753960faccb8ba464414e18786dcd915 (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 'include')
-rw-r--r-- | include/svx/svdograf.hxx | 9 | ||||
-rw-r--r-- | include/svx/unoshape.hxx | 2 |
2 files changed, 10 insertions, 1 deletions
diff --git a/include/svx/svdograf.hxx b/include/svx/svdograf.hxx index 8944db82bc2d..098ae70d73a2 100644 --- a/include/svx/svdograf.hxx +++ b/include/svx/svdograf.hxx @@ -29,6 +29,7 @@ #include <vcl/GraphicObject.hxx> #include <svx/svxdllapi.h> #include <o3tl/typed_flags_set.hxx> +#include <tools/stream.hxx> #include <memory> #include <cstddef> @@ -122,6 +123,9 @@ private: void onGraphicChanged(); GDIMetaFile GetMetaFile(GraphicType &rGraphicType) const; + BitmapChecksum mnPNGPreviewChecksum = 0; + std::vector<sal_Int8> maPNGPreviewData; + protected: // protected destructor virtual ~SdrGrafObj() override; @@ -297,6 +301,11 @@ public: { return mpQrCode.get(); }; + + void SetPNGPreviewChecksum(BitmapChecksum nPNGPreviewChecksum); + BitmapChecksum GetPNGPreviewChecksum() const; + void SetPNGPreviewData(SvMemoryStream& rPNGPreviewData); + const std::vector<sal_Int8>& GetPNGPreviewData() const; }; #endif // INCLUDED_SVX_SVDOGRAF_HXX diff --git a/include/svx/unoshape.hxx b/include/svx/unoshape.hxx index 7c6b60291886..27c767d5e819 100644 --- a/include/svx/unoshape.hxx +++ b/include/svx/unoshape.hxx @@ -641,7 +641,7 @@ public: * * ***********************************************************************/ -class SvxGraphicObject final : public SvxShapeText +class SVXCORE_DLLPUBLIC SvxGraphicObject final : public SvxShapeText { using SvxUnoTextRangeBase::setPropertyValue; using SvxUnoTextRangeBase::getPropertyValue; |