[Libreoffice-commits] core.git: 2 commits - cppcanvas/source drawinglayer/source filter/source include/vcl vcl/qa vcl/source
Tomaž Vajngerl (via logerrit)
logerrit at kemper.freedesktop.org
Fri Mar 26 07:22:59 UTC 2021
cppcanvas/source/mtfrenderer/implrenderer.cxx | 6 +++---
drawinglayer/source/tools/wmfemfhelper.cxx | 7 +++----
filter/source/msfilter/util.cxx | 5 +----
include/vcl/BitmapPalette.hxx | 4 ++++
vcl/qa/cppunit/XpmFilterTest.cxx | 2 +-
vcl/source/filter/ixpm/xpmread.cxx | 4 +---
6 files changed, 13 insertions(+), 15 deletions(-)
New commits:
commit 65bd1f3a4ca516787753f7f0b8f0d67b52e92ecf
Author: Tomaž Vajngerl <tomaz.vajngerl at collabora.co.uk>
AuthorDate: Thu Mar 25 21:15:20 2021 +0900
Commit: Tomaž Vajngerl <quikee at gmail.com>
CommitDate: Fri Mar 26 08:20:21 2021 +0100
vcl: remove creating 4-bit palette bitmap when reading XPM format
Use 8-bit palette instead of 4-bit when reading from XPM. Modify
the test to expect bit-count 8.
Change-Id: I7b8e8254ad58cdda0829baea75809aa8596090e5
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/113134
Tested-by: Jenkins
Reviewed-by: Tomaž Vajngerl <quikee at gmail.com>
diff --git a/vcl/qa/cppunit/XpmFilterTest.cxx b/vcl/qa/cppunit/XpmFilterTest.cxx
index 121dc62a4fd6..20a272b7a6ce 100644
--- a/vcl/qa/cppunit/XpmFilterTest.cxx
+++ b/vcl/qa/cppunit/XpmFilterTest.cxx
@@ -51,7 +51,7 @@ CPPUNIT_TEST_FIXTURE(XpmFilterTest, testXPM_4bit)
auto aBitmap = aGraphic.GetBitmapEx();
CPPUNIT_ASSERT_EQUAL(tools::Long(4), aBitmap.GetSizePixel().Width());
CPPUNIT_ASSERT_EQUAL(tools::Long(4), aBitmap.GetSizePixel().Height());
- CPPUNIT_ASSERT_EQUAL(sal_uInt16(4), aBitmap.GetBitCount());
+ CPPUNIT_ASSERT_EQUAL(sal_uInt16(8), aBitmap.GetBitCount());
CPPUNIT_ASSERT_EQUAL(COL_LIGHTBLUE, aBitmap.GetPixelColor(0, 0));
CPPUNIT_ASSERT_EQUAL(COL_LIGHTRED, aBitmap.GetPixelColor(2, 0));
CPPUNIT_ASSERT_EQUAL(COL_YELLOW, aBitmap.GetPixelColor(0, 2));
diff --git a/vcl/source/filter/ixpm/xpmread.cxx b/vcl/source/filter/ixpm/xpmread.cxx
index 77399dbdfd93..ace45f577826 100644
--- a/vcl/source/filter/ixpm/xpmread.cxx
+++ b/vcl/source/filter/ixpm/xpmread.cxx
@@ -197,10 +197,8 @@ ReadState XPMReader::ReadXPM( Graphic& rGraphic )
auto ePixelFormat = vcl::PixelFormat::INVALID;
if ( mnColors > 256 )
ePixelFormat = vcl::PixelFormat::N24_BPP;
- else if ( mnColors > 16 )
- ePixelFormat = vcl::PixelFormat::N8_BPP;
else if ( mnColors > 2 )
- ePixelFormat = vcl::PixelFormat::N4_BPP;
+ ePixelFormat = vcl::PixelFormat::N8_BPP;
else
ePixelFormat = vcl::PixelFormat::N1_BPP;
commit b849373b2bd2c41ab03e2fd5e3fa5e9c48b47e51
Author: Tomaž Vajngerl <tomaz.vajngerl at collabora.co.uk>
AuthorDate: Sun Mar 21 20:31:39 2021 +0900
Commit: Tomaž Vajngerl <quikee at gmail.com>
CommitDate: Fri Mar 26 08:18:19 2021 +0100
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 at gmail.com>
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)
{
More information about the Libreoffice-commits
mailing list