diff options
Diffstat (limited to 'vcl')
28 files changed, 153 insertions, 143 deletions
diff --git a/vcl/backendtest/outputdevice/common.cxx b/vcl/backendtest/outputdevice/common.cxx index 256aede7e863..ac2646498642 100644 --- a/vcl/backendtest/outputdevice/common.cxx +++ b/vcl/backendtest/outputdevice/common.cxx @@ -35,19 +35,19 @@ void checkValue(Bitmap::ScopedWriteAccess& pAccess, int x, int y, Color aExpecte if (nColorDelta <= nColorDeltaThresh) { if (bColorize) - pAccess->SetPixel(y, x, Color(COL_LIGHTGREEN)); + pAccess->SetPixel(y, x, COL_LIGHTGREEN); } else if (bQuirkMode) { nNumberOfQuirks++; if (bColorize) - pAccess->SetPixel(y, x, Color(COL_YELLOW)); + pAccess->SetPixel(y, x, COL_YELLOW); } else { nNumberOfErrors++; if (bColorize) - pAccess->SetPixel(y, x, Color(COL_LIGHTRED)); + pAccess->SetPixel(y, x, COL_LIGHTRED); } } diff --git a/vcl/headless/svpgdi.cxx b/vcl/headless/svpgdi.cxx index 2c6dd2486ff5..a532ce7c2358 100644 --- a/vcl/headless/svpgdi.cxx +++ b/vcl/headless/svpgdi.cxx @@ -123,7 +123,7 @@ namespace void Toggle1BitTransparency(const BitmapBuffer& rBuf) { - assert(rBuf.maPalette.GetBestIndex(BitmapColor(Color(COL_BLACK))) == 0); + assert(rBuf.maPalette.GetBestIndex(BitmapColor(COL_BLACK)) == 0); // TODO: make upper layers use standard alpha if (getCairoFormat(rBuf) == CAIRO_FORMAT_A1) { @@ -329,7 +329,7 @@ namespace pAlphaBits.reset( new unsigned char[nImageSize] ); memcpy(pAlphaBits.get(), pMaskBuf->mpBits, nImageSize); - const sal_Int32 nBlackIndex = pMaskBuf->maPalette.GetBestIndex(BitmapColor(Color(COL_BLACK))); + const sal_Int32 nBlackIndex = pMaskBuf->maPalette.GetBestIndex(BitmapColor(COL_BLACK)); if (nBlackIndex == 0) { // TODO: make upper layers use standard alpha @@ -1073,7 +1073,7 @@ void SvpSalGraphics::applyColor(cairo_t *cr, SalColor aColor) } else { - double fSet = aColor == COL_BLACK ? 1.0 : 0.0; + double fSet = aColor == sal_uInt32(COL_BLACK) ? 1.0 : 0.0; cairo_set_source_rgba(cr, 1, 1, 1, fSet); cairo_set_operator(cr, CAIRO_OPERATOR_SOURCE); } @@ -1301,8 +1301,8 @@ SalBitmap* SvpSalGraphics::getBitmap( long nX, long nY, long nWidth, long nHeigh if (GetBitCount() == 1) { aPal.SetEntryCount(2); - aPal[0] = Color(COL_BLACK); - aPal[1] = Color(COL_WHITE); + aPal[0] = COL_BLACK; + aPal[1] = COL_WHITE; } if (!pBitmap->Create(Size(nWidth, nHeight), GetBitCount(), aPal)) diff --git a/vcl/inc/quartz/salgdicommon.hxx b/vcl/inc/quartz/salgdicommon.hxx index 47cbd9cb7c75..c73e07516cf0 100644 --- a/vcl/inc/quartz/salgdicommon.hxx +++ b/vcl/inc/quartz/salgdicommon.hxx @@ -30,12 +30,14 @@ #endif #include <postmac.h> +#include <tools/color.hxx> #include <vcl/salgtype.hxx> // abstracting quartz color instead of having to use an CGFloat[] array class RGBAColor { public: + RGBAColor( ::Color ); RGBAColor( SalColor ); RGBAColor( float fRed, float fGreen, float fBlue, float fAlpha ); //NOTUSEDYET const CGFloat* AsArray() const { return m_fRGBA; } @@ -58,6 +60,14 @@ inline RGBAColor::RGBAColor( SalColor nSalColor ) m_fRGBA[3] = 1.0; // opaque } +inline RGBAColor::RGBAColor( ::Color nColor ) +{ + m_fRGBA[0] = nColor.GetRed() * (1.0/255); + m_fRGBA[1] = nColor.GetGreen() * (1.0/255); + m_fRGBA[2] = nColor.GetBlue() * (1.0/255); + m_fRGBA[3] = 1.0; // opaque +} + inline RGBAColor::RGBAColor( float fRed, float fGreen, float fBlue, float fAlpha ) { m_fRGBA[0] = fRed; diff --git a/vcl/osx/a11ytextattributeswrapper.mm b/vcl/osx/a11ytextattributeswrapper.mm index 8605405d9454..1af27ad4f247 100644 --- a/vcl/osx/a11ytextattributeswrapper.mm +++ b/vcl/osx/a11ytextattributeswrapper.mm @@ -168,7 +168,7 @@ using namespace ::com::sun::star::uno; } +(void)addColor:(SalColor)nSalColor forAttribute:(NSString *)attribute andRange:(NSRange)range toString:(NSMutableAttributedString *)string { - if( nSalColor == COL_TRANSPARENT ) + if( nSalColor == sal_uInt32(COL_TRANSPARENT) ) return; const RGBAColor aRGBAColor( nSalColor); CGColorRef aColorRef = CGColorCreate ( CGColorSpaceCreateWithName ( kCGColorSpaceGenericRGB ), aRGBAColor.AsArray() ); diff --git a/vcl/qa/cppunit/BitmapTest.cxx b/vcl/qa/cppunit/BitmapTest.cxx index 12a03e5aa524..726ce8bf524e 100644 --- a/vcl/qa/cppunit/BitmapTest.cxx +++ b/vcl/qa/cppunit/BitmapTest.cxx @@ -176,64 +176,64 @@ void BitmapTest::testMonochrome() BitmapWriteAccess aBmpAccess(aBmp); // row 1 - aBmpAccess.SetPixel(0, 0, BitmapColor(Color(COL_BLACK))); - aBmpAccess.SetPixel(0, 1, BitmapColor(Color(COL_BLUE))); - aBmpAccess.SetPixel(0, 2, BitmapColor(Color(COL_GREEN))); - aBmpAccess.SetPixel(0, 3, BitmapColor(Color(COL_CYAN))); + aBmpAccess.SetPixel(0, 0, BitmapColor(COL_BLACK)); + aBmpAccess.SetPixel(0, 1, BitmapColor(COL_BLUE)); + aBmpAccess.SetPixel(0, 2, BitmapColor(COL_GREEN)); + aBmpAccess.SetPixel(0, 3, BitmapColor(COL_CYAN)); // row 2 - aBmpAccess.SetPixel(1, 0, BitmapColor(Color(COL_RED))); - aBmpAccess.SetPixel(1, 1, BitmapColor(Color(COL_MAGENTA))); - aBmpAccess.SetPixel(1, 2, BitmapColor(Color(COL_BROWN))); - aBmpAccess.SetPixel(1, 3, BitmapColor(Color(COL_GRAY))); + aBmpAccess.SetPixel(1, 0, BitmapColor(COL_RED)); + aBmpAccess.SetPixel(1, 1, BitmapColor(COL_MAGENTA)); + aBmpAccess.SetPixel(1, 2, BitmapColor(COL_BROWN)); + aBmpAccess.SetPixel(1, 3, BitmapColor(COL_GRAY)); // row 3 - aBmpAccess.SetPixel(2, 0, BitmapColor(Color(COL_LIGHTGRAY))); - aBmpAccess.SetPixel(2, 1, BitmapColor(Color(COL_LIGHTBLUE))); - aBmpAccess.SetPixel(2, 2, BitmapColor(Color(COL_LIGHTGREEN))); - aBmpAccess.SetPixel(2, 3, BitmapColor(Color(COL_LIGHTCYAN))); + aBmpAccess.SetPixel(2, 0, BitmapColor(COL_LIGHTGRAY)); + aBmpAccess.SetPixel(2, 1, BitmapColor(COL_LIGHTBLUE)); + aBmpAccess.SetPixel(2, 2, BitmapColor(COL_LIGHTGREEN)); + aBmpAccess.SetPixel(2, 3, BitmapColor(COL_LIGHTCYAN)); // row 4 - aBmpAccess.SetPixel(3, 0, BitmapColor(Color(COL_LIGHTRED))); - aBmpAccess.SetPixel(3, 1, BitmapColor(Color(COL_LIGHTMAGENTA))); - aBmpAccess.SetPixel(3, 2, BitmapColor(Color(COL_YELLOW))); - aBmpAccess.SetPixel(3, 3, BitmapColor(Color(COL_WHITE))); + aBmpAccess.SetPixel(3, 0, BitmapColor(COL_LIGHTRED)); + aBmpAccess.SetPixel(3, 1, BitmapColor(COL_LIGHTMAGENTA)); + aBmpAccess.SetPixel(3, 2, BitmapColor(COL_YELLOW)); + aBmpAccess.SetPixel(3, 3, BitmapColor(COL_WHITE)); aBmp.MakeMonochrome(63); BitmapReadAccess aBmpReadAccess(aBmp); - CPPUNIT_ASSERT_EQUAL_MESSAGE("Black pixel wrong monochrome value", - BitmapColor(Color(COL_BLACK)), aBmpReadAccess.GetColor(0, 0)); - CPPUNIT_ASSERT_EQUAL_MESSAGE("Blue pixel wrong monochrome value", BitmapColor(Color(COL_BLACK)), + CPPUNIT_ASSERT_EQUAL_MESSAGE("Black pixel wrong monochrome value", BitmapColor(COL_BLACK), + aBmpReadAccess.GetColor(0, 0)); + CPPUNIT_ASSERT_EQUAL_MESSAGE("Blue pixel wrong monochrome value", BitmapColor(COL_BLACK), aBmpReadAccess.GetColor(0, 1)); - CPPUNIT_ASSERT_EQUAL_MESSAGE("Green pixel wrong monochrome value", - BitmapColor(Color(COL_WHITE)), aBmpReadAccess.GetColor(0, 2)); - CPPUNIT_ASSERT_EQUAL_MESSAGE("Cyan pixel wrong monochrome value", BitmapColor(Color(COL_WHITE)), + CPPUNIT_ASSERT_EQUAL_MESSAGE("Green pixel wrong monochrome value", BitmapColor(COL_WHITE), + aBmpReadAccess.GetColor(0, 2)); + CPPUNIT_ASSERT_EQUAL_MESSAGE("Cyan pixel wrong monochrome value", BitmapColor(COL_WHITE), aBmpReadAccess.GetColor(0, 3)); - CPPUNIT_ASSERT_EQUAL_MESSAGE("Red pixel wrong monochrome value", BitmapColor(Color(COL_BLACK)), + CPPUNIT_ASSERT_EQUAL_MESSAGE("Red pixel wrong monochrome value", BitmapColor(COL_BLACK), aBmpReadAccess.GetColor(1, 0)); - CPPUNIT_ASSERT_EQUAL_MESSAGE("Magenta pixel wrong monochrome value", - BitmapColor(Color(COL_BLACK)), aBmpReadAccess.GetColor(1, 1)); - CPPUNIT_ASSERT_EQUAL_MESSAGE("Brown pixel wrong monochrome value", - BitmapColor(Color(COL_WHITE)), aBmpReadAccess.GetColor(1, 2)); - CPPUNIT_ASSERT_EQUAL_MESSAGE("Gray pixel wrong monochrome value", BitmapColor(Color(COL_WHITE)), + CPPUNIT_ASSERT_EQUAL_MESSAGE("Magenta pixel wrong monochrome value", BitmapColor(COL_BLACK), + aBmpReadAccess.GetColor(1, 1)); + CPPUNIT_ASSERT_EQUAL_MESSAGE("Brown pixel wrong monochrome value", BitmapColor(COL_WHITE), + aBmpReadAccess.GetColor(1, 2)); + CPPUNIT_ASSERT_EQUAL_MESSAGE("Gray pixel wrong monochrome value", BitmapColor(COL_WHITE), aBmpReadAccess.GetColor(1, 3)); - CPPUNIT_ASSERT_EQUAL_MESSAGE("Light gray pixel wrong monochrome value", - BitmapColor(Color(COL_WHITE)), aBmpReadAccess.GetColor(2, 0)); - CPPUNIT_ASSERT_EQUAL_MESSAGE("Light blue pixel wrong monochrome value", - BitmapColor(Color(COL_BLACK)), aBmpReadAccess.GetColor(2, 1)); - CPPUNIT_ASSERT_EQUAL_MESSAGE("Light green pixel wrong monochrome value", - BitmapColor(Color(COL_WHITE)), aBmpReadAccess.GetColor(2, 2)); - CPPUNIT_ASSERT_EQUAL_MESSAGE("Light cyan pixel wrong monochrome value", - BitmapColor(Color(COL_WHITE)), aBmpReadAccess.GetColor(2, 3)); - CPPUNIT_ASSERT_EQUAL_MESSAGE("Light red pixel wrong monochrome value", - BitmapColor(Color(COL_WHITE)), aBmpReadAccess.GetColor(3, 0)); + CPPUNIT_ASSERT_EQUAL_MESSAGE("Light gray pixel wrong monochrome value", BitmapColor(COL_WHITE), + aBmpReadAccess.GetColor(2, 0)); + CPPUNIT_ASSERT_EQUAL_MESSAGE("Light blue pixel wrong monochrome value", BitmapColor(COL_BLACK), + aBmpReadAccess.GetColor(2, 1)); + CPPUNIT_ASSERT_EQUAL_MESSAGE("Light green pixel wrong monochrome value", BitmapColor(COL_WHITE), + aBmpReadAccess.GetColor(2, 2)); + CPPUNIT_ASSERT_EQUAL_MESSAGE("Light cyan pixel wrong monochrome value", BitmapColor(COL_WHITE), + aBmpReadAccess.GetColor(2, 3)); + CPPUNIT_ASSERT_EQUAL_MESSAGE("Light red pixel wrong monochrome value", BitmapColor(COL_WHITE), + aBmpReadAccess.GetColor(3, 0)); CPPUNIT_ASSERT_EQUAL_MESSAGE("Light magenta pixel wrong monochrome value", - BitmapColor(Color(COL_WHITE)), aBmpReadAccess.GetColor(3, 1)); - CPPUNIT_ASSERT_EQUAL_MESSAGE("Yellow pixel wrong monochrome value", - BitmapColor(Color(COL_WHITE)), aBmpReadAccess.GetColor(3, 2)); - CPPUNIT_ASSERT_EQUAL_MESSAGE("White pixel wrong monochrome value", - BitmapColor(Color(COL_WHITE)), aBmpReadAccess.GetColor(3, 3)); + BitmapColor(COL_WHITE), aBmpReadAccess.GetColor(3, 1)); + CPPUNIT_ASSERT_EQUAL_MESSAGE("Yellow pixel wrong monochrome value", BitmapColor(COL_WHITE), + aBmpReadAccess.GetColor(3, 2)); + CPPUNIT_ASSERT_EQUAL_MESSAGE("White pixel wrong monochrome value", BitmapColor(COL_WHITE), + aBmpReadAccess.GetColor(3, 3)); } void BitmapTest::testConvert() diff --git a/vcl/qa/cppunit/bitmapcolor.cxx b/vcl/qa/cppunit/bitmapcolor.cxx index d03aa2960953..d4594fa22c02 100644 --- a/vcl/qa/cppunit/bitmapcolor.cxx +++ b/vcl/qa/cppunit/bitmapcolor.cxx @@ -162,82 +162,82 @@ void BitmapColorTest::invert() void BitmapColorTest::getLuminance() { { - BitmapColor aBmpColor(Color(COL_BLACK)); + BitmapColor aBmpColor(COL_BLACK); CPPUNIT_ASSERT_EQUAL(static_cast<sal_uInt8>(0), aBmpColor.GetLuminance()); } { - BitmapColor aBmpColor(Color(COL_BLUE)); + BitmapColor aBmpColor(COL_BLUE); CPPUNIT_ASSERT_EQUAL(static_cast<sal_uInt8>(14), aBmpColor.GetLuminance()); } { - BitmapColor aBmpColor(Color(COL_GREEN)); + BitmapColor aBmpColor(COL_GREEN); CPPUNIT_ASSERT_EQUAL(static_cast<sal_uInt8>(75), aBmpColor.GetLuminance()); } { - BitmapColor aBmpColor(Color(COL_CYAN)); + BitmapColor aBmpColor(COL_CYAN); CPPUNIT_ASSERT_EQUAL(static_cast<sal_uInt8>(89), aBmpColor.GetLuminance()); } { - BitmapColor aBmpColor(Color(COL_RED)); + BitmapColor aBmpColor(COL_RED); CPPUNIT_ASSERT_EQUAL(static_cast<sal_uInt8>(38), aBmpColor.GetLuminance()); } { - BitmapColor aBmpColor(Color(COL_MAGENTA)); + BitmapColor aBmpColor(COL_MAGENTA); CPPUNIT_ASSERT_EQUAL(static_cast<sal_uInt8>(52), aBmpColor.GetLuminance()); } { - BitmapColor aBmpColor(Color(COL_BROWN)); + BitmapColor aBmpColor(COL_BROWN); CPPUNIT_ASSERT_EQUAL(static_cast<sal_uInt8>(114), aBmpColor.GetLuminance()); } { - BitmapColor aBmpColor(Color(COL_GRAY)); + BitmapColor aBmpColor(COL_GRAY); CPPUNIT_ASSERT_EQUAL(static_cast<sal_uInt8>(128), aBmpColor.GetLuminance()); } { - BitmapColor aBmpColor(Color(COL_LIGHTGRAY)); + BitmapColor aBmpColor(COL_LIGHTGRAY); CPPUNIT_ASSERT_EQUAL(static_cast<sal_uInt8>(192), aBmpColor.GetLuminance()); } { - BitmapColor aBmpColor(Color(COL_LIGHTBLUE)); + BitmapColor aBmpColor(COL_LIGHTBLUE); CPPUNIT_ASSERT_EQUAL(static_cast<sal_uInt8>(27), aBmpColor.GetLuminance()); } { - BitmapColor aBmpColor(Color(COL_LIGHTGREEN)); + BitmapColor aBmpColor(COL_LIGHTGREEN); CPPUNIT_ASSERT_EQUAL(static_cast<sal_uInt8>(150), aBmpColor.GetLuminance()); } { - BitmapColor aBmpColor(Color(COL_LIGHTCYAN)); + BitmapColor aBmpColor(COL_LIGHTCYAN); CPPUNIT_ASSERT_EQUAL(static_cast<sal_uInt8>(178), aBmpColor.GetLuminance()); } { - BitmapColor aBmpColor(Color(COL_LIGHTRED)); + BitmapColor aBmpColor(COL_LIGHTRED); CPPUNIT_ASSERT_EQUAL(static_cast<sal_uInt8>(76), aBmpColor.GetLuminance()); } { - BitmapColor aBmpColor(Color(COL_LIGHTMAGENTA)); + BitmapColor aBmpColor(COL_LIGHTMAGENTA); CPPUNIT_ASSERT_EQUAL(static_cast<sal_uInt8>(104), aBmpColor.GetLuminance()); } { - BitmapColor aBmpColor(Color(COL_YELLOW)); + BitmapColor aBmpColor(COL_YELLOW); CPPUNIT_ASSERT_EQUAL(static_cast<sal_uInt8>(227), aBmpColor.GetLuminance()); } { - BitmapColor aBmpColor(Color(COL_WHITE)); + BitmapColor aBmpColor(COL_WHITE); CPPUNIT_ASSERT_EQUAL(static_cast<sal_uInt8>(255), aBmpColor.GetLuminance()); } } diff --git a/vcl/qa/cppunit/canvasbitmaptest.cxx b/vcl/qa/cppunit/canvasbitmaptest.cxx index 475db74c94a3..192aa1d58c1f 100644 --- a/vcl/qa/cppunit/canvasbitmaptest.cxx +++ b/vcl/qa/cppunit/canvasbitmaptest.cxx @@ -653,8 +653,8 @@ void CanvasBitmapTest::runTest() } else { - aBlack = Color(COL_BLACK); - aWhite = Color(COL_WHITE); + aBlack = COL_BLACK; + aWhite = COL_WHITE; } pAcc->SetFillColor(COL_GREEN); pAcc->FillRect(tools::Rectangle(0,0,100,100)); diff --git a/vcl/qa/cppunit/outdev.cxx b/vcl/qa/cppunit/outdev.cxx index c2004f6ef012..07f056326a8f 100644 --- a/vcl/qa/cppunit/outdev.cxx +++ b/vcl/qa/cppunit/outdev.cxx @@ -56,21 +56,21 @@ void VclOutdevTest::testVirtualDevice() } #endif - CPPUNIT_ASSERT_EQUAL(Color(COL_WHITE), pVDev->GetPixel(Point(0,0))); + CPPUNIT_ASSERT_EQUAL(COL_WHITE, pVDev->GetPixel(Point(0,0))); #if defined LINUX //TODO: various failures on Mac and Windows tinderboxes - CPPUNIT_ASSERT_EQUAL(Color(COL_BLUE), pVDev->GetPixel(Point(1,2))); - CPPUNIT_ASSERT_EQUAL(Color(COL_RED), pVDev->GetPixel(Point(31,30))); + CPPUNIT_ASSERT_EQUAL(COL_BLUE, pVDev->GetPixel(Point(1,2))); + CPPUNIT_ASSERT_EQUAL(COL_RED, pVDev->GetPixel(Point(31,30))); #endif - CPPUNIT_ASSERT_EQUAL(Color(COL_WHITE), pVDev->GetPixel(Point(30,31))); + CPPUNIT_ASSERT_EQUAL(COL_WHITE, pVDev->GetPixel(Point(30,31))); // Gotcha: y and x swap for BitmapReadAccess: deep joy. Bitmap::ScopedReadAccess pAcc(aBmp); - CPPUNIT_ASSERT_EQUAL(Color(COL_WHITE), pAcc->GetPixel(0,0).GetColor()); + CPPUNIT_ASSERT_EQUAL(COL_WHITE, pAcc->GetPixel(0,0).GetColor()); #if defined LINUX //TODO: various failures on Mac and Windows tinderboxes - CPPUNIT_ASSERT_EQUAL(Color(COL_BLUE), pAcc->GetPixel(2,1).GetColor()); - CPPUNIT_ASSERT_EQUAL(Color(COL_RED), pAcc->GetPixel(30,31).GetColor()); + CPPUNIT_ASSERT_EQUAL(COL_BLUE, pAcc->GetPixel(2,1).GetColor()); + CPPUNIT_ASSERT_EQUAL(COL_RED, pAcc->GetPixel(30,31).GetColor()); #endif - CPPUNIT_ASSERT_EQUAL(Color(COL_WHITE), pAcc->GetPixel(31,30).GetColor()); + CPPUNIT_ASSERT_EQUAL(COL_WHITE, pAcc->GetPixel(31,30).GetColor()); #if 0 VclPtr<vcl::Window> pWin = VclPtr<WorkWindow>::Create( (vcl::Window *)nullptr ); diff --git a/vcl/quartz/salgdicommon.cxx b/vcl/quartz/salgdicommon.cxx index d8c539a79d98..bbac31eb1f65 100644 --- a/vcl/quartz/salgdicommon.cxx +++ b/vcl/quartz/salgdicommon.cxx @@ -1493,7 +1493,7 @@ SalColor AquaSalGraphics::getPixel( long nX, long nY ) if( !mxLayer || (nX < 0) || (nX >= mnWidth) || (nY < 0) || (nY >= mnHeight)) { - return COL_BLACK; + return sal_uInt32(COL_BLACK); } // prepare creation of matching a CGBitmapContext #if defined OSL_BIGENDIAN diff --git a/vcl/source/control/combobox.cxx b/vcl/source/control/combobox.cxx index 91f37289f8a2..7b14c8da64c2 100644 --- a/vcl/source/control/combobox.cxx +++ b/vcl/source/control/combobox.cxx @@ -1335,7 +1335,7 @@ const Wallpaper& ComboBox::GetDisplayBackground() const const Wallpaper& rBack = m_pImpl->m_pSubEdit->GetBackground(); if( ! rBack.IsBitmap() && ! rBack.IsGradient() && - rBack.GetColor().GetColor() == COL_TRANSPARENT + rBack.GetColor() == COL_TRANSPARENT ) return Control::GetDisplayBackground(); return rBack; diff --git a/vcl/source/filter/igif/gifread.cxx b/vcl/source/filter/igif/gifread.cxx index 7b73b990233e..30ba1116eeb6 100644 --- a/vcl/source/filter/igif/gifread.cxx +++ b/vcl/source/filter/igif/gifread.cxx @@ -300,10 +300,10 @@ void GIFReader::ReadPaletteEntries( BitmapPalette* pPal, sal_uLong nCount ) // if possible accommodate some standard colours if( nCount < 256 ) { - (*pPal)[ 255UL ] = Color(COL_WHITE); + (*pPal)[ 255UL ] = COL_WHITE; if( nCount < 255 ) - (*pPal)[ 254UL ] = Color(COL_BLACK); + (*pPal)[ 254UL ] = COL_BLACK; } } } diff --git a/vcl/source/filter/ixbm/xbmread.cxx b/vcl/source/filter/ixbm/xbmread.cxx index a8e88e9c48ee..950bbb5c0f09 100644 --- a/vcl/source/filter/ixbm/xbmread.cxx +++ b/vcl/source/filter/ixbm/xbmread.cxx @@ -327,8 +327,8 @@ ReadState XBMReader::ReadXBM( Graphic& rGraphic ) if( pAcc1 ) { - aWhite = pAcc1->GetBestMatchingColor( Color(COL_WHITE) ); - aBlack = pAcc1->GetBestMatchingColor( Color(COL_BLACK) ); + aWhite = pAcc1->GetBestMatchingColor( COL_WHITE ); + aBlack = pAcc1->GetBestMatchingColor( COL_BLACK ); bStatus = ParseData( &rIStm, aLine, eFormat ); } else diff --git a/vcl/source/filter/ixpm/xpmread.cxx b/vcl/source/filter/ixpm/xpmread.cxx index 1d51fa0d6752..d627bd31db08 100644 --- a/vcl/source/filter/ixpm/xpmread.cxx +++ b/vcl/source/filter/ixpm/xpmread.cxx @@ -298,8 +298,8 @@ bool XPMReader::ImplGetScanLine( sal_uLong nY ) { if ( mpMaskAcc ) { - aWhite = mpMaskAcc->GetBestMatchingColor( Color(COL_WHITE) ); - aBlack = mpMaskAcc->GetBestMatchingColor( Color(COL_BLACK) ); + aWhite = mpMaskAcc->GetBestMatchingColor( COL_WHITE ); + aBlack = mpMaskAcc->GetBestMatchingColor( COL_BLACK ); } if ( mnStringSize != ( mnWidth * mnCpp )) bStatus = false; diff --git a/vcl/source/gdi/alpha.cxx b/vcl/source/gdi/alpha.cxx index 899795675405..05207c39256f 100644 --- a/vcl/source/gdi/alpha.cxx +++ b/vcl/source/gdi/alpha.cxx @@ -95,7 +95,7 @@ bool AlphaMask::Replace( const Bitmap& rMask, sal_uInt8 cReplaceTransparency ) const BitmapColor aReplace( cReplaceTransparency ); const long nWidth = std::min( pMaskAcc->Width(), pAcc->Width() ); const long nHeight = std::min( pMaskAcc->Height(), pAcc->Height() ); - const BitmapColor aMaskWhite( pMaskAcc->GetBestMatchingColor( Color(COL_WHITE) ) ); + const BitmapColor aMaskWhite( pMaskAcc->GetBestMatchingColor( COL_WHITE ) ); for( long nY = 0; nY < nHeight; nY++ ) { diff --git a/vcl/source/gdi/bitmap.cxx b/vcl/source/gdi/bitmap.cxx index e631d0593999..bf670f20ffce 100644 --- a/vcl/source/gdi/bitmap.cxx +++ b/vcl/source/gdi/bitmap.cxx @@ -65,28 +65,28 @@ Bitmap::Bitmap( const Size& rSizePixel, sal_uInt16 nBitCount, const BitmapPalett if( 1 == nBitCount ) { aPal.SetEntryCount( 2 ); - aPal[ 0 ] = Color(COL_BLACK); - aPal[ 1 ] = Color(COL_WHITE); + aPal[ 0 ] = COL_BLACK; + aPal[ 1 ] = COL_WHITE; } else if( ( 4 == nBitCount ) || ( 8 == nBitCount ) ) { aPal.SetEntryCount( 1 << nBitCount ); - aPal[ 0 ] = Color(COL_BLACK); - aPal[ 1 ] = Color(COL_BLUE); - aPal[ 2 ] = Color(COL_GREEN); - aPal[ 3 ] = Color(COL_CYAN); - aPal[ 4 ] = Color(COL_RED); - aPal[ 5 ] = Color(COL_MAGENTA); - aPal[ 6 ] = Color(COL_BROWN); - aPal[ 7 ] = Color(COL_GRAY); - aPal[ 8 ] = Color(COL_LIGHTGRAY); - aPal[ 9 ] = Color(COL_LIGHTBLUE); - aPal[ 10 ] = Color(COL_LIGHTGREEN); - aPal[ 11 ] = Color(COL_LIGHTCYAN); - aPal[ 12 ] = Color(COL_LIGHTRED); - aPal[ 13 ] = Color(COL_LIGHTMAGENTA); - aPal[ 14 ] = Color(COL_YELLOW); - aPal[ 15 ] = Color(COL_WHITE); + aPal[ 0 ] = COL_BLACK; + aPal[ 1 ] = COL_BLUE; + aPal[ 2 ] = COL_GREEN; + aPal[ 3 ] = COL_CYAN; + aPal[ 4 ] = COL_RED; + aPal[ 5 ] = COL_MAGENTA; + aPal[ 6 ] = COL_BROWN; + aPal[ 7 ] = COL_GRAY; + aPal[ 8 ] = COL_LIGHTGRAY; + aPal[ 9 ] = COL_LIGHTBLUE; + aPal[ 10 ] = COL_LIGHTGREEN; + aPal[ 11 ] = COL_LIGHTCYAN; + aPal[ 12 ] = COL_LIGHTRED; + aPal[ 13 ] = COL_LIGHTMAGENTA; + aPal[ 14 ] = COL_YELLOW; + aPal[ 15 ] = COL_WHITE; // Create dither palette if( 8 == nBitCount ) @@ -1187,7 +1187,7 @@ Bitmap Bitmap::CreateMask( const Color& rTransColor, sal_uInt8 nTol ) const ScopedReadAccess pReadAcc(const_cast<Bitmap&>(*this)); if (!nTol && pReadAcc && (pReadAcc->GetScanlineFormat() == ScanlineFormat::N1BitLsbPal || pReadAcc->GetScanlineFormat() == ScanlineFormat::N1BitMsbPal) - && pReadAcc->GetBestMatchingColor(Color(COL_WHITE)) == pReadAcc->GetBestMatchingColor(rTransColor)) + && pReadAcc->GetBestMatchingColor(COL_WHITE) == pReadAcc->GetBestMatchingColor(rTransColor)) { //if we're a 1 bit pixel already, and the transcolor matches the color that would replace it already, then just return a copy return *this; @@ -1201,8 +1201,8 @@ Bitmap Bitmap::CreateMask( const Color& rTransColor, sal_uInt8 nTol ) const { const long nWidth = pReadAcc->Width(); const long nHeight = pReadAcc->Height(); - const BitmapColor aBlack( pWriteAcc->GetBestMatchingColor( Color(COL_BLACK) ) ); - const BitmapColor aWhite( pWriteAcc->GetBestMatchingColor( Color(COL_WHITE) ) ); + const BitmapColor aBlack( pWriteAcc->GetBestMatchingColor( COL_BLACK ) ); + const BitmapColor aWhite( pWriteAcc->GetBestMatchingColor( COL_WHITE ) ); if( !nTol ) { @@ -1510,7 +1510,7 @@ bool Bitmap::Replace( const Bitmap& rMask, const Color& rReplaceColor ) { const long nWidth = std::min( pMaskAcc->Width(), pAcc->Width() ); const long nHeight = std::min( pMaskAcc->Height(), pAcc->Height() ); - const BitmapColor aMaskWhite( pMaskAcc->GetBestMatchingColor( Color(COL_WHITE) ) ); + const BitmapColor aMaskWhite( pMaskAcc->GetBestMatchingColor( COL_WHITE ) ); BitmapColor aReplace; if( pAcc->HasPalette() ) @@ -1830,7 +1830,7 @@ bool Bitmap::CombineSimple( const Bitmap& rMask, BmpCombine eCombine ) const Color aColBlack( COL_BLACK ); BitmapColor aPixel; BitmapColor aMaskPixel; - const BitmapColor aWhite( pAcc->GetBestMatchingColor( Color(COL_WHITE) ) ); + const BitmapColor aWhite( pAcc->GetBestMatchingColor( COL_WHITE ) ); const BitmapColor aBlack( pAcc->GetBestMatchingColor( aColBlack ) ); const BitmapColor aMaskBlack( pMaskAcc->GetBestMatchingColor( aColBlack ) ); @@ -1925,8 +1925,8 @@ bool Bitmap::MakeMonochrome(sal_uInt8 cThreshold) if( pWriteAcc ) { - const BitmapColor aBlack( pWriteAcc->GetBestMatchingColor( Color( COL_BLACK ) ) ); - const BitmapColor aWhite( pWriteAcc->GetBestMatchingColor( Color( COL_WHITE ) ) ); + const BitmapColor aBlack( pWriteAcc->GetBestMatchingColor( COL_BLACK ) ); + const BitmapColor aWhite( pWriteAcc->GetBestMatchingColor( COL_WHITE ) ); const long nWidth = pWriteAcc->Width(); const long nHeight = pWriteAcc->Height(); diff --git a/vcl/source/gdi/bitmap3.cxx b/vcl/source/gdi/bitmap3.cxx index 0380e85ca37d..9c9b528bfe90 100644 --- a/vcl/source/gdi/bitmap3.cxx +++ b/vcl/source/gdi/bitmap3.cxx @@ -549,8 +549,8 @@ bool Bitmap::ImplConvertDown(sal_uInt16 nBitCount, Color const * pExtColor) if (aPalette.GetEntryCount() < (nCount - 1)) { aPalette.SetEntryCount(aPalette.GetEntryCount() + 2); - aPalette[aPalette.GetEntryCount() - 2] = Color(COL_BLACK); - aPalette[aPalette.GetEntryCount() - 1] = Color(COL_WHITE); + aPalette[aPalette.GetEntryCount() - 2] = COL_BLACK; + aPalette[aPalette.GetEntryCount() - 1] = COL_WHITE; } pWriteAcc->SetPalette(aPalette); diff --git a/vcl/source/gdi/bitmapex.cxx b/vcl/source/gdi/bitmapex.cxx index ec6b504a9e79..ea883d0be6eb 100644 --- a/vcl/source/gdi/bitmapex.cxx +++ b/vcl/source/gdi/bitmapex.cxx @@ -401,7 +401,7 @@ bool BitmapEx::Rotate( long nAngle10, const Color& rFillColor ) if( !!aBitmap ) { - const bool bTransRotate = ( Color(COL_TRANSPARENT) == rFillColor ); + const bool bTransRotate = ( COL_TRANSPARENT == rFillColor ); if( bTransRotate ) { diff --git a/vcl/source/gdi/gdimtf.cxx b/vcl/source/gdi/gdimtf.cxx index 99b5067270db..a9996b08d105 100644 --- a/vcl/source/gdi/gdimtf.cxx +++ b/vcl/source/gdi/gdimtf.cxx @@ -1774,8 +1774,8 @@ BitmapEx GDIMetaFile::ImplBmpMonoFnc( const BitmapEx& rBmpEx, const void* pBmpPa { BitmapPalette aPal( 3 ); - aPal[ 0 ] = Color(COL_BLACK); - aPal[ 1 ] = Color(COL_WHITE); + aPal[ 0 ] = COL_BLACK; + aPal[ 1 ] = COL_WHITE; aPal[ 2 ] = static_cast<const ImplBmpMonoParam*>(pBmpParam)->aColor; Bitmap aBmp( rBmpEx.GetSizePixel(), 4, &aPal ); diff --git a/vcl/source/gdi/pdfwriter_impl.cxx b/vcl/source/gdi/pdfwriter_impl.cxx index 0a7e32a4cf6f..defecaa88642 100644 --- a/vcl/source/gdi/pdfwriter_impl.cxx +++ b/vcl/source/gdi/pdfwriter_impl.cxx @@ -9500,9 +9500,9 @@ bool PDFWriterImpl::writeBitmapObject( BitmapEmit& rObject, bool bMask ) // #i47395# 1 bit bitmaps occasionally have an inverted grey palette sal_uInt16 nBlackIndex = pAccess->GetBestPaletteIndex( BitmapColor( COL_BLACK ) ); assert( nBlackIndex == 0 || nBlackIndex == 1); - sal_uInt16 nWhiteIndex = pAccess->GetBestPaletteIndex( BitmapColor( Color(COL_WHITE) ) ); + sal_uInt16 nWhiteIndex = pAccess->GetBestPaletteIndex( BitmapColor( COL_WHITE ) ); if( pAccess->GetPalette()[nBlackIndex] == BitmapColor( COL_BLACK ) && - pAccess->GetPalette()[nWhiteIndex] == BitmapColor( Color(COL_WHITE) ) ) + pAccess->GetPalette()[nWhiteIndex] == BitmapColor( COL_WHITE ) ) { // It is black and white if( nBlackIndex == 1 ) @@ -9573,7 +9573,7 @@ bool PDFWriterImpl::writeBitmapObject( BitmapEmit& rObject, bool bMask ) if( aBitmap.GetBitCount() == 1 ) { aLine.append( "/ImageMask true\n" ); - sal_Int32 nBlackIndex = pAccess->GetBestPaletteIndex( BitmapColor( Color(COL_BLACK) ) ); + sal_Int32 nBlackIndex = pAccess->GetBestPaletteIndex( BitmapColor( COL_BLACK ) ); SAL_WARN_IF( nBlackIndex != 0 && nBlackIndex != 1, "vcl.pdfwriter", "wrong black index" ); if( nBlackIndex ) aLine.append( "/Decode[ 1 0 ]\n" ); diff --git a/vcl/source/gdi/pngwrite.cxx b/vcl/source/gdi/pngwrite.cxx index 0448cb1dee79..b5c6178eb1bd 100644 --- a/vcl/source/gdi/pngwrite.cxx +++ b/vcl/source/gdi/pngwrite.cxx @@ -562,7 +562,7 @@ sal_uLong PNGWriterImpl::ImplGetFilter (sal_uLong nY, sal_uLong nXStart, sal_uLo } else { - const BitmapColor aTrans(mpMaskAccess->GetBestMatchingColor(Color(COL_WHITE))); + const BitmapColor aTrans(mpMaskAccess->GetBestMatchingColor(COL_WHITE)); Scanline pScanline = mpAccess->GetScanline( nY ); Scanline pScanlineMask = mpMaskAccess->GetScanline( nY ); diff --git a/vcl/source/outdev/text.cxx b/vcl/source/outdev/text.cxx index 695ebf1b69af..c897afeb6f10 100644 --- a/vcl/source/outdev/text.cxx +++ b/vcl/source/outdev/text.cxx @@ -322,16 +322,16 @@ void OutputDevice::ImplDrawSpecialText( SalLayout& rSalLayout ) Color aOverlineColor( aOldOverlineColor ); // we don't have a automatic color, so black is always drawn on white - if ( aTextColor.GetColor() == COL_BLACK ) + if ( aTextColor == COL_BLACK ) aTextColor = COL_WHITE; - if ( aTextLineColor.GetColor() == COL_BLACK ) + if ( aTextLineColor == COL_BLACK ) aTextLineColor = COL_WHITE; - if ( aOverlineColor.GetColor() == COL_BLACK ) + if ( aOverlineColor == COL_BLACK ) aOverlineColor = COL_WHITE; // relief-color is black for white text, in all other cases // we set this to LightGray - if ( aTextColor.GetColor() == COL_WHITE ) + if ( aTextColor == COL_WHITE ) aReliefColor = COL_BLACK; SetTextLineColor( aReliefColor ); SetOverlineColor( aReliefColor ); @@ -373,7 +373,7 @@ void OutputDevice::ImplDrawSpecialText( SalLayout& rSalLayout ) nOff++; SetTextLineColor(); SetOverlineColor(); - if ( (GetTextColor().GetColor() == COL_BLACK) + if ( (GetTextColor() == COL_BLACK) || (GetTextColor().GetLuminance() < 8) ) SetTextColor( COL_LIGHTGRAY ); else diff --git a/vcl/source/outdev/textline.cxx b/vcl/source/outdev/textline.cxx index be8f55e902cf..a15b788f8b01 100644 --- a/vcl/source/outdev/textline.cxx +++ b/vcl/source/outdev/textline.cxx @@ -850,7 +850,7 @@ void OutputDevice::SetTextLineColor( const Color& rColor ) } if( (mnDrawMode & DrawModeFlags::GhostedText) && - (aColor.GetColor() != COL_TRANSPARENT) ) + (aColor != COL_TRANSPARENT) ) { aColor = Color( (aColor.GetRed() >> 1) | 0x80, (aColor.GetGreen() >> 1) | 0x80, @@ -907,7 +907,7 @@ void OutputDevice::SetOverlineColor( const Color& rColor ) } if( (mnDrawMode & DrawModeFlags::GhostedText) && - (aColor.GetColor() != COL_TRANSPARENT) ) + (aColor != COL_TRANSPARENT) ) { aColor = Color( (aColor.GetRed() >> 1) | 0x80, (aColor.GetGreen() >> 1) | 0x80, diff --git a/vcl/source/outdev/transparent.cxx b/vcl/source/outdev/transparent.cxx index 4b7f72c6017f..8d52a27bd4c6 100644 --- a/vcl/source/outdev/transparent.cxx +++ b/vcl/source/outdev/transparent.cxx @@ -475,7 +475,7 @@ void OutputDevice::EmulateDrawTransparent ( const tools::PolyPolygon& rPolyPoly, { BitmapColor aPixCol; const BitmapColor aFillCol( GetFillColor() ); - const BitmapColor aBlack( pR->GetBestMatchingColor( Color(COL_BLACK) ) ); + const BitmapColor aBlack( pR->GetBestMatchingColor( COL_BLACK ) ); const long nWidth = pW->Width(); const long nHeight = pW->Height(); const long nR = aFillCol.GetRed(); diff --git a/vcl/source/window/decoview.cxx b/vcl/source/window/decoview.cxx index 65d9b995530b..7d007b4d6dd7 100644 --- a/vcl/source/window/decoview.cxx +++ b/vcl/source/window/decoview.cxx @@ -794,7 +794,7 @@ void DecorationView::DrawSymbol( const tools::Rectangle& rRect, SymbolType eType if ( nStyle & DrawSymbolFlags::Mono ) { // Monochrome: set color to black if enabled, to gray if disabled - nColor = Color( ( nStyle & DrawSymbolFlags::Disable ) ? COL_GRAY : COL_BLACK ); + nColor = ( nStyle & DrawSymbolFlags::Disable ) ? COL_GRAY : COL_BLACK; } else { diff --git a/vcl/source/window/window.cxx b/vcl/source/window/window.cxx index a7c50c793969..51861d6c3dff 100644 --- a/vcl/source/window/window.cxx +++ b/vcl/source/window/window.cxx @@ -3115,7 +3115,7 @@ const Wallpaper& Window::GetDisplayBackground() const const Wallpaper& rBack = GetBackground(); if( ! rBack.IsBitmap() && ! rBack.IsGradient() && - rBack.GetColor().GetColor() == COL_TRANSPARENT && + rBack.GetColor()== COL_TRANSPARENT && mpWindowImpl->mpParent ) return mpWindowImpl->mpParent->GetDisplayBackground(); return rBack; diff --git a/vcl/unx/generic/gdi/gdiimpl.cxx b/vcl/unx/generic/gdi/gdiimpl.cxx index 823d4ca9018d..27f024348ed5 100644 --- a/vcl/unx/generic/gdi/gdiimpl.cxx +++ b/vcl/unx/generic/gdi/gdiimpl.cxx @@ -109,10 +109,10 @@ namespace const BitmapPalette& rPalette = pBitmapBuffer->maPalette; if (rPalette.GetEntryCount() == 2) { - const BitmapColor aWhite(rPalette[rPalette.GetBestIndex(Color(COL_WHITE))]); + const BitmapColor aWhite(rPalette[rPalette.GetBestIndex(COL_WHITE)]); rValues.foreground = rColMap.GetPixel(ImplColorToSal(aWhite.GetColor())); - const BitmapColor aBlack(rPalette[rPalette.GetBestIndex(Color(COL_BLACK))]); + const BitmapColor aBlack(rPalette[rPalette.GetBestIndex(COL_BLACK)]); rValues.background = rColMap.GetPixel(ImplColorToSal(aBlack.GetColor())); } rBitmap.ReleaseBuffer(pBitmapBuffer, BitmapAccessMode::Read); diff --git a/vcl/unx/generic/gdi/salbmp.cxx b/vcl/unx/generic/gdi/salbmp.cxx index 68f4a2c4ea75..a04da99dd9f0 100644 --- a/vcl/unx/generic/gdi/salbmp.cxx +++ b/vcl/unx/generic/gdi/salbmp.cxx @@ -355,8 +355,8 @@ BitmapBuffer* X11SalBitmap::ImplCreateDIB( rPal.SetEntryCount( 2 ); pDstPal = &rPal; - rPal[ 0 ] = Color(COL_BLACK); - rPal[ 1 ] = Color(COL_WHITE); + rPal[ 0 ] = COL_BLACK; + rPal[ 1 ] = COL_WHITE; } else if( pImage->depth == 8 && bGrey ) { @@ -518,8 +518,8 @@ XImage* X11SalBitmap::ImplCreateXImage( if( pImage->depth == 1 ) { xPal.reset(new BitmapPalette( 2 )); - (*xPal)[ 0 ] = Color(COL_BLACK); - (*xPal)[ 1 ] = Color(COL_WHITE); + (*xPal)[ 0 ] = COL_BLACK; + (*xPal)[ 1 ] = COL_WHITE; } else if( pImage->depth == 8 && mbGrey ) { diff --git a/vcl/workben/vcldemo.cxx b/vcl/workben/vcldemo.cxx index 3b502340bd53..cd65c2c379dc 100644 --- a/vcl/workben/vcldemo.cxx +++ b/vcl/workben/vcldemo.cxx @@ -409,7 +409,7 @@ public: std::vector<OUString> aFontNames; - sal_uInt32 const nCols[] = { + Color const nCols[] = { COL_BLACK, COL_BLUE, COL_GREEN, COL_CYAN, COL_RED, COL_MAGENTA, COL_BROWN, COL_GRAY, COL_LIGHTGRAY, COL_LIGHTBLUE, COL_LIGHTGREEN, COL_LIGHTCYAN, COL_LIGHTRED, COL_LIGHTMAGENTA, COL_YELLOW, COL_WHITE @@ -450,7 +450,7 @@ public: nFontColorIndex=(i % aFontNames.size()); } - rDev.SetTextColor(Color(nCols[nFontColorIndex])); + rDev.SetTextColor(nCols[nFontColorIndex]); vcl::Font aFont( aFontNames[nFontIndex], Size(0, nFontHeight )); if (bRotate) @@ -777,13 +777,13 @@ public: if (rCtx.meStyle == RENDER_EXPANDED) { std::vector<tools::Rectangle> aRegions(DemoRenderer::partition(rCtx,5, 4)); - sal_uInt32 nStartCols[] = { + Color nStartCols[] = { COL_RED, COL_RED, COL_RED, COL_GREEN, COL_GREEN, COL_BLUE, COL_BLUE, COL_BLUE, COL_CYAN, COL_CYAN, COL_BLACK, COL_LIGHTGRAY, COL_WHITE, COL_BLUE, COL_CYAN, COL_WHITE, COL_WHITE, COL_WHITE, COL_BLACK, COL_BLACK }; - sal_uInt32 nEndCols[] = { + Color nEndCols[] = { COL_WHITE, COL_WHITE, COL_WHITE, COL_BLACK, COL_BLACK, COL_RED, COL_RED, COL_RED, COL_GREEN, COL_GREEN, COL_GRAY, COL_GRAY, COL_LIGHTGRAY, COL_LIGHTBLUE, COL_LIGHTCYAN, @@ -818,8 +818,8 @@ public: { tools::Rectangle aSub = aRegions[i]; Gradient aGradient; - aGradient.SetStartColor(Color(nStartCols[i])); - aGradient.SetEndColor(Color(nEndCols[i])); + aGradient.SetStartColor(nStartCols[i]); + aGradient.SetEndColor(nEndCols[i]); aGradient.SetStyle(eStyles[i]); aGradient.SetAngle(nAngles[i]); aGradient.SetBorder(nBorders[i]); |