diff options
author | Tomaž Vajngerl <tomaz.vajngerl@collabora.co.uk> | 2021-03-13 12:00:28 +0900 |
---|---|---|
committer | Tomaž Vajngerl <quikee@gmail.com> | 2021-03-13 12:17:49 +0100 |
commit | 68bc6a5dd68006ab86e7ef26f9e5d241cb118879 (patch) | |
tree | debd00d1a05228759974b2d09666dfcccb379ab3 /include/vcl/bitmap.hxx | |
parent | a73f24f47aea2dfa57459424f48b11b2b835e334 (diff) |
add PixelFormat enum that replaces bit count in Bitmap/BitmapEx
Bit count for the image is a numeric value (sal_uInt16) but only
a handful of values make sense - namely 1,4,8,24 and 32. This
replaces the numeric value with an enum, which only accepts those
values and checks the correct values are used at compile time.
Change-Id: I0fc137c62bce3b0d021f05019a1648da628521bc
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/112408
Tested-by: Jenkins
Reviewed-by: Tomaž Vajngerl <quikee@gmail.com>
Diffstat (limited to 'include/vcl/bitmap.hxx')
-rw-r--r-- | include/vcl/bitmap.hxx | 8 |
1 files changed, 5 insertions, 3 deletions
diff --git a/include/vcl/bitmap.hxx b/include/vcl/bitmap.hxx index d9d6c81d7661..3a2baf9e24c7 100644 --- a/include/vcl/bitmap.hxx +++ b/include/vcl/bitmap.hxx @@ -27,6 +27,7 @@ #include <vcl/mapmod.hxx> #include <vcl/region.hxx> #include <vcl/scopedbitmapaccess.hxx> +#include <vcl/bitmap/BitmapTypes.hxx> #include <o3tl/typed_flags_set.hxx> @@ -114,7 +115,7 @@ public: Bitmap(); Bitmap( const Bitmap& rBitmap ); - Bitmap( const Size& rSizePixel, sal_uInt16 nBitCount, const BitmapPalette* pPal = nullptr ); + Bitmap( const Size& rSizePixel, vcl::PixelFormat ePixelFormat, const BitmapPalette* pPal = nullptr ); explicit Bitmap( std::shared_ptr<SalBitmap> const & xSalBitmap ); virtual ~Bitmap(); @@ -135,6 +136,7 @@ public: Size GetSizePixel() const; + vcl::PixelFormat getPixelFormat() const; sal_uInt16 GetBitCount() const; inline sal_Int64 GetColorCount() const; inline sal_uLong GetSizeBytes() const; @@ -538,8 +540,8 @@ public: typedef vcl::ScopedBitmapAccess<BitmapInfoAccess, Bitmap, &Bitmap::AcquireInfoAccess> ScopedInfoAccess; private: - SAL_DLLPRIVATE bool ImplConvertUp(sal_uInt16 nBitCount, Color const* pExtColor = nullptr); - SAL_DLLPRIVATE bool ImplConvertDown(sal_uInt16 nBitCount, Color const* pExtColor = nullptr); + SAL_DLLPRIVATE bool ImplConvertUp(vcl::PixelFormat ePixelFormat, Color const* pExtColor = nullptr); + SAL_DLLPRIVATE bool ImplConvertDown(vcl::PixelFormat ePixelFormat, Color const* pExtColor = nullptr); private: std::shared_ptr<SalBitmap> mxSalBmp; |