diff options
author | Tomaž Vajngerl <tomaz.vajngerl@collabora.co.uk> | 2021-03-21 20:31:39 +0900 |
---|---|---|
committer | Tomaž Vajngerl <quikee@gmail.com> | 2021-03-26 08:18:19 +0100 |
commit | b849373b2bd2c41ab03e2fd5e3fa5e9c48b47e51 (patch) | |
tree | f7f03c37f8956b73302f4c9aab77ba0189302c82 | |
parent | de746cd639513f498c93aced200ad9a80975bda5 (diff) |
vcl: add initializer_list constructor to BitmapPalette and use it
Change-Id: Ib24266e435765bd5e05193aea5cee61d7a9346b0
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/113133
Tested-by: Jenkins
Reviewed-by: Tomaž Vajngerl <quikee@gmail.com>
-rw-r--r-- | cppcanvas/source/mtfrenderer/implrenderer.cxx | 6 | ||||
-rw-r--r-- | drawinglayer/source/tools/wmfemfhelper.cxx | 7 | ||||
-rw-r--r-- | filter/source/msfilter/util.cxx | 5 | ||||
-rw-r--r-- | include/vcl/BitmapPalette.hxx | 4 |
4 files changed, 11 insertions, 11 deletions
diff --git a/cppcanvas/source/mtfrenderer/implrenderer.cxx b/cppcanvas/source/mtfrenderer/implrenderer.cxx index 8c1b818d1957..24f7f3fbf969 100644 --- a/cppcanvas/source/mtfrenderer/implrenderer.cxx +++ b/cppcanvas/source/mtfrenderer/implrenderer.cxx @@ -202,9 +202,9 @@ namespace const ::Color& rMaskColor ) { const ::Color aWhite( COL_WHITE ); - BitmapPalette aBiLevelPalette(2); - aBiLevelPalette[0] = aWhite; - aBiLevelPalette[1] = rMaskColor; + BitmapPalette aBiLevelPalette{ + aWhite, rMaskColor + }; Bitmap aMask( rBitmap.CreateMask( aWhite )); Bitmap aSolid( rBitmap.GetSizePixel(), diff --git a/drawinglayer/source/tools/wmfemfhelper.cxx b/drawinglayer/source/tools/wmfemfhelper.cxx index 73b229cd9f09..588dd9ea1cc5 100644 --- a/drawinglayer/source/tools/wmfemfhelper.cxx +++ b/drawinglayer/source/tools/wmfemfhelper.cxx @@ -670,10 +670,9 @@ namespace wmfemfhelper static BitmapEx createMaskBmpEx(const Bitmap& rBitmap, const Color& rMaskColor) { const Color aWhite(COL_WHITE); - BitmapPalette aBiLevelPalette(2); - - aBiLevelPalette[0] = aWhite; - aBiLevelPalette[1] = rMaskColor; + BitmapPalette aBiLevelPalette { + aWhite, rMaskColor + }; Bitmap aMask(rBitmap.CreateMask(aWhite)); Bitmap aSolid(rBitmap.GetSizePixel(), vcl::PixelFormat::N1_BPP, &aBiLevelPalette); diff --git a/filter/source/msfilter/util.cxx b/filter/source/msfilter/util.cxx index d821b8f2e6c7..2ee9bf6edb08 100644 --- a/filter/source/msfilter/util.cxx +++ b/filter/source/msfilter/util.cxx @@ -1334,15 +1334,12 @@ sal_uInt8 TransColToIco( const Color& rCol ) case sal_uInt32(COL_AUTO): nCol = 0; break; default: - static const Color aColArr[ 16 ] = { + static const BitmapPalette aBmpPal { COL_BLACK, COL_LIGHTBLUE, COL_LIGHTCYAN, COL_LIGHTGREEN, COL_LIGHTMAGENTA,COL_LIGHTRED, COL_YELLOW, COL_WHITE, COL_BLUE, COL_CYAN, COL_GREEN, COL_MAGENTA, COL_RED, COL_BROWN, COL_GRAY, COL_LIGHTGRAY }; - BitmapPalette aBmpPal(16); - for( sal_uInt16 i = 0; i < 16; ++i ) - aBmpPal[i] = aColArr[ i ]; nCol = static_cast< sal_uInt8 >(GetBestIndex(aBmpPal, rCol) + 1); break; diff --git a/include/vcl/BitmapPalette.hxx b/include/vcl/BitmapPalette.hxx index 34a0eabc5fb6..046bd6c20f0a 100644 --- a/include/vcl/BitmapPalette.hxx +++ b/include/vcl/BitmapPalette.hxx @@ -57,6 +57,10 @@ public: { } + BitmapPalette(std::initializer_list<BitmapColor> aBitmapColor) : maBitmapColor(aBitmapColor) + { + } + BitmapPalette(sal_uInt16 nCount) : maBitmapColor(nCount) { |