summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJan-Marek Glogowski <glogow@fbihome.de>2019-05-11 11:49:21 +0000
committerJan-Marek Glogowski <glogow@fbihome.de>2019-05-13 15:43:17 +0200
commitc34bb163c38cfa893d1b5b0124ab9c5929dff16c (patch)
tree8994582e896495c8fe919e7a26c2852f9d120ec2
parent0725e8a5d9add88b1289f5b1cb90b0b43059a734 (diff)
Make BitmapColor inherit from / merge into Color
BitmapColor itself is kept to distingish the Color usage as part of a color palette, which continues to store the offset in the blue value. The original special mbIndex handling is long gone since commit 1fefdd6f3b41 ("Alpha channel in BitmapColor - change bIndex to alpha"), so there is no data difference. This also results in the following changes: * now has a basic_ostream<charT, traits>& operator<< (that was my actual starting point... for an other bug fix) * there is a minimal difference for GetLiminance BGR(29,151,76) => BGR(28,151,77) * no more return values for Merge and Invert (previously returning *this) * replaces all GetBlueOrIndex with GetIndex This leaves one "problematic" part: the GetColorError handling. At first glance it should probably be virtual. The Color variant is less strict then the BitmapColor one - for whatever reason. BitmapColor is always used to search for the best match in a Palette. Currently I'm simply leaving both variants. Would be nice to have an explict for functions here. Change-Id: I251ba3024a1d60f2a9d9fde9cd0a60f08e8322a7 Reviewed-on: https://gerrit.libreoffice.org/72181 Tested-by: Jenkins Reviewed-by: Tomaž Vajngerl <quikee@gmail.com> Reviewed-by: Jan-Marek Glogowski <glogow@fbihome.de>
-rw-r--r--drawinglayer/source/texture/texture3d.cxx2
-rw-r--r--filter/source/msfilter/msdffimp.cxx4
-rw-r--r--include/tools/color.hxx30
-rw-r--r--include/vcl/BitmapColor.hxx167
-rw-r--r--include/vcl/bitmapaccess.hxx2
-rw-r--r--sd/qa/unit/import-tests.cxx6
-rw-r--r--tools/source/generic/color.cxx7
-rw-r--r--vcl/backendtest/outputdevice/common.cxx2
-rw-r--r--vcl/inc/bitmap/ScanlineTools.hxx6
-rw-r--r--vcl/qa/cppunit/BitmapProcessorTest.cxx6
-rw-r--r--vcl/qa/cppunit/BitmapTest.cxx4
-rw-r--r--vcl/qa/cppunit/GraphicTest.cxx5
-rw-r--r--vcl/qa/cppunit/bitmapcolor.cxx28
-rw-r--r--vcl/qa/cppunit/gen/gen.cxx4
-rw-r--r--vcl/qa/cppunit/jpeg/JpegReaderTest.cxx8
-rw-r--r--vcl/qa/cppunit/outdev.cxx8
-rw-r--r--vcl/quartz/salbmp.cxx6
-rw-r--r--vcl/source/bitmap/BitmapLightenFilter.cxx3
-rw-r--r--vcl/source/bitmap/BitmapSolarizeFilter.cxx8
-rw-r--r--vcl/source/bitmap/BitmapTools.cxx10
-rw-r--r--vcl/source/bitmap/bitmappaint.cxx19
-rw-r--r--vcl/source/control/combobox.cxx2
-rw-r--r--vcl/source/control/imp_listbox.cxx2
-rw-r--r--vcl/source/filter/igif/gifread.cxx2
-rw-r--r--vcl/source/filter/png/pngread.cxx7
-rw-r--r--vcl/source/gdi/bitmapex.cxx9
-rw-r--r--vcl/source/gdi/bmpacc2.cxx2
-rw-r--r--vcl/source/gdi/print2.cxx2
-rw-r--r--vcl/source/graphic/UnoGraphicTransformer.cxx6
-rw-r--r--vcl/source/outdev/bitmap.cxx8
-rw-r--r--vcl/source/outdev/transparent.cxx6
-rw-r--r--vcl/unx/generic/gdi/gdiimpl.cxx4
-rw-r--r--vcl/win/gdi/gdiimpl.cxx4
33 files changed, 129 insertions, 260 deletions
diff --git a/drawinglayer/source/texture/texture3d.cxx b/drawinglayer/source/texture/texture3d.cxx
index 74c0766ad51c..3c5f7d5e29bf 100644
--- a/drawinglayer/source/texture/texture3d.cxx
+++ b/drawinglayer/source/texture/texture3d.cxx
@@ -130,7 +130,7 @@ namespace drawinglayer
{
const BitmapColor aBitmapColor(mpReadBitmap->GetColor(rY, rX));
- if(maBitmapEx.GetTransparentColor() == aBitmapColor.GetColor())
+ if(maBitmapEx.GetTransparentColor() == aBitmapColor)
{
return 255;
}
diff --git a/filter/source/msfilter/msdffimp.cxx b/filter/source/msfilter/msdffimp.cxx
index ee75a5d7848f..5b83d170b3f1 100644
--- a/filter/source/msfilter/msdffimp.cxx
+++ b/filter/source/msfilter/msdffimp.cxx
@@ -1395,9 +1395,9 @@ void DffPropertyReader::ApplyFillAttributes( SvStream& rIn, SfxItemSet& rSet, co
{
Color aReadColor;
if (pRead->HasPalette())
- aReadColor = pRead->GetPaletteColor(pRead->GetIndexFromData(pScanlineRead, x)).GetColor();
+ aReadColor = pRead->GetPaletteColor(pRead->GetIndexFromData(pScanlineRead, x));
else
- aReadColor = pRead->GetPixelFromData(pScanlineRead, x).GetColor();
+ aReadColor = pRead->GetPixelFromData(pScanlineRead, x);
if (aReadColor == Color(0))
aResult.SetPixel(y, x, aCol2);
diff --git a/include/tools/color.hxx b/include/tools/color.hxx
index 4aea9a2d670e..ed8b8813afee 100644
--- a/include/tools/color.hxx
+++ b/include/tools/color.hxx
@@ -24,8 +24,6 @@
#include <com/sun/star/uno/Any.hxx>
#include <basegfx/color/bcolor.hxx>
-class SvStream;
-
namespace color
{
@@ -38,28 +36,30 @@ constexpr sal_uInt32 extractRGB(sal_uInt32 nColorNumber)
// Color
-class SAL_WARN_UNUSED TOOLS_DLLPUBLIC Color final
+class SAL_WARN_UNUSED TOOLS_DLLPUBLIC Color
{
+ // data intentionally public; read the commit log!
public:
union
{
sal_uInt32 mValue;
struct
{
- #ifdef OSL_BIGENDIAN
+#ifdef OSL_BIGENDIAN
sal_uInt8 A;
sal_uInt8 R;
sal_uInt8 G;
sal_uInt8 B;
- #else
+#else
sal_uInt8 B;
sal_uInt8 G;
sal_uInt8 R;
sal_uInt8 A;
- #endif
+#endif
};
};
+public:
constexpr Color()
: mValue(0) // black
{}
@@ -217,6 +217,13 @@ constexpr sal_uInt8 ColorChannelMerge(sal_uInt8 nDst, sal_uInt8 nSrc, sal_uInt8
return sal_uInt8(((sal_Int32(nDst) - nSrc) * nSrcTrans + ((nSrc << 8) | nDst)) >> 8);
}
+inline void Color::Invert()
+{
+ R = ~R;
+ G = ~G;
+ B = ~B;
+}
+
inline void Color::Merge( const Color& rMergeColor, sal_uInt8 cTransparency )
{
R = ColorChannelMerge(R, rMergeColor.R, cTransparency);
@@ -233,6 +240,7 @@ inline bool operator >>=( const css::uno::Any & rAny, Color & value )
value = Color(nTmp);
return true;
}
+
inline void operator <<=( css::uno::Any & rAny, Color value )
{
rAny <<= sal_Int32(value);
@@ -301,6 +309,16 @@ constexpr ::Color COL_AUTHOR9_DARK ( 209, 118, 0 );
constexpr ::Color COL_AUTHOR9_NORMAL ( 255, 226, 185 );
constexpr ::Color COL_AUTHOR9_LIGHT ( 255, 231, 199 );
+template<typename charT, typename traits>
+inline std::basic_ostream<charT, traits>& operator <<(std::basic_ostream<charT, traits>& rStream, const Color& rColor)
+{
+ return rStream << "c[" << std::hex << std::setfill ('0')
+ << std::setw(2) << static_cast<int>(rColor.GetRed())
+ << std::setw(2) << static_cast<int>(rColor.GetGreen())
+ << std::setw(2) << static_cast<int>(rColor.GetBlue())
+ << std::setw(2) << static_cast<int>(rColor.GetTransparency()) << "]";
+}
+
#endif
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/vcl/BitmapColor.hxx b/include/vcl/BitmapColor.hxx
index 7df493e7b38d..4344a7bd242f 100644
--- a/include/vcl/BitmapColor.hxx
+++ b/include/vcl/BitmapColor.hxx
@@ -22,203 +22,72 @@
#include <vcl/dllapi.h>
#include <tools/color.hxx>
+#include <cassert>
#include <memory>
-class VCL_DLLPUBLIC BitmapColor final
+class VCL_DLLPUBLIC BitmapColor final : public Color
{
-private:
- sal_uInt8 mcBlueOrIndex;
- sal_uInt8 mcGreen;
- sal_uInt8 mcRed;
- sal_uInt8 mcAlpha;
-
public:
-
inline BitmapColor();
constexpr BitmapColor( sal_uInt8 cRed, sal_uInt8 cGreen, sal_uInt8 cBlue, sal_uInt8 cAlpha = 0 );
inline BitmapColor( const Color& rColor );
explicit inline BitmapColor( sal_uInt8 cIndex );
- inline bool operator==( const BitmapColor& rBitmapColor ) const;
- inline bool operator!=( const BitmapColor& rBitmapColor ) const;
-
- inline sal_uInt8 GetRed() const;
- inline void SetRed( sal_uInt8 cRed );
-
- inline sal_uInt8 GetGreen() const;
- inline void SetGreen( sal_uInt8 cGreen );
-
- inline sal_uInt8 GetBlue() const;
- inline void SetBlue( sal_uInt8 cBlue );
-
inline sal_uInt8 GetIndex() const;
inline void SetIndex( sal_uInt8 cIndex );
- Color GetColor() const;
-
inline sal_uInt8 GetAlpha() const;
inline void SetAlpha( sal_uInt8 cAlpha );
- inline sal_uInt8 GetBlueOrIndex() const;
-
- inline BitmapColor& Invert();
-
- inline sal_uInt8 GetLuminance() const;
-
- inline BitmapColor& Merge( const BitmapColor& rColor, sal_uInt8 cTransparency );
-
- inline sal_uInt16 GetColorError( const BitmapColor& rBitmapColor ) const;
+ inline sal_uInt16 GetColorError( const BitmapColor& rColor ) const;
};
-template<typename charT, typename traits>
-inline std::basic_ostream<charT, traits>& operator <<(std::basic_ostream<charT, traits>& rStream, const BitmapColor& rColor)
-{
- return rStream << "#(" << std::hex << std::setfill ('0') << std::setw(2) << static_cast<int>(rColor.GetRed())
- << std::setw(2) << static_cast<int>(rColor.GetGreen())
- << std::setw(2) << static_cast<int>(rColor.GetBlueOrIndex())
- << std::setw(2) << static_cast<int>(rColor.GetAlpha()) << ")";
-}
-
-inline BitmapColor::BitmapColor() :
- mcBlueOrIndex (0),
- mcGreen (0),
- mcRed (0),
- mcAlpha (0)
-{
-}
-
-constexpr BitmapColor::BitmapColor(sal_uInt8 cRed, sal_uInt8 cGreen, sal_uInt8 cBlue, sal_uInt8 cAlpha) :
- mcBlueOrIndex ( cBlue ),
- mcGreen ( cGreen ),
- mcRed ( cRed ),
- mcAlpha ( cAlpha )
-{
-}
-
-inline BitmapColor::BitmapColor( const Color& rColor ) :
- mcBlueOrIndex ( rColor.GetBlue() ),
- mcGreen ( rColor.GetGreen() ),
- mcRed ( rColor.GetRed() ),
- mcAlpha ( rColor.GetTransparency() )
-{
-}
-
-inline BitmapColor::BitmapColor( sal_uInt8 cIndex ) :
- mcBlueOrIndex ( cIndex ),
- mcGreen ( 0 ),
- mcRed ( 0 ),
- mcAlpha ( 0 )
-{
-}
-
-inline bool BitmapColor::operator==( const BitmapColor& rBitmapColor ) const
-{
- return mcBlueOrIndex == rBitmapColor.mcBlueOrIndex &&
- mcGreen == rBitmapColor.mcGreen &&
- mcRed == rBitmapColor.mcRed &&
- mcAlpha == rBitmapColor.mcAlpha;
-}
-
-inline bool BitmapColor::operator!=( const BitmapColor& rBitmapColor ) const
+inline BitmapColor::BitmapColor()
{
- return !( *this == rBitmapColor );
}
-inline sal_uInt8 BitmapColor::GetRed() const
+inline BitmapColor::BitmapColor( const Color& rColor )
+ : Color(rColor)
{
- return mcRed;
}
-inline void BitmapColor::SetRed( sal_uInt8 cRed )
+constexpr BitmapColor::BitmapColor(sal_uInt8 cRed, sal_uInt8 cGreen, sal_uInt8 cBlue, sal_uInt8 cAlpha)
+ : Color(cAlpha, cRed, cGreen, cBlue)
{
- mcRed = cRed;
}
-inline sal_uInt8 BitmapColor::GetGreen() const
+inline BitmapColor::BitmapColor( sal_uInt8 cIndex )
{
- return mcGreen;
-}
-
-inline void BitmapColor::SetGreen( sal_uInt8 cGreen )
-{
- mcGreen = cGreen;
-}
-
-inline sal_uInt8 BitmapColor::GetBlue() const
-{
- return mcBlueOrIndex;
-}
-
-inline void BitmapColor::SetBlue( sal_uInt8 cBlue )
-{
- mcBlueOrIndex = cBlue;
+ SetIndex(cIndex);
}
inline sal_uInt8 BitmapColor::GetIndex() const
{
- return mcBlueOrIndex;
+ return GetBlue();
}
inline void BitmapColor::SetIndex( sal_uInt8 cIndex )
{
- mcBlueOrIndex = cIndex;
-}
-
-inline Color BitmapColor::GetColor() const
-{
- return Color(mcAlpha, mcRed, mcGreen, mcBlueOrIndex);
+ SetBlue(cIndex);
}
inline sal_uInt8 BitmapColor::GetAlpha() const
{
- return mcAlpha;
+ return GetTransparency();
}
inline void BitmapColor::SetAlpha( sal_uInt8 cAlpha )
{
- mcAlpha = cAlpha;
-}
-
-inline sal_uInt8 BitmapColor::GetBlueOrIndex() const
-{
- // #i47518# Yield a value regardless of mbIndex
- return mcBlueOrIndex;
-}
-
-inline BitmapColor& BitmapColor::Invert()
-{
- mcBlueOrIndex = ~mcBlueOrIndex;
- mcGreen = ~mcGreen;
- mcRed = ~mcRed;
-
- return *this;
-}
-
-inline sal_uInt8 BitmapColor::GetLuminance() const
-{
- return (static_cast<sal_uInt32>(mcBlueOrIndex) * 28
- + static_cast<sal_uInt32>(mcGreen) * 151
- + static_cast<sal_uInt32>(mcRed) * 77) >> 8;
+ SetTransparency(cAlpha);
}
-
-inline BitmapColor& BitmapColor::Merge( const BitmapColor& rBitmapColor, sal_uInt8 cTransparency )
-{
- mcBlueOrIndex = ColorChannelMerge( mcBlueOrIndex, rBitmapColor.mcBlueOrIndex, cTransparency );
- mcGreen = ColorChannelMerge( mcGreen, rBitmapColor.mcGreen, cTransparency );
- mcRed = ColorChannelMerge( mcRed, rBitmapColor.mcRed, cTransparency );
-
- return *this;
-}
-
-
-inline sal_uInt16 BitmapColor::GetColorError( const BitmapColor& rBitmapColor ) const
+inline sal_uInt16 BitmapColor::GetColorError( const BitmapColor& rColor ) const
{
return static_cast<sal_uInt16>(
- abs( static_cast<int>(mcBlueOrIndex) - static_cast<int>(rBitmapColor.mcBlueOrIndex) ) +
- abs( static_cast<int>(mcGreen) - static_cast<int>(rBitmapColor.mcGreen) ) +
- abs( static_cast<int>(mcRed) - static_cast<int>(rBitmapColor.mcRed) ) );
+ abs( static_cast<int>(GetBlue()) - static_cast<int>(rColor.GetBlue()) ) +
+ abs( static_cast<int>(GetGreen()) - static_cast<int>(rColor.GetGreen()) ) +
+ abs( static_cast<int>(GetRed()) - static_cast<int>(rColor.GetRed()) ) );
}
#endif // INCLUDED_VCL_BITMAPCOLOR_HXX
diff --git a/include/vcl/bitmapaccess.hxx b/include/vcl/bitmapaccess.hxx
index db426fa3e4e2..e1adbf10c4c1 100644
--- a/include/vcl/bitmapaccess.hxx
+++ b/include/vcl/bitmapaccess.hxx
@@ -214,7 +214,7 @@ public:
sal_uInt8 GetPixelIndex(long nY, long nX) const
{
- return GetPixel(nY, nX).GetBlueOrIndex();
+ return GetPixel(nY, nX).GetIndex();
}
/** Get the interpolated color at coordinates fY, fX; if outside, return rFallback */
diff --git a/sd/qa/unit/import-tests.cxx b/sd/qa/unit/import-tests.cxx
index 57cfb9ee7cb3..331bc251c82f 100644
--- a/sd/qa/unit/import-tests.cxx
+++ b/sd/qa/unit/import-tests.cxx
@@ -1374,7 +1374,7 @@ void SdImportTest::testTdf93124()
{
for (long nX = 34; nX < (34 + 43); ++nX)
{
- const Color aColor = pReadAccess->GetColor(nY, nX).GetColor();
+ const Color aColor = pReadAccess->GetColor(nY, nX);
if ((aColor.GetRed() != 0xff) || (aColor.GetGreen() != 0xff) || (aColor.GetBlue() != 0xff))
++nNonWhiteCount;
}
@@ -1433,7 +1433,7 @@ void SdImportTest::testTdf99729()
{
for (long nY = 16; nY < (16 + 96); ++nY)
{
- const Color aColor = pRead->GetColor(nY, nX).GetColor();
+ const Color aColor = pRead->GetColor(nY, nX);
if ((aColor.GetRed() != 0xff) || (aColor.GetGreen() != 0xff) || (aColor.GetBlue() != 0xff))
++nonwhitecounts[i];
}
@@ -1873,7 +1873,7 @@ bool checkPatternValues(std::vector<sal_uInt8>& rExpected, Bitmap& rBitmap)
Scanline pScanline = pAccess->GetScanline( y );
for (long x = 0; x < pAccess->Width(); ++x)
{
- Color aColor = pAccess->GetPixelFromData(pScanline, x).GetColor();
+ Color aColor = pAccess->GetPixelFromData(pScanline, x);
sal_uInt8 aValue = rExpected[y*8+x];
if (aValue == 1 && aColor != aFGColor)
diff --git a/tools/source/generic/color.cxx b/tools/source/generic/color.cxx
index a06c6e84a964..4640ef85f290 100644
--- a/tools/source/generic/color.cxx
+++ b/tools/source/generic/color.cxx
@@ -64,13 +64,6 @@ void Color::DecreaseContrast(sal_uInt8 nContDec)
}
}
-void Color::Invert()
-{
- R = ~R;
- G = ~G;
- B = ~B;
-}
-
bool Color::IsDark() const
{
return GetLuminance() <= 60;
diff --git a/vcl/backendtest/outputdevice/common.cxx b/vcl/backendtest/outputdevice/common.cxx
index d6f1d50f8456..a885cac9088b 100644
--- a/vcl/backendtest/outputdevice/common.cxx
+++ b/vcl/backendtest/outputdevice/common.cxx
@@ -30,7 +30,7 @@ void checkValue(BitmapScopedWriteAccess& pAccess, int x, int y, Color aExpected,
int& nNumberOfQuirks, int& nNumberOfErrors, bool bQuirkMode, int nColorDeltaThresh = 0)
{
const bool bColorize = false;
- Color aColor = pAccess->GetPixel(y, x).GetColor();
+ Color aColor = pAccess->GetPixel(y, x);
int nColorDelta = deltaColor(aColor, aExpected);
if (nColorDelta <= nColorDeltaThresh)
diff --git a/vcl/inc/bitmap/ScanlineTools.hxx b/vcl/inc/bitmap/ScanlineTools.hxx
index e87bded7e2d6..17925e9687b9 100644
--- a/vcl/inc/bitmap/ScanlineTools.hxx
+++ b/vcl/inc/bitmap/ScanlineTools.hxx
@@ -127,7 +127,7 @@ public:
{
const sal_uInt8 nIndex(*pData++);
if (nIndex < mrPalette.GetEntryCount())
- return mrPalette[nIndex].GetColor();
+ return mrPalette[nIndex];
else
return COL_BLACK;
}
@@ -177,7 +177,7 @@ public:
mnShift ^= 4;
if (nIndex < mrPalette.GetEntryCount())
- return mrPalette[nIndex].GetColor();
+ return mrPalette[nIndex];
else
return COL_BLACK;
}
@@ -221,7 +221,7 @@ public:
mnX++;
if (nIndex < mrPalette.GetEntryCount())
- return mrPalette[nIndex].GetColor();
+ return mrPalette[nIndex];
else
return COL_BLACK;
}
diff --git a/vcl/qa/cppunit/BitmapProcessorTest.cxx b/vcl/qa/cppunit/BitmapProcessorTest.cxx
index fa0ccc5fc638..e59f135df7e8 100644
--- a/vcl/qa/cppunit/BitmapProcessorTest.cxx
+++ b/vcl/qa/cppunit/BitmapProcessorTest.cxx
@@ -51,7 +51,7 @@ void BitmapProcessorTest::testDisabledImage()
Bitmap aDisabledBitmap(aDisabledBitmapEx.GetBitmap());
{
Bitmap::ScopedReadAccess pReadAccess(aDisabledBitmap);
- Color aColor(pReadAccess->GetPixel(0, 0).GetColor());
+ Color aColor(pReadAccess->GetPixel(0, 0));
CPPUNIT_ASSERT_EQUAL(Color(0x00C5C5C5), aColor);
}
}
@@ -75,13 +75,13 @@ void BitmapProcessorTest::testDisabledImage()
Bitmap aDisabledBitmap(aDisabledBitmapEx.GetBitmap());
{
Bitmap::ScopedReadAccess pReadAccess(aDisabledBitmap);
- Color aColor(pReadAccess->GetPixel(0, 0).GetColor());
+ Color aColor(pReadAccess->GetPixel(0, 0));
CPPUNIT_ASSERT_EQUAL(Color(0x00C5C5C5), aColor);
}
AlphaMask aDisabledAlphaMask(aDisabledBitmapEx.GetAlpha());
{
AlphaMask::ScopedReadAccess pReadAccess(aDisabledAlphaMask);
- Color aColor(pReadAccess->GetPixel(0, 0).GetColor());
+ Color aColor(pReadAccess->GetPixel(0, 0));
CPPUNIT_ASSERT_EQUAL(Color(0x0000AA), aColor);
}
}
diff --git a/vcl/qa/cppunit/BitmapTest.cxx b/vcl/qa/cppunit/BitmapTest.cxx
index 020b01c22d55..e01f3fb6ecb5 100644
--- a/vcl/qa/cppunit/BitmapTest.cxx
+++ b/vcl/qa/cppunit/BitmapTest.cxx
@@ -430,7 +430,7 @@ void BitmapTest::testConvert()
#endif
CPPUNIT_ASSERT(!pReadAccess->HasPalette());
- Color aColor = pReadAccess->GetPixel(0, 0).GetColor();
+ Color aColor = pReadAccess->GetPixel(0, 0);
CPPUNIT_ASSERT_EQUAL(sal_Int32(204), sal_Int32(aColor.GetRed()));
CPPUNIT_ASSERT_EQUAL(sal_Int32(204), sal_Int32(aColor.GetGreen()));
CPPUNIT_ASSERT_EQUAL(sal_Int32(255), sal_Int32(aColor.GetBlue()));
@@ -584,7 +584,7 @@ bool checkBitmapColor(Bitmap const& rBitmap, Color const& rExpectedColor)
Scanline pScanlineRead = pReadAccess->GetScanline(y);
for (long x = 0; x < nWidth; ++x)
{
- Color aColor = pReadAccess->GetPixelFromData(pScanlineRead, x).GetColor();
+ Color aColor = pReadAccess->GetPixelFromData(pScanlineRead, x);
if (aColor != rExpectedColor)
bResult = false;
}
diff --git a/vcl/qa/cppunit/GraphicTest.cxx b/vcl/qa/cppunit/GraphicTest.cxx
index 428ebda0560d..3e13a1083ce5 100644
--- a/vcl/qa/cppunit/GraphicTest.cxx
+++ b/vcl/qa/cppunit/GraphicTest.cxx
@@ -116,13 +116,12 @@ void GraphicTest::testUnloadedGraphicLoading()
if (pReadAccess->HasPalette())
{
Color aColor
- = pReadAccess->GetPaletteColor(pReadAccess->GetPixelIndex(y, x))
- .GetColor();
+ = pReadAccess->GetPaletteColor(pReadAccess->GetPixelIndex(y, x));
CPPUNIT_ASSERT_EQUAL(OUString("ff0000"), aColor.AsRGBHexString());
}
else
{
- Color aColor = pReadAccess->GetPixel(y, x).GetColor();
+ Color aColor = pReadAccess->GetPixel(y, x);
if (sFormat != "jpg")
CPPUNIT_ASSERT_EQUAL(OUString("ff0000"), aColor.AsRGBHexString());
}
diff --git a/vcl/qa/cppunit/bitmapcolor.cxx b/vcl/qa/cppunit/bitmapcolor.cxx
index 2de8533ef986..eafa4d13805c 100644
--- a/vcl/qa/cppunit/bitmapcolor.cxx
+++ b/vcl/qa/cppunit/bitmapcolor.cxx
@@ -35,7 +35,6 @@ public:
void defaultConstructor();
void colorValueConstructor();
void colorClassConstructor();
- void getColor();
void setValue();
void invert();
void getLuminance();
@@ -44,7 +43,6 @@ public:
CPPUNIT_TEST(defaultConstructor);
CPPUNIT_TEST(colorValueConstructor);
CPPUNIT_TEST(colorClassConstructor);
- CPPUNIT_TEST(getColor);
CPPUNIT_TEST(setValue);
CPPUNIT_TEST(invert);
CPPUNIT_TEST(getLuminance);
@@ -149,17 +147,6 @@ void BitmapColorTest::colorClassConstructor()
}
}
-void BitmapColorTest::getColor()
-{
- BitmapColor aBitmapColor(255, 128, 64, 32);
- Color aColor = aBitmapColor.GetColor();
-
- CPPUNIT_ASSERT_EQUAL_MESSAGE("Red wrong", sal_uInt8(255), aColor.GetRed());
- CPPUNIT_ASSERT_EQUAL_MESSAGE("Green wrong", sal_uInt8(128), aColor.GetGreen());
- CPPUNIT_ASSERT_EQUAL_MESSAGE("Blue wrong", sal_uInt8(64), aColor.GetBlue());
- CPPUNIT_ASSERT_EQUAL_MESSAGE("Transparency wrong", sal_uInt8(32), aColor.GetTransparency());
-}
-
void BitmapColorTest::setValue()
{
BitmapColor aBmpColor;
@@ -177,7 +164,8 @@ void BitmapColorTest::setValue()
void BitmapColorTest::invert()
{
BitmapColor aBmpColor(255, 255, 255);
- BitmapColor aInvertedColor = aBmpColor.Invert();
+ BitmapColor aInvertedColor(aBmpColor);
+ aInvertedColor.Invert();
CPPUNIT_ASSERT_EQUAL(static_cast<sal_uInt8>(0), aInvertedColor.GetRed());
CPPUNIT_ASSERT_EQUAL(static_cast<sal_uInt8>(0), aInvertedColor.GetGreen());
@@ -203,7 +191,7 @@ void BitmapColorTest::getLuminance()
{
BitmapColor aBmpColor(COL_CYAN);
- CPPUNIT_ASSERT_EQUAL(static_cast<sal_uInt8>(89), aBmpColor.GetLuminance());
+ CPPUNIT_ASSERT_EQUAL(static_cast<sal_uInt8>(90), aBmpColor.GetLuminance());
}
{
@@ -218,7 +206,7 @@ void BitmapColorTest::getLuminance()
{
BitmapColor aBmpColor(COL_BROWN);
- CPPUNIT_ASSERT_EQUAL(static_cast<sal_uInt8>(114), aBmpColor.GetLuminance());
+ CPPUNIT_ASSERT_EQUAL(static_cast<sal_uInt8>(113), aBmpColor.GetLuminance());
}
{
@@ -233,7 +221,7 @@ void BitmapColorTest::getLuminance()
{
BitmapColor aBmpColor(COL_LIGHTBLUE);
- CPPUNIT_ASSERT_EQUAL(static_cast<sal_uInt8>(27), aBmpColor.GetLuminance());
+ CPPUNIT_ASSERT_EQUAL(static_cast<sal_uInt8>(28), aBmpColor.GetLuminance());
}
{
@@ -243,12 +231,12 @@ void BitmapColorTest::getLuminance()
{
BitmapColor aBmpColor(COL_LIGHTCYAN);
- CPPUNIT_ASSERT_EQUAL(static_cast<sal_uInt8>(178), aBmpColor.GetLuminance());
+ CPPUNIT_ASSERT_EQUAL(static_cast<sal_uInt8>(179), aBmpColor.GetLuminance());
}
{
BitmapColor aBmpColor(COL_LIGHTRED);
- CPPUNIT_ASSERT_EQUAL(static_cast<sal_uInt8>(76), aBmpColor.GetLuminance());
+ CPPUNIT_ASSERT_EQUAL(static_cast<sal_uInt8>(75), aBmpColor.GetLuminance());
}
{
@@ -258,7 +246,7 @@ void BitmapColorTest::getLuminance()
{
BitmapColor aBmpColor(COL_YELLOW);
- CPPUNIT_ASSERT_EQUAL(static_cast<sal_uInt8>(227), aBmpColor.GetLuminance());
+ CPPUNIT_ASSERT_EQUAL(static_cast<sal_uInt8>(226), aBmpColor.GetLuminance());
}
{
diff --git a/vcl/qa/cppunit/gen/gen.cxx b/vcl/qa/cppunit/gen/gen.cxx
index 37692a65d5a9..776a75a05f93 100644
--- a/vcl/qa/cppunit/gen/gen.cxx
+++ b/vcl/qa/cppunit/gen/gen.cxx
@@ -71,7 +71,7 @@ CPPUNIT_TEST_FIXTURE(GenTest, testTdf121120)
Bitmap aBitmap = load("tdf121120.png");
Bitmap::ScopedReadAccess pAccess(aBitmap);
const Size& rSize = aBitmap.GetPrefSize();
- Color aColor(pAccess->GetPixel(rSize.getWidth() / 2, rSize.getHeight() / 2).GetColor());
+ Color aColor(pAccess->GetPixel(rSize.getWidth() / 2, rSize.getHeight() / 2));
// Without the accompanying fix in place, this test would have failed with 'Expected: 255;
// Actual : 1'. I.e. center of the preview (which has the background color) was ~black, not
// white.
@@ -107,7 +107,7 @@ CPPUNIT_TEST_FIXTURE(GenTest, testTdf107966)
// Make sure that the polygon is visible.
Bitmap aBitmap = pVirtualDevice->GetBitmap(Point(), Size(1350, 15));
Bitmap::ScopedReadAccess pAccess(aBitmap);
- Color aPixel(pAccess->GetPixel(0, 0).GetColor());
+ Color aPixel(pAccess->GetPixel(0, 0));
// Without the accompanying fix in place, this test would have failed with 'Expected: 000000;
// Actual: ffffff', i.e. the top left pixel was white, not black.
CPPUNIT_ASSERT_EQUAL(OUString("000000"), aPixel.AsRGBHexString());
diff --git a/vcl/qa/cppunit/jpeg/JpegReaderTest.cxx b/vcl/qa/cppunit/jpeg/JpegReaderTest.cxx
index aa74eebf3ed3..115c6186e898 100644
--- a/vcl/qa/cppunit/jpeg/JpegReaderTest.cxx
+++ b/vcl/qa/cppunit/jpeg/JpegReaderTest.cxx
@@ -64,24 +64,24 @@ static bool checkRect(Bitmap& rBitmap, int aLayerNumber, long nAreaHeight, long
for (long y = firstY; y <= lastY; y++)
{
- Color aColorFirst = pAccess->GetPixel(y, firstX).GetColor();
+ Color aColorFirst = pAccess->GetPixel(y, firstX);
delta = deltaColor(aColorFirst, aExpectedColor);
if (delta > nMaxDelta)
return false;
- Color aColorLast = pAccess->GetPixel(y, lastX).GetColor();
+ Color aColorLast = pAccess->GetPixel(y, lastX);
delta = deltaColor(aColorLast, aExpectedColor);
if (delta > nMaxDelta)
return false;
}
for (long x = firstX; x <= lastX; x++)
{
- Color aColorFirst = pAccess->GetPixel(firstY, x).GetColor();
+ Color aColorFirst = pAccess->GetPixel(firstY, x);
delta = deltaColor(aColorFirst, aExpectedColor);
if (delta > nMaxDelta)
return false;
- Color aColorLast = pAccess->GetPixel(lastY, x).GetColor();
+ Color aColorLast = pAccess->GetPixel(lastY, x);
delta = deltaColor(aColorLast, aExpectedColor);
if (delta > nMaxDelta)
return false;
diff --git a/vcl/qa/cppunit/outdev.cxx b/vcl/qa/cppunit/outdev.cxx
index 82cfe44ead62..455169e39966 100644
--- a/vcl/qa/cppunit/outdev.cxx
+++ b/vcl/qa/cppunit/outdev.cxx
@@ -68,12 +68,12 @@ void VclOutdevTest::testVirtualDevice()
// Gotcha: y and x swap for BitmapReadAccess: deep joy.
Bitmap::ScopedReadAccess pAcc(aBmp);
- CPPUNIT_ASSERT_EQUAL(COL_WHITE, pAcc->GetPixel(0,0).GetColor());
+ CPPUNIT_ASSERT_EQUAL(COL_WHITE, static_cast<Color>(pAcc->GetPixel(0,0)));
#if defined LINUX //TODO: various failures on Mac and Windows tinderboxes
- CPPUNIT_ASSERT_EQUAL(COL_BLUE, pAcc->GetPixel(2,1).GetColor());
- CPPUNIT_ASSERT_EQUAL(COL_RED, pAcc->GetPixel(30,31).GetColor());
+ CPPUNIT_ASSERT_EQUAL(COL_BLUE, static_cast<Color>(pAcc->GetPixel(2,1)));
+ CPPUNIT_ASSERT_EQUAL(COL_RED, static_cast<Color>(pAcc->GetPixel(30,31)));
#endif
- CPPUNIT_ASSERT_EQUAL(COL_WHITE, pAcc->GetPixel(31,30).GetColor());
+ CPPUNIT_ASSERT_EQUAL(COL_WHITE, static_cast<Color>(pAcc->GetPixel(31,30)));
#if 0
VclPtr<vcl::Window> pWin = VclPtr<WorkWindow>::Create( (vcl::Window *)nullptr );
diff --git a/vcl/quartz/salbmp.cxx b/vcl/quartz/salbmp.cxx
index c47151f137b7..12daa7567f42 100644
--- a/vcl/quartz/salbmp.cxx
+++ b/vcl/quartz/salbmp.cxx
@@ -421,7 +421,7 @@ public:
// Caution(!) rPalette.GetEntryCount() may be != (depth^^2)-1 (!)
if(nIndex < mnPaletteCount)
- return mrPalette[nIndex].GetColor();
+ return mrPalette[nIndex];
else
return COL_BLACK;
}
@@ -471,7 +471,7 @@ public:
mnShift ^= 4;
if(nIndex < mnPaletteCount)
- return mrPalette[nIndex].GetColor();
+ return mrPalette[nIndex];
else
return COL_BLACK;
}
@@ -516,7 +516,7 @@ public:
mnX++;
if(nIndex < mnPaletteCount)
- return mrPalette[nIndex].GetColor();
+ return mrPalette[nIndex];
else
return COL_BLACK;
}
diff --git a/vcl/source/bitmap/BitmapLightenFilter.cxx b/vcl/source/bitmap/BitmapLightenFilter.cxx
index 52e41ae33e97..45013b143783 100644
--- a/vcl/source/bitmap/BitmapLightenFilter.cxx
+++ b/vcl/source/bitmap/BitmapLightenFilter.cxx
@@ -37,7 +37,8 @@ BitmapEx BitmapLightenFilter::execute(BitmapEx const& rBitmapEx) const
= pRead->HasPalette()
? pRead->GetPaletteColor(pRead->GetIndexFromData(pScanlineRead, nX))
: pRead->GetPixelFromData(pScanlineRead, nX);
- basegfx::BColor aBColor(aBmpColor.Invert().GetColor().getBColor());
+ aBmpColor.Invert();
+ basegfx::BColor aBColor(aBmpColor.getBColor());
aBColor = basegfx::utils::rgb2hsl(aBColor);
double fHue = aBColor.getRed();
diff --git a/vcl/source/bitmap/BitmapSolarizeFilter.cxx b/vcl/source/bitmap/BitmapSolarizeFilter.cxx
index d12986c81c9f..179868aa5e2d 100644
--- a/vcl/source/bitmap/BitmapSolarizeFilter.cxx
+++ b/vcl/source/bitmap/BitmapSolarizeFilter.cxx
@@ -32,7 +32,8 @@ BitmapEx BitmapSolarizeFilter::execute(BitmapEx const& rBitmapEx) const
if (rPal[i].GetLuminance() >= mcSolarGreyThreshold)
{
BitmapColor aCol(rPal[i]);
- pWriteAcc->SetPaletteColor(i, aCol.Invert());
+ aCol.Invert();
+ pWriteAcc->SetPaletteColor(i, aCol);
}
}
}
@@ -50,7 +51,10 @@ BitmapEx BitmapSolarizeFilter::execute(BitmapEx const& rBitmapEx) const
aCol = pWriteAcc->GetPixelFromData(pScanline, nX);
if (aCol.GetLuminance() >= mcSolarGreyThreshold)
- pWriteAcc->SetPixelOnData(pScanline, nX, aCol.Invert());
+ {
+ aCol.Invert();
+ pWriteAcc->SetPixelOnData(pScanline, nX, aCol);
+ }
}
}
}
diff --git a/vcl/source/bitmap/BitmapTools.cxx b/vcl/source/bitmap/BitmapTools.cxx
index 380d46a7f7f7..531a49bc9cc5 100644
--- a/vcl/source/bitmap/BitmapTools.cxx
+++ b/vcl/source/bitmap/BitmapTools.cxx
@@ -675,7 +675,7 @@ static bool readAlpha( BitmapReadAccess const * pAlphaReadAcc, long nY, const lo
BitmapColor const& rColor(
pAlphaReadAcc->GetPaletteColor(*pReadScan));
pReadScan++;
- nAlpha = data[ nOff ] = 255 - rColor.GetBlueOrIndex();
+ nAlpha = data[ nOff ] = 255 - rColor.GetIndex();
if( nAlpha != 255 )
bIsAlpha = true;
nOff += 4;
@@ -747,7 +747,7 @@ void CanvasCairoExtractBitmapData( BitmapEx const & aBmpEx, Bitmap & aBitmap, un
else
nAlpha = data[ nOff + 3 ] = 255;
#endif
- aColor = pBitmapReadAcc->GetPaletteColor(*pReadScan++).GetColor();
+ aColor = pBitmapReadAcc->GetPaletteColor(*pReadScan++);
#ifdef OSL_BIGENDIAN
data[ nOff++ ] = premultiply_table[nAlpha][aColor.GetRed()];
@@ -888,7 +888,7 @@ void CanvasCairoExtractBitmapData( BitmapEx const & aBmpEx, Bitmap & aBitmap, un
for( nX = 0; nX < nWidth; nX++ )
{
- aColor = pBitmapReadAcc->GetColor( nY, nX ).GetColor();
+ aColor = pBitmapReadAcc->GetColor( nY, nX );
// cairo need premultiplied color values
// TODO(rodo) handle endianness
@@ -1025,8 +1025,8 @@ void CanvasCairoExtractBitmapData( BitmapEx const & aBmpEx, Bitmap & aBitmap, un
// #i123564# background and foreground were exchanged; of course
// rPalette[0] is the background color
- o_rFront = rPalette[1].GetColor();
- o_rBack = rPalette[0].GetColor();
+ o_rFront = rPalette[1];
+ o_rBack = rPalette[0];
bRet = true;
}
diff --git a/vcl/source/bitmap/bitmappaint.cxx b/vcl/source/bitmap/bitmappaint.cxx
index 02df3c8a6b29..04b301d47d89 100644
--- a/vcl/source/bitmap/bitmappaint.cxx
+++ b/vcl/source/bitmap/bitmappaint.cxx
@@ -140,8 +140,9 @@ bool Bitmap::Invert()
Scanline pScanline = pAcc->GetScanline(nY);
for (long nX = 0; nX < nWidth; nX++)
{
- pAcc->SetPixelOnData(pScanline, nX,
- pAcc->GetPixelFromData(pScanline, nX).Invert());
+ BitmapColor aBmpColor = pAcc->GetPixelFromData(pScanline, nX);
+ aBmpColor.Invert();
+ pAcc->SetPixelOnData(pScanline, nX, aBmpColor);
}
}
}
@@ -830,9 +831,8 @@ bool Bitmap::Replace(const AlphaMask& rAlpha, const Color& rMergeColor)
for (long nX = 0; nX < nWidth; nX++)
{
aCol = pAcc->GetColor(nY, nX);
- pNewAcc->SetPixelOnData(
- pScanline, nX,
- aCol.Merge(rMergeColor, 255 - pAlphaAcc->GetIndexFromData(pScanlineAlpha, nX)));
+ aCol.Merge(rMergeColor, 255 - pAlphaAcc->GetIndexFromData(pScanlineAlpha, nX));
+ pNewAcc->SetPixelOnData(pScanline, nX, aCol);
}
}
@@ -1132,11 +1132,10 @@ bool Bitmap::Blend(const AlphaMask& rAlpha, const Color& rBackgroundColor)
Scanline pScanlineAlpha = pAlphaAcc->GetScanline(nY);
for (long nX = 0; nX < nWidth; ++nX)
{
- pAcc->SetPixelOnData(
- pScanline, nX,
- pAcc->GetPixelFromData(pScanline, nX)
- .Merge(rBackgroundColor,
- 255 - pAlphaAcc->GetIndexFromData(pScanlineAlpha, nX)));
+ BitmapColor aBmpColor = pAcc->GetPixelFromData(pScanline, nX);
+ aBmpColor.Merge(rBackgroundColor,
+ 255 - pAlphaAcc->GetIndexFromData(pScanlineAlpha, nX));
+ pAcc->SetPixelOnData(pScanline, nX, aBmpColor);
}
}
diff --git a/vcl/source/control/combobox.cxx b/vcl/source/control/combobox.cxx
index ddb644658a12..109c8374243b 100644
--- a/vcl/source/control/combobox.cxx
+++ b/vcl/source/control/combobox.cxx
@@ -1367,7 +1367,7 @@ const Wallpaper& ComboBox::GetDisplayBackground() const
const Wallpaper& rBack = m_pImpl->m_pSubEdit->GetBackground();
if( ! rBack.IsBitmap() &&
! rBack.IsGradient() &&
- rBack.GetColor() == COL_TRANSPARENT
+ rBack == COL_TRANSPARENT
)
return Control::GetDisplayBackground();
return rBack;
diff --git a/vcl/source/control/imp_listbox.cxx b/vcl/source/control/imp_listbox.cxx
index e2a78a1383f0..e7e2344f5096 100644
--- a/vcl/source/control/imp_listbox.cxx
+++ b/vcl/source/control/imp_listbox.cxx
@@ -1867,7 +1867,7 @@ void ImplListBoxWindow::DrawEntry(vcl::RenderContext& rRenderContext, sal_Int32
if ( !maSeparators.empty() && ( isSeparator(nPos) || isSeparator(nPos-1) ) )
{
Color aOldLineColor(rRenderContext.GetLineColor());
- rRenderContext.SetLineColor((GetBackground().GetColor() != COL_LIGHTGRAY) ? COL_LIGHTGRAY : COL_GRAY);
+ rRenderContext.SetLineColor((GetBackground() != COL_LIGHTGRAY) ? COL_LIGHTGRAY : COL_GRAY);
Point aStartPos(0, nY);
if (isSeparator(nPos))
aStartPos.AdjustY(pEntry->getHeightWithMargin() - 1 );
diff --git a/vcl/source/filter/igif/gifread.cxx b/vcl/source/filter/igif/gifread.cxx
index 6378e63ab021..759e572fbbd3 100644
--- a/vcl/source/filter/igif/gifread.cxx
+++ b/vcl/source/filter/igif/gifread.cxx
@@ -232,7 +232,7 @@ void GIFReader::CreateBitmaps(long nWidth, long nHeight, BitmapPalette* pPal,
aBmp8 = Bitmap(aSize, 8, pPal);
if (!!aBmp8 && bWatchForBackgroundColor && aAnimation.Count())
- aBmp8.Erase((*pPal)[nBackgroundColor].GetColor());
+ aBmp8.Erase((*pPal)[nBackgroundColor]);
else
aBmp8.Erase(COL_WHITE);
diff --git a/vcl/source/filter/png/pngread.cxx b/vcl/source/filter/png/pngread.cxx
index 58acc12c8d60..4107325bf7a9 100644
--- a/vcl/source/filter/png/pngread.cxx
+++ b/vcl/source/filter/png/pngread.cxx
@@ -843,8 +843,7 @@ void PNGReaderImpl::ImplGetBackground()
if (nCol < mxAcc->GetPaletteEntryCount())
{
- BitmapColor aBmpColor = mxAcc->GetPaletteColor(static_cast<sal_uInt8>(nCol));
- mxAcc->Erase(aBmpColor.GetColor());
+ mxAcc->Erase(mxAcc->GetPaletteColor(static_cast<sal_uInt8>(nCol)));
break;
}
}
@@ -858,9 +857,7 @@ void PNGReaderImpl::ImplGetBackground()
{
// the color type 0 and 4 is always greyscale,
// so the return value can be used as index
- sal_uInt8 nIndex = ImplScaleColor();
- BitmapColor aBmpColor = mxAcc->GetPaletteColor(nIndex);
- mxAcc->Erase(aBmpColor.GetColor());
+ mxAcc->Erase(mxAcc->GetPaletteColor(ImplScaleColor()));
}
}
break;
diff --git a/vcl/source/gdi/bitmapex.cxx b/vcl/source/gdi/bitmapex.cxx
index e5aea9401e9f..2ea870e341e6 100644
--- a/vcl/source/gdi/bitmapex.cxx
+++ b/vcl/source/gdi/bitmapex.cxx
@@ -324,7 +324,7 @@ bool BitmapEx::Invert()
bRet = maBitmap.Invert();
if (bRet && (meTransparent == TransparentType::Color))
- maTransparentColor = BitmapColor(maTransparentColor).Invert().GetColor();
+ maTransparentColor.Invert();
}
return bRet;
@@ -705,10 +705,9 @@ sal_uInt8 BitmapEx::GetTransparency(sal_Int32 nX, sal_Int32 nY) const
if(pRead)
{
const BitmapColor aBmpColor = pRead->GetColor(nY, nX);
- const Color aColor = aBmpColor.GetColor();
// If color is not equal to TransparentColor, we are not transparent
- if (aColor != maTransparentColor)
+ if (aBmpColor != maTransparentColor)
nTransparency = 0x00;
}
@@ -753,7 +752,7 @@ Color BitmapEx::GetPixelColor(sal_Int32 nX, sal_Int32 nY) const
Bitmap::ScopedReadAccess pReadAccess( const_cast<Bitmap&>(maBitmap) );
assert(pReadAccess);
- Color aColor = pReadAccess->GetColor(nY, nX).GetColor();
+ BitmapColor aColor = pReadAccess->GetColor(nY, nX);
if (IsAlpha())
{
@@ -1310,7 +1309,7 @@ void BitmapEx::setAlphaFrom( sal_uInt8 cIndexFrom, sal_Int8 nAlphaTo )
Scanline pScanlineRead = pReadAccess->GetScanline( nY );
for ( long nX = 0; nX < pReadAccess->Width(); nX++ )
{
- const sal_uInt8 cIndex = pReadAccess->GetPixelFromData( pScanlineRead, nX ).GetBlueOrIndex();
+ const sal_uInt8 cIndex = pReadAccess->GetPixelFromData( pScanlineRead, nX ).GetIndex();
if ( cIndex == cIndexFrom )
pWriteAccess->SetPixelOnData( pScanline, nX, BitmapColor(nAlphaTo) );
}
diff --git a/vcl/source/gdi/bmpacc2.cxx b/vcl/source/gdi/bmpacc2.cxx
index 4ac7b84c3e7c..0c382d08db91 100644
--- a/vcl/source/gdi/bmpacc2.cxx
+++ b/vcl/source/gdi/bmpacc2.cxx
@@ -99,7 +99,7 @@ BitmapColor BitmapReadAccess::GetPixelForN8BitPal(ConstScanline pScanline, long
void BitmapReadAccess::SetPixelForN8BitPal(Scanline pScanline, long nX, const BitmapColor& rBitmapColor, const ColorMask&)
{
- pScanline[ nX ] = rBitmapColor.GetBlueOrIndex();
+ pScanline[ nX ] = rBitmapColor.GetIndex();
}
BitmapColor BitmapReadAccess::GetPixelForN8BitTcMask(ConstScanline pScanline, long nX, const ColorMask& rMask)
diff --git a/vcl/source/gdi/print2.cxx b/vcl/source/gdi/print2.cxx
index 3ec7bbf494db..1ca7014778f5 100644
--- a/vcl/source/gdi/print2.cxx
+++ b/vcl/source/gdi/print2.cxx
@@ -221,7 +221,7 @@ void ImplConvertTransparentAction( GDIMetaFile& o_rMtf,
Color aActualColor(aBgColor);
if (pRA->HasPalette())
- aActualColor = pRA->GetBestPaletteColor(aBgColor).GetColor();
+ aActualColor = pRA->GetBestPaletteColor(aBgColor);
pRA.reset();
diff --git a/vcl/source/graphic/UnoGraphicTransformer.cxx b/vcl/source/graphic/UnoGraphicTransformer.cxx
index f50101fff6f4..13e1adbee114 100644
--- a/vcl/source/graphic/UnoGraphicTransformer.cxx
+++ b/vcl/source/graphic/UnoGraphicTransformer.cxx
@@ -56,10 +56,10 @@ uno::Reference< graphic::XGraphic > SAL_CALL GraphicTransformer::colorChange(
BitmapColor aBmpColorFrom(static_cast< sal_uInt8 >(nColorFrom), static_cast< sal_uInt8 >(nColorFrom >> 8), static_cast< sal_uInt8 >(nColorFrom >> 16));
BitmapColor aBmpColorTo( static_cast< sal_uInt8 >(nColorTo), static_cast< sal_uInt8 >(nColorTo >> 8), static_cast< sal_uInt8 >(nColorTo >> 16));
- Color aColorFrom(aBmpColorFrom.GetColor());
- Color aColorTo(aBmpColorTo.GetColor());
+ Color aColorFrom(aBmpColorFrom);
+ Color aColorTo(aBmpColorTo);
- const sal_uInt8 cIndexFrom = aBmpColorFrom.GetBlueOrIndex();
+ const sal_uInt8 cIndexFrom = aBmpColorFrom.GetIndex();
if (aGraphic.GetType() == GraphicType::Bitmap ||
aGraphic.GetType() == GraphicType::GdiMetafile)
diff --git a/vcl/source/outdev/bitmap.cxx b/vcl/source/outdev/bitmap.cxx
index 0e57b2a9f203..5322a0a29cea 100644
--- a/vcl/source/outdev/bitmap.cxx
+++ b/vcl/source/outdev/bitmap.cxx
@@ -1580,8 +1580,8 @@ Bitmap OutputDevice::BlendBitmap(
nMapX = aBmpRect.Right() - nMapX;
}
aDstCol = pB->GetPixelFromData( pBScan, nX );
- pB->SetPixelOnData( pBScan, nX, aDstCol.Merge( pP->GetPaletteColor( pPScan[ nMapX ] ),
- pAScan[ nMapX ] ) );
+ aDstCol.Merge( pP->GetPaletteColor( pPScan[ nMapX ] ), pAScan[ nMapX ] );
+ pB->SetPixelOnData( pBScan, nX, aDstCol );
}
}
}
@@ -1609,8 +1609,8 @@ Bitmap OutputDevice::BlendBitmap(
nMapX = aBmpRect.Right() - nMapX;
}
aDstCol = pB->GetPixelFromData( pBScan, nX );
- pB->SetPixelOnData( pBScan, nX, aDstCol.Merge( pP->GetColor( nMapY, nMapX ),
- pAScan[ nMapX ] ) );
+ aDstCol.Merge( pP->GetColor( nMapY, nMapX ), pAScan[ nMapX ] );
+ pB->SetPixelOnData( pBScan, nX, aDstCol );
}
}
}
diff --git a/vcl/source/outdev/transparent.cxx b/vcl/source/outdev/transparent.cxx
index 205de6baaec1..a2fbbf6c6ac2 100644
--- a/vcl/source/outdev/transparent.cxx
+++ b/vcl/source/outdev/transparent.cxx
@@ -523,7 +523,8 @@ void OutputDevice::EmulateDrawTransparent ( const tools::PolyPolygon& rPolyPoly,
for( sal_uInt16 i = 0; i < nCount; i++ )
{
BitmapColor aCol( rPal[ i ] );
- pMap[ i ] = BitmapColor( static_cast<sal_uInt8>(rPal.GetBestIndex( aCol.Merge( aFillCol, cTrans ) )) );
+ aCol.Merge( aFillCol, cTrans );
+ pMap[ i ] = BitmapColor( static_cast<sal_uInt8>(rPal.GetBestIndex( aCol )) );
}
if( pR->GetScanlineFormat() == ScanlineFormat::N1BitMsbPal &&
@@ -608,7 +609,8 @@ void OutputDevice::EmulateDrawTransparent ( const tools::PolyPolygon& rPolyPoly,
if( pR->GetPixelFromData( pScanlineRead, nX ) == aBlack )
{
aPixCol = pW->GetColor( nY, nX );
- pW->SetPixelOnData(pScanline, nX, aPixCol.Merge( aFillCol, cTrans ) );
+ aPixCol.Merge(aFillCol, cTrans);
+ pW->SetPixelOnData(pScanline, nX, aPixCol);
}
}
}
diff --git a/vcl/unx/generic/gdi/gdiimpl.cxx b/vcl/unx/generic/gdi/gdiimpl.cxx
index e99551e00426..aaca35a5e3ba 100644
--- a/vcl/unx/generic/gdi/gdiimpl.cxx
+++ b/vcl/unx/generic/gdi/gdiimpl.cxx
@@ -112,10 +112,10 @@ namespace
if (rPalette.GetEntryCount() == 2)
{
const BitmapColor aWhite(rPalette[rPalette.GetBestIndex(COL_WHITE)]);
- rValues.foreground = rColMap.GetPixel(aWhite.GetColor());
+ rValues.foreground = rColMap.GetPixel(aWhite);
const BitmapColor aBlack(rPalette[rPalette.GetBestIndex(COL_BLACK)]);
- rValues.background = rColMap.GetPixel(aBlack.GetColor());
+ rValues.background = rColMap.GetPixel(aBlack);
}
rBitmap.ReleaseBuffer(pBitmapBuffer, BitmapAccessMode::Read);
}
diff --git a/vcl/win/gdi/gdiimpl.cxx b/vcl/win/gdi/gdiimpl.cxx
index 835c84013c59..10efebc5cf47 100644
--- a/vcl/win/gdi/gdiimpl.cxx
+++ b/vcl/win/gdi/gdiimpl.cxx
@@ -576,9 +576,9 @@ void ImplDrawBitmap( HDC hDC, const SalTwoRect& rPosAry, const WinSalBitmap& rSa
const BitmapPalette& rPalette = pBitmapBuffer->maPalette;
if (rPalette.GetEntryCount() == 2)
{
- Color nCol = rPalette[0].GetColor();
+ Color nCol = rPalette[0];
nTextColor = RGB( nCol.GetRed(), nCol.GetGreen(), nCol.GetBlue() );
- nCol = rPalette[1].GetColor();
+ nCol = rPalette[1];
nBkColor = RGB( nCol.GetRed(), nCol.GetGreen(), nCol.GetBlue() );
}
const_cast<WinSalBitmap&>(rSalBitmap).ReleaseBuffer(pBitmapBuffer, BitmapAccessMode::Info);