diff options
author | Caolán McNamara <caolanm@redhat.com> | 2019-02-06 13:46:24 +0000 |
---|---|---|
committer | Noel Grandin <noel.grandin@collabora.co.uk> | 2019-02-07 19:10:27 +0100 |
commit | 0012f765304a9587d77ccb54bbeeef4e332e5d92 (patch) | |
tree | 27ebdcb1906aa958a259e9ee848180c496107de1 /vcl/inc | |
parent | e9534eddcec78e5f6f551c848fa18f07a298ccfa (diff) |
tdf#123165 cache recently scaled bitmaps for reuse
dropping the cached scaled bitmap when the bitmap
is accesed via BitmapAccessMode::Write for writing
Reviewed-on: https://gerrit.libreoffice.org/67459
Tested-by: Jenkins
Reviewed-by: Caolán McNamara <caolanm@redhat.com>
Tested-by: Caolán McNamara <caolanm@redhat.com>
(cherry picked from commit 9f3926df5c2828ad3e8cfce2b4444b1c84352cf4)
Change-Id: Ib6539522944838238bd699ec3531039d21dc0f8b
Reviewed-on: https://gerrit.libreoffice.org/67492
Tested-by: Jenkins
Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
Diffstat (limited to 'vcl/inc')
-rw-r--r-- | vcl/inc/salbmp.hxx | 2 | ||||
-rw-r--r-- | vcl/inc/svdata.hxx | 4 |
2 files changed, 6 insertions, 0 deletions
diff --git a/vcl/inc/salbmp.hxx b/vcl/inc/salbmp.hxx index 7a89e82e057f..460bb7ec5210 100644 --- a/vcl/inc/salbmp.hxx +++ b/vcl/inc/salbmp.hxx @@ -72,6 +72,8 @@ public: virtual bool ScalingSupported() const = 0; virtual bool Scale( const double& rScaleX, const double& rScaleY, BmpScaleFlag nScaleFlag ) = 0; + void DropScaledCache(); + virtual bool Replace( const Color& rSearchColor, const Color& rReplaceColor, sal_uInt8 nTol ) = 0; virtual bool ConvertToGreyscale() diff --git a/vcl/inc/svdata.hxx b/vcl/inc/svdata.hxx index 5ae913a0dbca..e5c21757a233 100644 --- a/vcl/inc/svdata.hxx +++ b/vcl/inc/svdata.hxx @@ -22,6 +22,7 @@ #include <config_version.h> +#include <o3tl/lru_map.hxx> #include <tools/fldunit.hxx> #include <unotools/options.hxx> #include <vcl/svapp.hxx> @@ -174,6 +175,8 @@ struct ImplSVAppData DECL_LINK(VclEventTestingHdl, Timer*, void); }; +typedef o3tl::lru_map<SalBitmap*, BitmapEx> lru_scale_cache; + struct ImplSVGDIData { ~ImplSVGDIData(); @@ -192,6 +195,7 @@ struct ImplSVGDIData ImplPrnQueueList* mpPrinterQueueList = nullptr; // List of all printer queue std::shared_ptr<PhysicalFontCollection> mxScreenFontList; // Screen-Font-List std::shared_ptr<ImplFontCache> mxScreenFontCache; // Screen-Font-Cache + lru_scale_cache maScaleCache = lru_scale_cache(10); // Cache for scaled images ImplDirectFontSubstitution* mpDirectFontSubst = nullptr; // Font-Substitutions defined in Tools->Options->Fonts GraphicConverter* mpGrfConverter = nullptr; // Converter for graphics long mnAppFontX = 0; // AppFont X-Numenator for 40/tel Width |