diff options
author | Tomaž Vajngerl <tomaz.vajngerl@collabora.co.uk> | 2021-04-05 22:34:32 +0900 |
---|---|---|
committer | Tomaž Vajngerl <quikee@gmail.com> | 2021-04-06 08:40:35 +0200 |
commit | e992f5c53aadbbfdf93a45f4011fc8733315585f (patch) | |
tree | 3f9d085b98465bc932b36db79f8a65343ee3954a /vcl/inc | |
parent | 615ceb107e9faf01b568b0a2440a3f09c8f88ca6 (diff) |
vcl: use PixelFormat enum in SalBitmap interface and backends
This changes all backends to use PixelFormat as the input to
the SalBitmap::Create method (and all the backends). This is the
first part as we need to make sure to also limit the use of
GetBitCount method and also use of it in SalGraphics.
Change-Id: I8d2b6adfcb8fe3dd78010538411f338c9a1c3996
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/113603
Tested-by: Jenkins
Reviewed-by: Tomaž Vajngerl <quikee@gmail.com>
Diffstat (limited to 'vcl/inc')
-rw-r--r-- | vcl/inc/headless/svpbmp.hxx | 10 | ||||
-rw-r--r-- | vcl/inc/qt5/Qt5Bitmap.hxx | 4 | ||||
-rw-r--r-- | vcl/inc/qt5/Qt5Tools.hxx | 13 | ||||
-rw-r--r-- | vcl/inc/quartz/salbmp.h | 4 | ||||
-rw-r--r-- | vcl/inc/salbmp.hxx | 5 | ||||
-rw-r--r-- | vcl/inc/skia/salbmp.hxx | 4 | ||||
-rw-r--r-- | vcl/inc/unx/salbmp.h | 6 | ||||
-rw-r--r-- | vcl/inc/win/salbmp.h | 6 |
8 files changed, 27 insertions, 25 deletions
diff --git a/vcl/inc/headless/svpbmp.hxx b/vcl/inc/headless/svpbmp.hxx index 1551fc844a82..2c347372a4d4 100644 --- a/vcl/inc/headless/svpbmp.hxx +++ b/vcl/inc/headless/svpbmp.hxx @@ -33,14 +33,14 @@ public: virtual ~SvpSalBitmap() override; // SalBitmap - virtual bool Create( const Size& rSize, - sal_uInt16 nBitCount, - const BitmapPalette& rPal ) override; + virtual bool Create(const Size& rSize, + vcl::PixelFormat ePixelFormat, + const BitmapPalette& rPalette) override; virtual bool Create( const SalBitmap& rSalBmp ) override; virtual bool Create( const SalBitmap& rSalBmp, SalGraphics* pGraphics ) override; - virtual bool Create( const SalBitmap& rSalBmp, - sal_uInt16 nNewBitCount ) override; + virtual bool Create(const SalBitmap& rSalBmp, + vcl::PixelFormat eNewPixelFormat) override; virtual bool Create( const css::uno::Reference< css::rendering::XBitmapCanvas >& rBitmapCanvas, Size& rSize, bool bMask = false ) override; diff --git a/vcl/inc/qt5/Qt5Bitmap.hxx b/vcl/inc/qt5/Qt5Bitmap.hxx index 201742ef39cd..d01966dab85b 100644 --- a/vcl/inc/qt5/Qt5Bitmap.hxx +++ b/vcl/inc/qt5/Qt5Bitmap.hxx @@ -37,11 +37,11 @@ public: const QImage* GetQImage() const { return m_pImage.get(); } - virtual bool Create(const Size& rSize, sal_uInt16 nBitCount, + virtual bool Create(const Size& rSize, vcl::PixelFormat ePixelFormat, const BitmapPalette& rPal) override; virtual bool Create(const SalBitmap& rSalBmp) override; virtual bool Create(const SalBitmap& rSalBmp, SalGraphics* pGraphics) override; - virtual bool Create(const SalBitmap& rSalBmp, sal_uInt16 nNewBitCount) override; + virtual bool Create(const SalBitmap& rSalBmp, vcl::PixelFormat eNewPixelFormat) override; virtual bool Create(const css::uno::Reference<css::rendering::XBitmapCanvas>& rBitmapCanvas, Size& rSize, bool bMask = false) override; virtual void Destroy() final override; diff --git a/vcl/inc/qt5/Qt5Tools.hxx b/vcl/inc/qt5/Qt5Tools.hxx index b7e4089e6f52..f9b73b30c7c7 100644 --- a/vcl/inc/qt5/Qt5Tools.hxx +++ b/vcl/inc/qt5/Qt5Tools.hxx @@ -29,6 +29,7 @@ #include <rtl/ustring.hxx> #include <tools/color.hxx> #include <tools/gen.hxx> +#include <vcl/bitmap/BitmapTypes.hxx> #include <com/sun/star/uno/Sequence.hxx> #include <com/sun/star/datatransfer/dnd/DNDConstants.hpp> @@ -99,17 +100,17 @@ inline QList<int> toQList(const css::uno::Sequence<sal_Int32>& aSequence) constexpr QImage::Format Qt5_DefaultFormat32 = QImage::Format_ARGB32; -inline QImage::Format getBitFormat(sal_uInt16 nBitCount) +inline QImage::Format getBitFormat(vcl::PixelFormat ePixelFormat) { - switch (nBitCount) + switch (ePixelFormat) { - case 1: + case vcl::PixelFormat::N1_BPP: return QImage::Format_Mono; - case 8: + case vcl::PixelFormat::N8_BPP: return QImage::Format_Indexed8; - case 24: + case vcl::PixelFormat::N24_BPP: return QImage::Format_RGB888; - case 32: + case vcl::PixelFormat::N32_BPP: return Qt5_DefaultFormat32; default: std::abort(); diff --git a/vcl/inc/quartz/salbmp.h b/vcl/inc/quartz/salbmp.h index 87929249f787..8a9e94d043cc 100644 --- a/vcl/inc/quartz/salbmp.h +++ b/vcl/inc/quartz/salbmp.h @@ -57,10 +57,10 @@ public: public: // SalBitmap methods - bool Create( const Size& rSize, sal_uInt16 nBitCount, const BitmapPalette& rPal ) override; + bool Create( const Size& rSize, vcl::PixelFormat ePixelFormat, const BitmapPalette& rPal ) override; bool Create( const SalBitmap& rSalBmp ) override; bool Create( const SalBitmap& rSalBmp, SalGraphics* pGraphics ) override; - bool Create( const SalBitmap& rSalBmp, sal_uInt16 nNewBitCount ) override; + bool Create( const SalBitmap& rSalBmp, vcl::PixelFormat eNewPixelFormat) override; virtual bool Create( const css::uno::Reference< css::rendering::XBitmapCanvas >& rBitmapCanvas, Size& rSize, bool bMask = false ) override; diff --git a/vcl/inc/salbmp.hxx b/vcl/inc/salbmp.hxx index adbf70e5c17f..78d553b5194c 100644 --- a/vcl/inc/salbmp.hxx +++ b/vcl/inc/salbmp.hxx @@ -25,6 +25,7 @@ #include <vcl/checksum.hxx> #include <vcl/BitmapAccessMode.hxx> #include <vcl/BitmapBuffer.hxx> +#include <vcl/bitmap/BitmapTypes.hxx> #include <com/sun/star/rendering/XBitmapCanvas.hpp> struct BitmapBuffer; @@ -53,13 +54,13 @@ public: virtual ~SalBitmap(); virtual bool Create( const Size& rSize, - sal_uInt16 nBitCount, + vcl::PixelFormat ePixelFormat, const BitmapPalette& rPal ) = 0; virtual bool Create( const SalBitmap& rSalBmp ) = 0; virtual bool Create( const SalBitmap& rSalBmp, SalGraphics* pGraphics ) = 0; virtual bool Create( const SalBitmap& rSalBmp, - sal_uInt16 nNewBitCount ) = 0; + vcl::PixelFormat eNewPixelFormat) = 0; virtual bool Create( const css::uno::Reference< css::rendering::XBitmapCanvas >& rBitmapCanvas, Size& rSize, bool bMask = false ) = 0; diff --git a/vcl/inc/skia/salbmp.hxx b/vcl/inc/skia/salbmp.hxx index 012594169132..bb8ae16f1c2e 100644 --- a/vcl/inc/skia/salbmp.hxx +++ b/vcl/inc/skia/salbmp.hxx @@ -36,11 +36,11 @@ public: virtual ~SkiaSalBitmap() override; // SalBitmap methods - virtual bool Create(const Size& rSize, sal_uInt16 nBitCount, + virtual bool Create(const Size& rSize, vcl::PixelFormat ePixelFormat, const BitmapPalette& rPal) override; virtual bool Create(const SalBitmap& rSalBmp) override; virtual bool Create(const SalBitmap& rSalBmp, SalGraphics* pGraphics) override; - virtual bool Create(const SalBitmap& rSalBmp, sal_uInt16 nNewBitCount) override; + virtual bool Create(const SalBitmap& rSalBmp, vcl::PixelFormat eNewPixelFormat) override; virtual bool Create(const css::uno::Reference<css::rendering::XBitmapCanvas>& rBitmapCanvas, Size& rSize, bool bMask = false) override; diff --git a/vcl/inc/unx/salbmp.h b/vcl/inc/unx/salbmp.h index 7f9f239d57b0..8b9e7c1cfc9f 100644 --- a/vcl/inc/unx/salbmp.h +++ b/vcl/inc/unx/salbmp.h @@ -41,7 +41,7 @@ private: static std::unique_ptr<BitmapBuffer> ImplCreateDIB( const Size& rSize, - sal_uInt16 nBitCount, + vcl::PixelFormat ePixelFormat, const BitmapPalette& rPal ); @@ -114,7 +114,7 @@ public: // override pure virtual methods virtual bool Create( const Size& rSize, - sal_uInt16 nBitCount, + vcl::PixelFormat ePixelFormat, const BitmapPalette& rPal ) override; @@ -126,7 +126,7 @@ public: virtual bool Create( const SalBitmap& rSalBmp, - sal_uInt16 nNewBitCount + vcl::PixelFormat ePixelFormat ) override; virtual bool Create( diff --git a/vcl/inc/win/salbmp.h b/vcl/inc/win/salbmp.h index bb589cc4b2f8..5167a7e4a939 100644 --- a/vcl/inc/win/salbmp.h +++ b/vcl/inc/win/salbmp.h @@ -52,7 +52,7 @@ public: std::shared_ptr< Gdiplus::Bitmap > ImplGetGdiPlusBitmap(const WinSalBitmap* pAlphaSource = nullptr) const; - static HGLOBAL ImplCreateDIB( const Size& rSize, sal_uInt16 nBitCount, const BitmapPalette& rPal ); + static HGLOBAL ImplCreateDIB( const Size& rSize, vcl::PixelFormat ePixelFormat, const BitmapPalette& rPal ); static HANDLE ImplCopyDIBOrDDB( HANDLE hHdl, bool bDIB ); static sal_uInt16 ImplGetDIBColorCount( HGLOBAL hDIB ); static void ImplDecodeRLEBuffer( const BYTE* pSrcBuf, BYTE* pDstBuf, @@ -66,10 +66,10 @@ public: public: bool Create( HANDLE hBitmap, bool bDIB, bool bCopyHandle ); - virtual bool Create( const Size& rSize, sal_uInt16 nBitCount, const BitmapPalette& rPal ) override; + virtual bool Create( const Size& rSize, vcl::PixelFormat ePixelFormat, const BitmapPalette& rPal ) override; virtual bool Create( const SalBitmap& rSalBmpImpl ) override; virtual bool Create( const SalBitmap& rSalBmpImpl, SalGraphics* pGraphics ) override; - virtual bool Create( const SalBitmap& rSalBmpImpl, sal_uInt16 nNewBitCount ) override; + virtual bool Create( const SalBitmap& rSalBmpImpl, vcl::PixelFormat eNewPixelFormat ) override; virtual bool Create( const css::uno::Reference< css::rendering::XBitmapCanvas >& rBitmapCanvas, Size& rSize, bool bMask = false ) override; |