diff options
author | Tomaž Vajngerl <tomaz.vajngerl@collabora.co.uk> | 2021-03-27 10:14:13 +0900 |
---|---|---|
committer | Tomaž Vajngerl <quikee@gmail.com> | 2021-04-02 06:28:39 +0200 |
commit | 88a177f827eba204dea92b631032411de8213ee4 (patch) | |
tree | 3107896970ac35f9fd1cb3804634efdef78c2313 /include/vcl/bitmap.hxx | |
parent | 465b8b0e9ad4b0c9c7701dee2820a99c5d00b5bf (diff) |
vcl: remove GetBitCount and GetColorCount from Bitmap{Ex}
We can cast the PixelFormat enum to int for the same information
and we can use the enum to reduce ambiguity when possible.
Change-Id: I6ea648139465568cdeb12e5f5f75c7b609365bf4
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/113188
Tested-by: Jenkins
Reviewed-by: Tomaž Vajngerl <quikee@gmail.com>
Diffstat (limited to 'include/vcl/bitmap.hxx')
-rw-r--r-- | include/vcl/bitmap.hxx | 14 |
1 files changed, 4 insertions, 10 deletions
diff --git a/include/vcl/bitmap.hxx b/include/vcl/bitmap.hxx index eaec09ad7037..e24e7255a6e0 100644 --- a/include/vcl/bitmap.hxx +++ b/include/vcl/bitmap.hxx @@ -134,8 +134,6 @@ public: Size GetSizePixel() const; vcl::PixelFormat getPixelFormat() const; - sal_uInt16 GetBitCount() const; - inline sal_Int64 GetColorCount() const; inline sal_uLong GetSizeBytes() const; bool HasGreyPalette8Bit() const; bool HasGreyPaletteAny() const; @@ -544,7 +542,6 @@ private: std::shared_ptr<SalBitmap> mxSalBmp; MapMode maPrefMapMode; Size maPrefSize; - }; inline bool Bitmap::IsEmpty() const @@ -572,15 +569,12 @@ inline void Bitmap::SetPrefSize( const Size& rSize ) maPrefSize = rSize; } -inline sal_Int64 Bitmap::GetColorCount() const -{ - return sal_Int64(1) << sal_Int64(GetBitCount()); -} - inline sal_uLong Bitmap::GetSizeBytes() const { - const Size aSizePix( GetSizePixel() ); - return( ( static_cast<sal_uLong>(aSizePix.Width()) * aSizePix.Height() * GetBitCount() ) >> 3 ); + const auto aSizePixel = GetSizePixel(); + const sal_uInt64 aBitCount = vcl::pixelFormatBitCount(getPixelFormat()); + sal_uInt64 aSizeInBytes = (aSizePixel.Width() * aSizePixel.Height() * aBitCount) / 8; + return sal_uLong(aSizeInBytes); } #endif // INCLUDED_VCL_BITMAP_HXX |