diff options
author | Noel Grandin <noel.grandin@collabora.co.uk> | 2018-03-14 11:11:02 +0200 |
---|---|---|
committer | Noel Grandin <noel.grandin@collabora.co.uk> | 2018-03-26 08:44:50 +0200 |
commit | bea081b5099786e5fcadddd72c247b9a9488286a (patch) | |
tree | dd165f81e850cb9bcfa23b713bd60e3fb26d21ee /vcl/unx/generic | |
parent | a488c7ad2763b944713997911c1ddb0315d8c93f (diff) |
replace SalColor with Color
Change-Id: I615640a378a61cf6e44e84a647ce06bdd8a52807
Reviewed-on: https://gerrit.libreoffice.org/51239
Tested-by: Jenkins <ci@libreoffice.org>
Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
Diffstat (limited to 'vcl/unx/generic')
-rw-r--r-- | vcl/unx/generic/app/saldisp.cxx | 105 | ||||
-rw-r--r-- | vcl/unx/generic/gdi/cairotextrender.cxx | 14 | ||||
-rw-r--r-- | vcl/unx/generic/gdi/font.cxx | 6 | ||||
-rw-r--r-- | vcl/unx/generic/gdi/gdiimpl.cxx | 76 | ||||
-rw-r--r-- | vcl/unx/generic/gdi/gdiimpl.hxx | 14 | ||||
-rw-r--r-- | vcl/unx/generic/gdi/salbmp.cxx | 16 | ||||
-rw-r--r-- | vcl/unx/generic/gdi/salgdi.cxx | 50 | ||||
-rw-r--r-- | vcl/unx/generic/gdi/salgdi2.cxx | 4 | ||||
-rw-r--r-- | vcl/unx/generic/gdi/xrender_peer.hxx | 10 | ||||
-rw-r--r-- | vcl/unx/generic/print/genpspgraphics.cxx | 36 |
10 files changed, 164 insertions, 167 deletions
diff --git a/vcl/unx/generic/app/saldisp.cxx b/vcl/unx/generic/app/saldisp.cxx index a8fb3c542a64..da1d1723a7df 100644 --- a/vcl/unx/generic/app/saldisp.cxx +++ b/vcl/unx/generic/app/saldisp.cxx @@ -82,9 +82,6 @@ typedef unsigned long Pixel; using namespace vcl_sal; -#define SALCOLOR_WHITE MAKE_SALCOLOR( 0xFF, 0xFF, 0xFF ) -#define SALCOLOR_BLACK MAKE_SALCOLOR( 0x00, 0x00, 0x00 ) - #ifdef DBG_UTIL inline const char *Null( const char *p ) { return p ? p : ""; } inline const char *GetEnv( const char *p ) { return Null( getenv( p ) ); } @@ -100,10 +97,10 @@ inline double Hypothenuse( long w, long h ) inline int ColorDiff( int r, int g, int b ) { return (r*r)+(g*g)+(b*b); } -inline int ColorDiff( SalColor c1, int r, int g, int b ) -{ return ColorDiff( static_cast<int>(SALCOLOR_RED (c1))-r, - static_cast<int>(SALCOLOR_GREEN(c1))-g, - static_cast<int>(SALCOLOR_BLUE (c1))-b ); } +inline int ColorDiff( Color c1, int r, int g, int b ) +{ return ColorDiff( static_cast<int>(c1.GetRed())-r, + static_cast<int>(c1.GetGreen())-g, + static_cast<int>(c1.GetBlue())-b ); } static int sal_Shift( Pixel nMask ) { @@ -2444,21 +2441,21 @@ SalVisual::~SalVisual() if( -1 == screen && VisualID(-1) == visualid ) delete visual; } -// Converts the order of bytes of a Pixel into bytes of a SalColor +// Converts the order of bytes of a Pixel into bytes of a Color // This is not reversible for the 6 XXXA -// SalColor is RGB (ABGR) a=0xFF000000, r=0xFF0000, g=0xFF00, b=0xFF +// Color is RGB (ABGR) a=0xFF000000, r=0xFF0000, g=0xFF00, b=0xFF #define SALCOLOR RGB #define SALCOLORREVERSE BGR -SalColor SalVisual::GetTCColor( Pixel nPixel ) const +Color SalVisual::GetTCColor( Pixel nPixel ) const { if( SALCOLOR == eRGBMode_ ) - return static_cast<SalColor>(nPixel); + return static_cast<Color>(nPixel); if( SALCOLORREVERSE == eRGBMode_ ) - return MAKE_SALCOLOR( (nPixel & 0x0000FF), + return Color( (nPixel & 0x0000FF), (nPixel & 0x00FF00) >> 8, (nPixel & 0xFF0000) >> 16); @@ -2467,7 +2464,7 @@ SalColor SalVisual::GetTCColor( Pixel nPixel ) const Pixel b = nPixel & blue_mask; if( otherSalRGB != eRGBMode_ ) // 8+8+8=24 - return MAKE_SALCOLOR( r >> nRedShift_, + return Color( r >> nRedShift_, g >> nGreenShift_, b >> nBlueShift_ ); @@ -2482,17 +2479,17 @@ SalColor SalVisual::GetTCColor( Pixel nPixel ) const if( nBlueBits_ != 8 ) b |= (b & 0xff) >> (8-nBlueBits_); - return MAKE_SALCOLOR( r, g, b ); + return Color( r, g, b ); } -Pixel SalVisual::GetTCPixel( SalColor nSalColor ) const +Pixel SalVisual::GetTCPixel( Color nColor ) const { if( SALCOLOR == eRGBMode_ ) - return static_cast<Pixel>(nSalColor); + return static_cast<Pixel>(sal_uInt32(nColor)); - Pixel r = static_cast<Pixel>(SALCOLOR_RED( nSalColor )); - Pixel g = static_cast<Pixel>(SALCOLOR_GREEN( nSalColor )); - Pixel b = static_cast<Pixel>(SALCOLOR_BLUE( nSalColor )); + Pixel r = static_cast<Pixel>( nColor.GetRed() ); + Pixel g = static_cast<Pixel>( nColor.GetGreen() ); + Pixel b = static_cast<Pixel>( nColor.GetBlue() ); if( SALCOLORREVERSE == eRGBMode_ ) return (b << 16) | (g << 8) | r; @@ -2582,10 +2579,10 @@ SalColormap::SalColormap() m_nUsed( 2 ), m_nXScreen( m_pDisplay != nullptr ? m_pDisplay->GetDefaultXScreen() : SalX11Screen( 0 ) ) { - m_aPalette = std::vector<SalColor>(m_nUsed); + m_aPalette = std::vector<Color>(m_nUsed); - m_aPalette[m_nBlackPixel] = SALCOLOR_BLACK; - m_aPalette[m_nWhitePixel] = SALCOLOR_WHITE; + m_aPalette[m_nBlackPixel] = COL_BLACK; + m_aPalette[m_nWhitePixel] = COL_WHITE; } // TrueColor @@ -2678,7 +2675,7 @@ SalColormap::SalColormap( sal_uInt16 nDepth ) void SalColormap::GetPalette() { Pixel i; - m_aPalette = std::vector<SalColor>(m_nUsed); + m_aPalette = std::vector<Color>(m_nUsed); std::unique_ptr<XColor[]> aColor(new XColor[m_nUsed]); @@ -2692,13 +2689,13 @@ void SalColormap::GetPalette() for( i = 0; i < m_nUsed; i++ ) { - m_aPalette[i] = MAKE_SALCOLOR( aColor[i].red >> 8, + m_aPalette[i] = Color( aColor[i].red >> 8, aColor[i].green >> 8, aColor[i].blue >> 8 ); } } -static sal_uInt16 sal_Lookup( const std::vector<SalColor>& rPalette, +static sal_uInt16 sal_Lookup( const std::vector<Color>& rPalette, int r, int g, int b, Pixel nUsed ) { @@ -2732,10 +2729,10 @@ void SalColormap::GetLookupTable() m_aLookupTable[i++] = sal_Lookup( m_aPalette, r, g, b, m_nUsed ); } -SalColor SalColormap::GetColor( Pixel nPixel ) const +Color SalColormap::GetColor( Pixel nPixel ) const { - if( m_nBlackPixel == nPixel ) return SALCOLOR_BLACK; - if( m_nWhitePixel == nPixel ) return SALCOLOR_WHITE; + if( m_nBlackPixel == nPixel ) return COL_BLACK; + if( m_nWhitePixel == nPixel ) return COL_WHITE; if( m_aVisual.GetVisual() ) { @@ -2765,7 +2762,7 @@ SalColor SalColormap::GetColor( Pixel nPixel ) const XQueryColor( m_pDisplay->GetDisplay(), m_hColormap, &aColor ); - return MAKE_SALCOLOR( aColor.red>>8, aColor.green>>8, aColor.blue>>8 ); + return Color( aColor.red>>8, aColor.green>>8, aColor.blue>>8 ); } inline bool SalColormap::GetXPixel( XColor &rColor, @@ -2791,14 +2788,14 @@ bool SalColormap::GetXPixels( XColor &rColor, return GetXPixel( rColor, r^0xFF, g^0xFF, b^0xFF ); } -Pixel SalColormap::GetPixel( SalColor nSalColor ) const +Pixel SalColormap::GetPixel( Color nColor ) const { - if( SALCOLOR_NONE == nSalColor ) return 0; - if( SALCOLOR_BLACK == nSalColor ) return m_nBlackPixel; - if( SALCOLOR_WHITE == nSalColor ) return m_nWhitePixel; + if( SALCOLOR_NONE == nColor ) return 0; + if( COL_BLACK == nColor ) return m_nBlackPixel; + if( COL_WHITE == nColor ) return m_nWhitePixel; if( m_aVisual.GetClass() == TrueColor ) - return m_aVisual.GetTCPixel( nSalColor ); + return m_aVisual.GetTCPixel( nColor ); if( m_aLookupTable.empty() ) { @@ -2810,7 +2807,7 @@ Pixel SalColormap::GetPixel( SalColor nSalColor ) const if( !m_aPalette.empty() ) for( Pixel i = 0; i < m_nUsed; i++ ) - if( m_aPalette[i] == nSalColor ) + if( m_aPalette[i] == nColor ) return i; if( m_hColormap ) @@ -2819,32 +2816,32 @@ Pixel SalColormap::GetPixel( SalColor nSalColor ) const XColor aColor; if( GetXPixel( aColor, - SALCOLOR_RED ( nSalColor ), - SALCOLOR_GREEN( nSalColor ), - SALCOLOR_BLUE ( nSalColor ) ) ) + nColor.GetRed(), + nColor.GetGreen(), + nColor.GetBlue() ) ) { - if( !m_aPalette.empty() && !m_aPalette[aColor.pixel] ) + if( !m_aPalette.empty() && m_aPalette[aColor.pixel] == Color(0) ) { - const_cast<SalColormap*>(this)->m_aPalette[aColor.pixel] = nSalColor; + const_cast<SalColormap*>(this)->m_aPalette[aColor.pixel] = nColor; - if( !(aColor.pixel & 1) && !m_aPalette[aColor.pixel+1] ) + if( !(aColor.pixel & 1) && m_aPalette[aColor.pixel+1] == Color(0) ) { XColor aInversColor; - SalColor nInversColor = nSalColor ^ 0xFFFFFF; + Color nInversColor = sal_uInt32(nColor) ^ 0xFFFFFF; GetXPixel( aInversColor, - SALCOLOR_RED ( nInversColor ), - SALCOLOR_GREEN( nInversColor ), - SALCOLOR_BLUE ( nInversColor ) ); + nInversColor.GetRed(), + nInversColor.GetGreen(), + nInversColor.GetBlue() ); - if( !m_aPalette[aInversColor.pixel] ) + if( m_aPalette[aInversColor.pixel] == Color(0) ) const_cast<SalColormap*>(this)->m_aPalette[aInversColor.pixel] = nInversColor; #ifdef DBG_UTIL else fprintf( stderr, "SalColormap::GetPixel() 0x%06lx=%lu 0x%06lx=%lu\n", - static_cast< unsigned long >(nSalColor), aColor.pixel, - static_cast< unsigned long >(nInversColor), aInversColor.pixel); + static_cast< unsigned long >(sal_uInt32(nColor)), aColor.pixel, + static_cast< unsigned long >(sal_uInt32(nInversColor)), aInversColor.pixel); #endif } } @@ -2854,7 +2851,7 @@ Pixel SalColormap::GetPixel( SalColor nSalColor ) const #ifdef DBG_UTIL fprintf( stderr, "SalColormap::GetPixel() !XAllocColor %lx\n", - static_cast< unsigned long >(nSalColor) ); + static_cast< unsigned long >(sal_uInt32(nColor)) ); #endif } @@ -2862,18 +2859,18 @@ Pixel SalColormap::GetPixel( SalColor nSalColor ) const { #ifdef DBG_UTIL fprintf( stderr, "SalColormap::GetPixel() Palette empty %lx\n", - static_cast< unsigned long >(nSalColor)); + static_cast< unsigned long >(sal_uInt32(nColor))); #endif - return nSalColor; + return sal_uInt32(nColor); } const_cast<SalColormap*>(this)->GetLookupTable(); } // color matching via palette - sal_uInt16 r = SALCOLOR_RED ( nSalColor ); - sal_uInt16 g = SALCOLOR_GREEN( nSalColor ); - sal_uInt16 b = SALCOLOR_BLUE ( nSalColor ); + sal_uInt16 r = nColor.GetRed(); + sal_uInt16 g = nColor.GetGreen(); + sal_uInt16 b = nColor.GetBlue(); return m_aLookupTable[ (((r+8)/17) << 8) + (((g+8)/17) << 4) + ((b+8)/17) ]; diff --git a/vcl/unx/generic/gdi/cairotextrender.cxx b/vcl/unx/generic/gdi/cairotextrender.cxx index 449b6c080831..7febf686e9fd 100644 --- a/vcl/unx/generic/gdi/cairotextrender.cxx +++ b/vcl/unx/generic/gdi/cairotextrender.cxx @@ -76,7 +76,7 @@ CairoFontsCache::LRUFonts CairoFontsCache::maLRUFonts; } CairoTextRender::CairoTextRender() - : mnTextColor(MAKE_SALCOLOR(0x00, 0x00, 0x00)) //black + : mnTextColor(Color(0x00, 0x00, 0x00)) //black { for(FreetypeFont* & rp : mpFreetypeFont) rp = nullptr; @@ -209,9 +209,9 @@ void CairoTextRender::DrawTextLayout(const CommonSalLayout& rLayout) clipRegion(cr); cairo_set_source_rgb(cr, - SALCOLOR_RED(mnTextColor)/255.0, - SALCOLOR_GREEN(mnTextColor)/255.0, - SALCOLOR_BLUE(mnTextColor)/255.0); + mnTextColor.GetRed()/255.0, + mnTextColor.GetGreen()/255.0, + mnTextColor.GetBlue()/255.0); FT_Face aFace = rFont.GetFtFace(); CairoFontsCache::CacheId aId; @@ -339,11 +339,11 @@ void CairoTextRender::SetFont( const FontSelectPattern *pEntry, int nFallbackLev } void -CairoTextRender::SetTextColor( SalColor nSalColor ) +CairoTextRender::SetTextColor( Color nColor ) { - if( mnTextColor != nSalColor ) + if( mnTextColor != nColor ) { - mnTextColor = nSalColor; + mnTextColor = nColor; } } diff --git a/vcl/unx/generic/gdi/font.cxx b/vcl/unx/generic/gdi/font.cxx index 23458223f9f1..4de3a9a75acf 100644 --- a/vcl/unx/generic/gdi/font.cxx +++ b/vcl/unx/generic/gdi/font.cxx @@ -76,10 +76,10 @@ void X11SalGraphics::SetFont( const FontSelectPattern *pEntry, int nFallbackLeve } void -X11SalGraphics::SetTextColor( SalColor nSalColor ) +X11SalGraphics::SetTextColor( Color nColor ) { - mxTextRenderImpl->SetTextColor(nSalColor); - nTextPixel_ = GetPixel( nSalColor ); + mxTextRenderImpl->SetTextColor(nColor); + nTextPixel_ = GetPixel( nColor ); bFontGC_ = false; } diff --git a/vcl/unx/generic/gdi/gdiimpl.cxx b/vcl/unx/generic/gdi/gdiimpl.cxx index 27f024348ed5..b815992e2d4d 100644 --- a/vcl/unx/generic/gdi/gdiimpl.cxx +++ b/vcl/unx/generic/gdi/gdiimpl.cxx @@ -110,10 +110,10 @@ namespace if (rPalette.GetEntryCount() == 2) { const BitmapColor aWhite(rPalette[rPalette.GetBestIndex(COL_WHITE)]); - rValues.foreground = rColMap.GetPixel(ImplColorToSal(aWhite.GetColor())); + rValues.foreground = rColMap.GetPixel(aWhite.GetColor()); const BitmapColor aBlack(rPalette[rPalette.GetBestIndex(COL_BLACK)]); - rValues.background = rColMap.GetPixel(ImplColorToSal(aBlack.GetColor())); + rValues.background = rColMap.GetPixel(aBlack.GetColor()); } rBitmap.ReleaseBuffer(pBitmapBuffer, BitmapAccessMode::Read); } @@ -122,7 +122,7 @@ namespace X11SalGraphicsImpl::X11SalGraphicsImpl(X11SalGraphics& rParent): mrParent(rParent), - mnBrushColor( MAKE_SALCOLOR( 0xFF, 0xFF, 0XFF ) ), + mnBrushColor( 0xFF, 0xFF, 0XFF ), mpBrushGC(nullptr), mnBrushPixel(0), mbPenGC(false), @@ -135,7 +135,7 @@ X11SalGraphicsImpl::X11SalGraphicsImpl(X11SalGraphics& rParent): mbDitherBrush(false), mbXORMode(false), mpPenGC(nullptr), - mnPenColor( MAKE_SALCOLOR( 0x00, 0x00, 0x00 ) ), + mnPenColor( 0x00, 0x00, 0x00 ), mnPenPixel(0), mpMonoGC(nullptr), mpCopyGC(nullptr), @@ -942,7 +942,7 @@ bool X11SalGraphicsImpl::drawAlphaRect( long nX, long nY, long nWidth, void X11SalGraphicsImpl::drawMask( const SalTwoRect& rPosAry, const SalBitmap &rSalBitmap, - SalColor nMaskColor ) + Color nMaskColor ) { const SalDisplay* pSalDisp = mrParent.GetDisplay(); Display* pXDisp = pSalDisp->GetDisplay(); @@ -1076,12 +1076,12 @@ void X11SalGraphicsImpl::SetLineColor() } } -void X11SalGraphicsImpl::SetLineColor( SalColor nSalColor ) +void X11SalGraphicsImpl::SetLineColor( Color nColor ) { - if( mnPenColor != nSalColor ) + if( mnPenColor != nColor ) { - mnPenColor = nSalColor; - mnPenPixel = mrParent.GetPixel( nSalColor ); + mnPenColor = nColor; + mnPenPixel = mrParent.GetPixel( nColor ); mbPenGC = false; } } @@ -1096,32 +1096,32 @@ void X11SalGraphicsImpl::SetFillColor() } } -void X11SalGraphicsImpl::SetFillColor( SalColor nSalColor ) +void X11SalGraphicsImpl::SetFillColor( Color nColor ) { - if( mnBrushColor != nSalColor ) + if( mnBrushColor != nColor ) { mbDitherBrush = false; - mnBrushColor = nSalColor; - mnBrushPixel = mrParent.GetPixel( nSalColor ); + mnBrushColor = nColor; + mnBrushPixel = mrParent.GetPixel( nColor ); if( TrueColor != mrParent.GetColormap().GetVisual().GetClass() && mrParent.GetColormap().GetColor( mnBrushPixel ) != mnBrushColor - && nSalColor != MAKE_SALCOLOR( 0x00, 0x00, 0x00 ) // black - && nSalColor != MAKE_SALCOLOR( 0x00, 0x00, 0x80 ) // blue - && nSalColor != MAKE_SALCOLOR( 0x00, 0x80, 0x00 ) // green - && nSalColor != MAKE_SALCOLOR( 0x00, 0x80, 0x80 ) // cyan - && nSalColor != MAKE_SALCOLOR( 0x80, 0x00, 0x00 ) // red - && nSalColor != MAKE_SALCOLOR( 0x80, 0x00, 0x80 ) // magenta - && nSalColor != MAKE_SALCOLOR( 0x80, 0x80, 0x00 ) // brown - && nSalColor != MAKE_SALCOLOR( 0x80, 0x80, 0x80 ) // gray - && nSalColor != MAKE_SALCOLOR( 0xC0, 0xC0, 0xC0 ) // light gray - && nSalColor != MAKE_SALCOLOR( 0x00, 0x00, 0xFF ) // light blue - && nSalColor != MAKE_SALCOLOR( 0x00, 0xFF, 0x00 ) // light green - && nSalColor != MAKE_SALCOLOR( 0x00, 0xFF, 0xFF ) // light cyan - && nSalColor != MAKE_SALCOLOR( 0xFF, 0x00, 0x00 ) // light red - && nSalColor != MAKE_SALCOLOR( 0xFF, 0x00, 0xFF ) // light magenta - && nSalColor != MAKE_SALCOLOR( 0xFF, 0xFF, 0x00 ) // light brown - && nSalColor != MAKE_SALCOLOR( 0xFF, 0xFF, 0xFF ) ) - mbDitherBrush = mrParent.GetDitherPixmap(nSalColor); + && nColor != Color( 0x00, 0x00, 0x00 ) // black + && nColor != Color( 0x00, 0x00, 0x80 ) // blue + && nColor != Color( 0x00, 0x80, 0x00 ) // green + && nColor != Color( 0x00, 0x80, 0x80 ) // cyan + && nColor != Color( 0x80, 0x00, 0x00 ) // red + && nColor != Color( 0x80, 0x00, 0x80 ) // magenta + && nColor != Color( 0x80, 0x80, 0x00 ) // brown + && nColor != Color( 0x80, 0x80, 0x80 ) // gray + && nColor != Color( 0xC0, 0xC0, 0xC0 ) // light gray + && nColor != Color( 0x00, 0x00, 0xFF ) // light blue + && nColor != Color( 0x00, 0xFF, 0x00 ) // light green + && nColor != Color( 0x00, 0xFF, 0xFF ) // light cyan + && nColor != Color( 0xFF, 0x00, 0x00 ) // light red + && nColor != Color( 0xFF, 0x00, 0xFF ) // light magenta + && nColor != Color( 0xFF, 0xFF, 0x00 ) // light brown + && nColor != Color( 0xFF, 0xFF, 0xFF ) ) + mbDitherBrush = mrParent.GetDitherPixmap(nColor); mbBrushGC = false; } } @@ -1185,15 +1185,15 @@ void X11SalGraphicsImpl::drawPixel( long nX, long nY ) XDrawPoint( mrParent.GetXDisplay(), mrParent.GetDrawable(), SelectPen(), nX, nY ); } -void X11SalGraphicsImpl::drawPixel( long nX, long nY, SalColor nSalColor ) +void X11SalGraphicsImpl::drawPixel( long nX, long nY, Color nColor ) { - if( nSalColor != SALCOLOR_NONE ) + if( nColor != SALCOLOR_NONE ) { Display *pDisplay = mrParent.GetXDisplay(); if( (mnPenColor == SALCOLOR_NONE) && !mbPenGC ) { - SetLineColor( nSalColor ); + SetLineColor( nColor ); XDrawPoint( pDisplay, mrParent.GetDrawable(), SelectPen(), nX, nY ); mnPenColor = SALCOLOR_NONE; mbPenGC = False; @@ -1202,12 +1202,12 @@ void X11SalGraphicsImpl::drawPixel( long nX, long nY, SalColor nSalColor ) { GC pGC = SelectPen(); - if( nSalColor != mnPenColor ) - XSetForeground( pDisplay, pGC, mrParent.GetPixel( nSalColor ) ); + if( nColor != mnPenColor ) + XSetForeground( pDisplay, pGC, mrParent.GetPixel( nColor ) ); XDrawPoint( pDisplay, mrParent.GetDrawable(), pGC, nX, nY ); - if( nSalColor != mnPenColor ) + if( nColor != mnPenColor ) XSetForeground( pDisplay, pGC, mnPenPixel ); } } @@ -1586,7 +1586,7 @@ bool X11SalGraphicsImpl::drawPolyLine( // temporarily adjust brush color to pen color // since the line is drawn as an area-polygon - const SalColor aKeepBrushColor = mnBrushColor; + const Color aKeepBrushColor = mnBrushColor; mnBrushColor = mnPenColor; // #i11575#desc5#b adjust B2D tessellation result to raster positions @@ -1650,7 +1650,7 @@ bool X11SalGraphicsImpl::drawPolyLine( return bDrawnOk; } -SalColor X11SalGraphicsImpl::getPixel( long nX, long nY ) +Color X11SalGraphicsImpl::getPixel( long nX, long nY ) { if( mrParent.bWindow_ && !mrParent.bVirDev_ ) { diff --git a/vcl/unx/generic/gdi/gdiimpl.hxx b/vcl/unx/generic/gdi/gdiimpl.hxx index 34811db5d3f6..1b71c47a182b 100644 --- a/vcl/unx/generic/gdi/gdiimpl.hxx +++ b/vcl/unx/generic/gdi/gdiimpl.hxx @@ -46,7 +46,7 @@ class X11SalGraphicsImpl : public SalGraphicsImpl, public X11GraphicsImpl private: X11SalGraphics& mrParent; - SalColor mnBrushColor; + Color mnBrushColor; GC mpBrushGC; // Brush attributes Pixel mnBrushPixel; @@ -62,7 +62,7 @@ private: bool mbXORMode : 1; // is ROP XOR Mode set GC mpPenGC; // Pen attributes - SalColor mnPenColor; + Color mnPenColor; Pixel mnPenPixel; @@ -126,14 +126,14 @@ public: virtual void SetLineColor() override; // set the line color to a specific color - virtual void SetLineColor( SalColor nSalColor ) override; + virtual void SetLineColor( Color nColor ) override; // set the fill color to transparent (= don't fill) virtual void SetFillColor() override; // set the fill color to a specific color, shapes will be // filled accordingly - virtual void SetFillColor( SalColor nSalColor ) override; + virtual void SetFillColor( Color nColor ) override; // enable/disable XOR drawing virtual void SetXORMode( bool bSet ) override; @@ -146,7 +146,7 @@ public: // draw --> LineColor and FillColor and RasterOp and ClipRegion virtual void drawPixel( long nX, long nY ) override; - virtual void drawPixel( long nX, long nY, SalColor nSalColor ) override; + virtual void drawPixel( long nX, long nY, Color nColor ) override; virtual void drawLine( long nX1, long nY1, long nX2, long nY2 ) override; @@ -204,11 +204,11 @@ public: virtual void drawMask( const SalTwoRect& rPosAry, const SalBitmap& rSalBitmap, - SalColor nMaskColor ) override; + Color nMaskColor ) override; virtual SalBitmap* getBitmap( long nX, long nY, long nWidth, long nHeight ) override; - virtual SalColor getPixel( long nX, long nY ) override; + virtual Color getPixel( long nX, long nY ) override; // invert --> ClipRegion (only Windows or VirDevs) virtual void invert( diff --git a/vcl/unx/generic/gdi/salbmp.cxx b/vcl/unx/generic/gdi/salbmp.cxx index a04da99dd9f0..e5db7853548f 100644 --- a/vcl/unx/generic/gdi/salbmp.cxx +++ b/vcl/unx/generic/gdi/salbmp.cxx @@ -384,12 +384,12 @@ BitmapBuffer* X11SalBitmap::ImplCreateDIB( for( sal_uInt16 i = 0; i < nCols; i++ ) { - const SalColor nColor( rColMap.GetColor( i ) ); + const Color nColor( rColMap.GetColor( i ) ); BitmapColor& rBmpCol = rPal[ i ]; - rBmpCol.SetRed( SALCOLOR_RED( nColor ) ); - rBmpCol.SetGreen( SALCOLOR_GREEN( nColor ) ); - rBmpCol.SetBlue( SALCOLOR_BLUE( nColor ) ); + rBmpCol.SetRed( nColor.GetRed() ); + rBmpCol.SetGreen( nColor.GetGreen() ); + rBmpCol.SetBlue( nColor.GetBlue() ); } } @@ -546,12 +546,12 @@ XImage* X11SalBitmap::ImplCreateXImage( for( sal_uInt16 i = 0; i < nCols; i++ ) { - const SalColor nColor( rColMap.GetColor( i ) ); + const Color nColor( rColMap.GetColor( i ) ); BitmapColor& rBmpCol = (*xPal)[ i ]; - rBmpCol.SetRed( SALCOLOR_RED( nColor ) ); - rBmpCol.SetGreen( SALCOLOR_GREEN( nColor ) ); - rBmpCol.SetBlue( SALCOLOR_BLUE( nColor ) ); + rBmpCol.SetRed( nColor.GetRed() ); + rBmpCol.SetGreen( nColor.GetGreen() ); + rBmpCol.SetBlue( nColor.GetBlue() ); } } diff --git a/vcl/unx/generic/gdi/salgdi.cxx b/vcl/unx/generic/gdi/salgdi.cxx index be6f42af6eff..005cbf4be7d6 100644 --- a/vcl/unx/generic/gdi/salgdi.cxx +++ b/vcl/unx/generic/gdi/salgdi.cxx @@ -227,7 +227,7 @@ void X11SalGraphics::SetClipRegion( GC pGC, Region pXReg ) const #define P_DELTA 51 #define DMAP( v, m ) ((v % P_DELTA) > m ? (v / P_DELTA) + 1 : (v / P_DELTA)) -bool X11SalGraphics::GetDitherPixmap( SalColor nSalColor ) +bool X11SalGraphics::GetDitherPixmap( Color nColor ) { static const short nOrdDither8Bit[ 8 ][ 8 ] = { @@ -249,20 +249,20 @@ bool X11SalGraphics::GetDitherPixmap( SalColor nSalColor ) char *pBitsPtr = pBits; // Set the palette-entries for the dithering tile - sal_uInt8 nSalColorRed = SALCOLOR_RED ( nSalColor ); - sal_uInt8 nSalColorGreen = SALCOLOR_GREEN ( nSalColor ); - sal_uInt8 nSalColorBlue = SALCOLOR_BLUE ( nSalColor ); + sal_uInt8 nColorRed = nColor.GetRed(); + sal_uInt8 nColorGreen = nColor.GetGreen(); + sal_uInt8 nColorBlue = nColor.GetBlue(); for(auto & nY : nOrdDither8Bit) { for( int nX = 0; nX < 8; nX++ ) { short nMagic = nY[nX]; - sal_uInt8 nR = P_DELTA * DMAP( nSalColorRed, nMagic ); - sal_uInt8 nG = P_DELTA * DMAP( nSalColorGreen, nMagic ); - sal_uInt8 nB = P_DELTA * DMAP( nSalColorBlue, nMagic ); + sal_uInt8 nR = P_DELTA * DMAP( nColorRed, nMagic ); + sal_uInt8 nG = P_DELTA * DMAP( nColorGreen, nMagic ); + sal_uInt8 nB = P_DELTA * DMAP( nColorBlue, nMagic ); - *pBitsPtr++ = GetColormap().GetPixel( MAKE_SALCOLOR( nR, nG, nB ) ); + *pBitsPtr++ = GetColormap().GetPixel( Color( nR, nG, nB ) ); } } @@ -369,13 +369,13 @@ void X11SalGraphics::SetLineColor() mxImpl->SetLineColor(); } -void X11SalGraphics::SetLineColor( SalColor nSalColor ) +void X11SalGraphics::SetLineColor( Color nColor ) { #if ENABLE_CAIRO_CANVAS - mnPenColor = nSalColor; + mnPenColor = nColor; #endif // ENABLE_CAIRO_CANVAS - mxImpl->SetLineColor( nSalColor ); + mxImpl->SetLineColor( nColor ); } void X11SalGraphics::SetFillColor() @@ -387,13 +387,13 @@ void X11SalGraphics::SetFillColor() mxImpl->SetFillColor(); } -void X11SalGraphics::SetFillColor( SalColor nSalColor ) +void X11SalGraphics::SetFillColor( Color nColor ) { #if ENABLE_CAIRO_CANVAS - mnFillColor = nSalColor; + mnFillColor = nColor; #endif // ENABLE_CAIRO_CANVAS - mxImpl->SetFillColor( nSalColor ); + mxImpl->SetFillColor( nColor ); } void X11SalGraphics::SetROPLineColor( SalROPColor nROPColor ) @@ -416,9 +416,9 @@ void X11SalGraphics::drawPixel( long nX, long nY ) mxImpl->drawPixel( nX, nY ); } -void X11SalGraphics::drawPixel( long nX, long nY, SalColor nSalColor ) +void X11SalGraphics::drawPixel( long nX, long nY, Color nColor ) { - mxImpl->drawPixel( nX, nY, nSalColor ); + mxImpl->drawPixel( nX, nY, nColor ); } void X11SalGraphics::drawLine( long nX1, long nY1, long nX2, long nY2 ) @@ -656,9 +656,9 @@ bool X11SalGraphics::drawPolyPolygon( const basegfx::B2DPolyPolygon& rOrigPolyPo if(SALCOLOR_NONE != mnFillColor) { cairo_set_source_rgba(cr, - SALCOLOR_RED(mnFillColor)/255.0, - SALCOLOR_GREEN(mnFillColor)/255.0, - SALCOLOR_BLUE(mnFillColor)/255.0, + mnFillColor.GetRed()/255.0, + mnFillColor.GetGreen()/255.0, + mnFillColor.GetBlue()/255.0, 1.0 - fTransparency); cairo_set_fill_rule(cr, CAIRO_FILL_RULE_EVEN_ODD); cairo_fill_preserve(cr); @@ -667,9 +667,9 @@ bool X11SalGraphics::drawPolyPolygon( const basegfx::B2DPolyPolygon& rOrigPolyPo if(SALCOLOR_NONE != mnPenColor) { cairo_set_source_rgba(cr, - SALCOLOR_RED(mnPenColor)/255.0, - SALCOLOR_GREEN(mnPenColor)/255.0, - SALCOLOR_BLUE(mnPenColor)/255.0, + mnPenColor.GetRed()/255.0, + mnPenColor.GetGreen()/255.0, + mnPenColor.GetBlue()/255.0, 1.0 - fTransparency); cairo_stroke_preserve(cr); } @@ -770,9 +770,9 @@ bool X11SalGraphics::drawPolyLine( } cairo_set_source_rgba(cr, - SALCOLOR_RED(mnPenColor)/255.0, - SALCOLOR_GREEN(mnPenColor)/255.0, - SALCOLOR_BLUE(mnPenColor)/255.0, + mnPenColor.GetRed()/255.0, + mnPenColor.GetGreen()/255.0, + mnPenColor.GetBlue()/255.0, 1.0 - fTransparency); cairo_set_line_join(cr, eCairoLineJoin); cairo_set_line_cap(cr, eCairoLineCap); diff --git a/vcl/unx/generic/gdi/salgdi2.cxx b/vcl/unx/generic/gdi/salgdi2.cxx index 44e371341bad..3903960bc4b8 100644 --- a/vcl/unx/generic/gdi/salgdi2.cxx +++ b/vcl/unx/generic/gdi/salgdi2.cxx @@ -228,7 +228,7 @@ bool X11SalGraphics::drawAlphaRect( long nX, long nY, long nWidth, void X11SalGraphics::drawMask( const SalTwoRect& rPosAry, const SalBitmap &rSalBitmap, - SalColor nMaskColor ) + Color nMaskColor ) { mxImpl->drawMask( rPosAry, rSalBitmap, nMaskColor ); } @@ -238,7 +238,7 @@ SalBitmap *X11SalGraphics::getBitmap( long nX, long nY, long nDX, long nDY ) return mxImpl->getBitmap( nX, nY, nDX, nDY ); } -SalColor X11SalGraphics::getPixel( long nX, long nY ) +Color X11SalGraphics::getPixel( long nX, long nY ) { return mxImpl->getPixel( nX, nY ); } diff --git a/vcl/unx/generic/gdi/xrender_peer.hxx b/vcl/unx/generic/gdi/xrender_peer.hxx index ff1d7cc963d8..785292223489 100644 --- a/vcl/unx/generic/gdi/xrender_peer.hxx +++ b/vcl/unx/generic/gdi/xrender_peer.hxx @@ -127,13 +127,13 @@ inline void XRenderPeer::CompositeTrapezoids( int nOp, nXSrc, nYSrc, pXT, nCount ); } -inline XRenderColor GetXRenderColor( SalColor rSalColor, double fTransparency ) +inline XRenderColor GetXRenderColor( Color rColor, double fTransparency ) { XRenderColor aRetVal; - // convert the SalColor - aRetVal.red = SALCOLOR_RED( rSalColor ); aRetVal.red |= (aRetVal.red << 8); - aRetVal.green = SALCOLOR_GREEN( rSalColor ); aRetVal.green |= (aRetVal.green << 8); - aRetVal.blue = SALCOLOR_BLUE( rSalColor ); aRetVal.blue |= (aRetVal.blue << 8); + // convert the Color + aRetVal.red = rColor.GetRed(); aRetVal.red |= (aRetVal.red << 8); + aRetVal.green = rColor.GetGreen(); aRetVal.green |= (aRetVal.green << 8); + aRetVal.blue = rColor.GetBlue(); aRetVal.blue |= (aRetVal.blue << 8); // handle transparency aRetVal.alpha = 0xFFFF; // default to opaque diff --git a/vcl/unx/generic/print/genpspgraphics.cxx b/vcl/unx/generic/print/genpspgraphics.cxx index e0556e2d8fd2..048904d561d4 100644 --- a/vcl/unx/generic/print/genpspgraphics.cxx +++ b/vcl/unx/generic/print/genpspgraphics.cxx @@ -327,11 +327,11 @@ void GenPspGraphics::SetLineColor() m_pPrinterGfx->SetLineColor (); } -void GenPspGraphics::SetLineColor( SalColor nSalColor ) +void GenPspGraphics::SetLineColor( Color nColor ) { - psp::PrinterColor aColor (SALCOLOR_RED (nSalColor), - SALCOLOR_GREEN (nSalColor), - SALCOLOR_BLUE (nSalColor)); + psp::PrinterColor aColor (nColor.GetRed(), + nColor.GetGreen(), + nColor.GetBlue()); m_pPrinterGfx->SetLineColor (aColor); } @@ -340,11 +340,11 @@ void GenPspGraphics::SetFillColor() m_pPrinterGfx->SetFillColor (); } -void GenPspGraphics::SetFillColor( SalColor nSalColor ) +void GenPspGraphics::SetFillColor( Color nColor ) { - psp::PrinterColor aColor (SALCOLOR_RED (nSalColor), - SALCOLOR_GREEN (nSalColor), - SALCOLOR_BLUE (nSalColor)); + psp::PrinterColor aColor (nColor.GetRed(), + nColor.GetGreen(), + nColor.GetBlue()); m_pPrinterGfx->SetFillColor (aColor); } @@ -368,11 +368,11 @@ void GenPspGraphics::drawPixel( long nX, long nY ) m_pPrinterGfx->DrawPixel (Point(nX, nY)); } -void GenPspGraphics::drawPixel( long nX, long nY, SalColor nSalColor ) +void GenPspGraphics::drawPixel( long nX, long nY, Color nColor ) { - psp::PrinterColor aColor (SALCOLOR_RED (nSalColor), - SALCOLOR_GREEN (nSalColor), - SALCOLOR_BLUE (nSalColor)); + psp::PrinterColor aColor (nColor.GetRed(), + nColor.GetGreen(), + nColor.GetBlue()); m_pPrinterGfx->DrawPixel (Point(nX, nY), aColor); } @@ -491,7 +491,7 @@ void GenPspGraphics::drawBitmap( const SalTwoRect&, void GenPspGraphics::drawMask( const SalTwoRect&, const SalBitmap &, - SalColor ) + Color ) { OSL_FAIL("Error: PrinterGfx::DrawMask() not implemented"); } @@ -502,7 +502,7 @@ SalBitmap* GenPspGraphics::getBitmap( long, long, long, long ) return nullptr; } -SalColor GenPspGraphics::getPixel( long, long ) +Color GenPspGraphics::getPixel( long, long ) { OSL_FAIL("Warning: PrinterGfx::GetPixel() not implemented"); return 0; @@ -653,11 +653,11 @@ void GenPspGraphics::SetFont( const FontSelectPattern *pEntry, int nFallbackLeve ); } -void GenPspGraphics::SetTextColor( SalColor nSalColor ) +void GenPspGraphics::SetTextColor( Color nColor ) { - psp::PrinterColor aColor (SALCOLOR_RED (nSalColor), - SALCOLOR_GREEN (nSalColor), - SALCOLOR_BLUE (nSalColor)); + psp::PrinterColor aColor (nColor.GetRed(), + nColor.GetGreen(), + nColor.GetBlue()); m_pPrinterGfx->SetTextColor (aColor); } |