summaryrefslogtreecommitdiff
path: root/vcl/inc/image.h
diff options
context:
space:
mode:
authorTomaž Vajngerl <tomaz.vajngerl@collabora.co.uk>2019-04-12 11:11:13 +0900
committerTomaž Vajngerl <quikee@gmail.com>2019-04-12 13:56:53 +0200
commit812f0a83d223cddf00b121db40ca7ff91c22ccfa (patch)
tree8137fdfbac1f3c50bcd5b55ef66cd036aef0e455 /vcl/inc/image.h
parented437865a0db175e45ff421d50f429dff421d0cf (diff)
internally resize image instead of scaling bitmaps outside
When we want a different size Image, we can now set that as a parameter at construction of the Image. Previously we needed to create an Image, forcefully take the bitmap out, resize the bitmap and create a new Image out of that. Doing it internally gives us the benefit to have a more control over the scaling process, especially when dealing with HiDPI images. Change-Id: I104118f4d863d519cc7aad1a17ca0289c01ed9ff Reviewed-on: https://gerrit.libreoffice.org/70617 Tested-by: Jenkins Reviewed-by: Tomaž Vajngerl <quikee@gmail.com>
Diffstat (limited to 'vcl/inc/image.h')
-rw-r--r--vcl/inc/image.h24
1 files changed, 18 insertions, 6 deletions
diff --git a/vcl/inc/image.h b/vcl/inc/image.h
index c9fb5393191a..c5acc06f782a 100644
--- a/vcl/inc/image.h
+++ b/vcl/inc/image.h
@@ -25,22 +25,31 @@
#include <unordered_map>
#include <vector>
-struct ImplImage
+class ImplImage
{
+private:
BitmapChecksum maBitmapChecksum;
/// if non-empty: cached original size of maStockName else Size of maBitmap
- Size maSizePixel;
+ Size maSizePixel;
+ Size maPreferedSizePixel;
/// If set - defines the bitmap via images.zip*
OUString maStockName;
+
/// Original bitmap - or cache of a potentially scaled bitmap
BitmapEx maBitmapEx;
BitmapEx maDisabledBitmapEx;
+ bool loadStockAtScale(double fScale, BitmapEx &rBitmapEx);
+
+public:
ImplImage(const BitmapEx& rBitmapEx);
- ImplImage(const OUString &aStockName);
+ ImplImage(const OUString &aStockName, Size const & rPreferedSize);
- bool isStock() const { return maStockName.getLength() > 0; }
+ bool isStock() const
+ {
+ return maStockName.getLength() > 0;
+ }
/// get size in co-ordinates not scaled for HiDPI
Size getSizePixel();
@@ -48,9 +57,12 @@ struct ImplImage
BitmapEx getBitmapEx(bool bDisabled = false);
/// Taking account of HiDPI scaling
BitmapEx getBitmapExForHiDPI(bool bDisabled = false);
+
bool isEqual(const ImplImage &ref) const;
- bool isSizeEmpty() const { return maSizePixel == Size(0, 0); }
- bool loadStockAtScale(double fScale, BitmapEx &rBitmapEx);
+ bool isSizeEmpty() const
+ {
+ return maSizePixel == Size();
+ }
};
#endif // INCLUDED_VCL_INC_IMAGE_H