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 | |
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>
58 files changed, 494 insertions, 523 deletions
diff --git a/include/vcl/salgtype.hxx b/include/vcl/salgtype.hxx index 51f81d6c737b..0e37300f3dbd 100644 --- a/include/vcl/salgtype.hxx +++ b/include/vcl/salgtype.hxx @@ -22,6 +22,7 @@ #include <sal/types.h> #include <o3tl/typed_flags_set.hxx> +#include <tools/color.hxx> enum class DeviceFormat { NONE = -1, @@ -32,16 +33,7 @@ enum class DeviceFormat { #endif }; -typedef sal_uInt32 SalColor; - -constexpr SalColor MAKE_SALCOLOR(sal_uInt8 r, sal_uInt8 g, sal_uInt8 b) { - return sal_uInt32(b) | (sal_uInt32(g) << 8) | (sal_uInt32(r) << 16); -} - -#define SALCOLOR_RED( n ) (static_cast<sal_uInt8>((n)>>16)) -#define SALCOLOR_GREEN( n ) (static_cast<sal_uInt8>((static_cast<sal_uInt16>(n)) >> 8)) -#define SALCOLOR_BLUE( n ) (static_cast<sal_uInt8>(n)) -#define SALCOLOR_NONE (~SalColor(0)) +constexpr ::Color SALCOLOR_NONE ( 0xFF, 0xFF, 0xFF, 0xFF ); // must equal to class Point struct SalPoint diff --git a/vcl/headless/svpgdi.cxx b/vcl/headless/svpgdi.cxx index 2d9694cc7a88..487796755ec5 100644 --- a/vcl/headless/svpgdi.cxx +++ b/vcl/headless/svpgdi.cxx @@ -522,9 +522,9 @@ bool SvpSalGraphics::drawAlphaRect(long nX, long nY, long nWidth, long nHeight, if (m_aFillColor != SALCOLOR_NONE) { - cairo_set_source_rgba(cr, SALCOLOR_RED(m_aFillColor)/255.0, - SALCOLOR_GREEN(m_aFillColor)/255.0, - SALCOLOR_BLUE(m_aFillColor)/255.0, + cairo_set_source_rgba(cr, m_aFillColor.GetRed()/255.0, + m_aFillColor.GetGreen()/255.0, + m_aFillColor.GetBlue()/255.0, fTransparency); if (m_aLineColor == SALCOLOR_NONE) @@ -535,9 +535,9 @@ bool SvpSalGraphics::drawAlphaRect(long nX, long nY, long nWidth, long nHeight, if (m_aLineColor != SALCOLOR_NONE) { - cairo_set_source_rgba(cr, SALCOLOR_RED(m_aLineColor)/255.0, - SALCOLOR_GREEN(m_aLineColor)/255.0, - SALCOLOR_BLUE(m_aLineColor)/255.0, + cairo_set_source_rgba(cr, m_aLineColor.GetRed()/255.0, + m_aLineColor.GetGreen()/255.0, + m_aLineColor.GetBlue()/255.0, fTransparency); extents = getClippedStrokeDamage(cr); @@ -553,8 +553,8 @@ bool SvpSalGraphics::drawAlphaRect(long nX, long nY, long nWidth, long nHeight, SvpSalGraphics::SvpSalGraphics() : m_pSurface(nullptr) , m_fScale(1.0) - , m_aLineColor(MAKE_SALCOLOR(0x00, 0x00, 0x00)) - , m_aFillColor(MAKE_SALCOLOR(0xFF, 0xFF, 0XFF)) + , m_aLineColor(Color(0x00, 0x00, 0x00)) + , m_aFillColor(Color(0xFF, 0xFF, 0XFF)) , m_ePaintMode(PaintMode::Over) , m_aTextRenderImpl(*this) { @@ -607,9 +607,9 @@ void SvpSalGraphics::SetLineColor() m_aLineColor = SALCOLOR_NONE; } -void SvpSalGraphics::SetLineColor( SalColor nSalColor ) +void SvpSalGraphics::SetLineColor( Color nColor ) { - m_aLineColor = nSalColor; + m_aLineColor = nColor; } void SvpSalGraphics::SetFillColor() @@ -617,9 +617,9 @@ void SvpSalGraphics::SetFillColor() m_aFillColor = SALCOLOR_NONE; } -void SvpSalGraphics::SetFillColor( SalColor nSalColor ) +void SvpSalGraphics::SetFillColor( Color nColor ) { - m_aFillColor = nSalColor; + m_aFillColor = nColor; } void SvpSalGraphics::SetXORMode(bool bSet ) @@ -632,13 +632,13 @@ void SvpSalGraphics::SetROPLineColor( SalROPColor nROPColor ) switch( nROPColor ) { case SalROPColor::N0: - m_aLineColor = MAKE_SALCOLOR(0, 0, 0); + m_aLineColor = Color(0, 0, 0); break; case SalROPColor::N1: - m_aLineColor = MAKE_SALCOLOR(0xff, 0xff, 0xff); + m_aLineColor = Color(0xff, 0xff, 0xff); break; case SalROPColor::Invert: - m_aLineColor = MAKE_SALCOLOR(0xff, 0xff, 0xff); + m_aLineColor = Color(0xff, 0xff, 0xff); break; } } @@ -648,13 +648,13 @@ void SvpSalGraphics::SetROPFillColor( SalROPColor nROPColor ) switch( nROPColor ) { case SalROPColor::N0: - m_aFillColor = MAKE_SALCOLOR(0, 0, 0); + m_aFillColor = Color(0, 0, 0); break; case SalROPColor::N1: - m_aFillColor = MAKE_SALCOLOR(0xff, 0xff, 0xff); + m_aFillColor = Color(0xff, 0xff, 0xff); break; case SalROPColor::Invert: - m_aFillColor = MAKE_SALCOLOR(0xff, 0xff, 0xff); + m_aFillColor = Color(0xff, 0xff, 0xff); break; } } @@ -667,14 +667,14 @@ void SvpSalGraphics::drawPixel( long nX, long nY ) } } -void SvpSalGraphics::drawPixel( long nX, long nY, SalColor nSalColor ) +void SvpSalGraphics::drawPixel( long nX, long nY, Color nColor ) { - SalColor aOrigFillColor = m_aFillColor; - SalColor aOrigLineColor = m_aLineColor; + Color aOrigFillColor = m_aFillColor; + Color aOrigLineColor = m_aLineColor; basegfx::B2DPolygon aRect = basegfx::utils::createPolygonFromRect(basegfx::B2DRectangle(nX, nY, nX+1, nY+1)); m_aLineColor = SALCOLOR_NONE; - m_aFillColor = nSalColor; + m_aFillColor = nColor; drawPolyPolygon(basegfx::B2DPolyPolygon(aRect)); @@ -685,8 +685,8 @@ void SvpSalGraphics::drawPixel( long nX, long nY, SalColor nSalColor ) void SvpSalGraphics::drawRect( long nX, long nY, long nWidth, long nHeight ) { // because of the -1 hack we have to do fill and draw separately - SalColor aOrigFillColor = m_aFillColor; - SalColor aOrigLineColor = m_aLineColor; + Color aOrigFillColor = m_aFillColor; + Color aOrigLineColor = m_aLineColor; m_aFillColor = SALCOLOR_NONE; m_aLineColor = SALCOLOR_NONE; @@ -939,9 +939,9 @@ bool SvpSalGraphics::drawPolyLine( } } - cairo_set_source_rgba(cr, SALCOLOR_RED(m_aLineColor)/255.0, - SALCOLOR_GREEN(m_aLineColor)/255.0, - SALCOLOR_BLUE(m_aLineColor)/255.0, + cairo_set_source_rgba(cr, m_aLineColor.GetRed()/255.0, + m_aLineColor.GetGreen()/255.0, + m_aLineColor.GetBlue()/255.0, 1.0-fTransparency); cairo_set_line_join(cr, eCairoLineJoin); @@ -1034,9 +1034,9 @@ bool SvpSalGraphics::drawPolyPolygon(const basegfx::B2DPolyPolygon& rPolyPoly, d if (m_aFillColor != SALCOLOR_NONE) { - cairo_set_source_rgba(cr, SALCOLOR_RED(m_aFillColor)/255.0, - SALCOLOR_GREEN(m_aFillColor)/255.0, - SALCOLOR_BLUE(m_aFillColor)/255.0, + cairo_set_source_rgba(cr, m_aFillColor.GetRed()/255.0, + m_aFillColor.GetGreen()/255.0, + m_aFillColor.GetBlue()/255.0, 1.0-fTransparency); if (m_aLineColor == SALCOLOR_NONE) @@ -1047,9 +1047,9 @@ bool SvpSalGraphics::drawPolyPolygon(const basegfx::B2DPolyPolygon& rPolyPoly, d if (m_aLineColor != SALCOLOR_NONE) { - cairo_set_source_rgba(cr, SALCOLOR_RED(m_aLineColor)/255.0, - SALCOLOR_GREEN(m_aLineColor)/255.0, - SALCOLOR_BLUE(m_aLineColor)/255.0, + cairo_set_source_rgba(cr, m_aLineColor.GetRed()/255.0, + m_aLineColor.GetGreen()/255.0, + m_aLineColor.GetBlue()/255.0, 1.0-fTransparency); extents = getClippedStrokeDamage(cr); @@ -1062,18 +1062,18 @@ bool SvpSalGraphics::drawPolyPolygon(const basegfx::B2DPolyPolygon& rPolyPoly, d return true; } -void SvpSalGraphics::applyColor(cairo_t *cr, SalColor aColor) +void SvpSalGraphics::applyColor(cairo_t *cr, Color aColor) { if (cairo_surface_get_content(m_pSurface) == CAIRO_CONTENT_COLOR_ALPHA) { - cairo_set_source_rgba(cr, SALCOLOR_RED(aColor)/255.0, - SALCOLOR_GREEN(aColor)/255.0, - SALCOLOR_BLUE(aColor)/255.0, + cairo_set_source_rgba(cr, aColor.GetRed()/255.0, + aColor.GetGreen()/255.0, + aColor.GetBlue()/255.0, 1.0); } else { - double fSet = aColor == sal_uInt32(COL_BLACK) ? 1.0 : 0.0; + double fSet = aColor == COL_BLACK ? 1.0 : 0.0; cairo_set_source_rgba(cr, 1, 1, 1, fSet); cairo_set_operator(cr, CAIRO_OPERATOR_SOURCE); } @@ -1226,7 +1226,7 @@ static sal_uInt8 premultiply(sal_uInt8 c, sal_uInt8 a) void SvpSalGraphics::drawMask( const SalTwoRect& rTR, const SalBitmap& rSalBitmap, - SalColor nMaskColor ) + Color nMaskColor ) { /** creates an image from the given rectangle, replacing all black pixels * with nMaskColor and make all other full transparent */ @@ -1244,9 +1244,9 @@ void SvpSalGraphics::drawMask( const SalTwoRect& rTR, sal_uInt8 r = unpremultiply(data[SVP_CAIRO_RED], data[SVP_CAIRO_ALPHA]); if (r == 0 && g == 0 && b == 0) { - data[0] = SALCOLOR_BLUE(nMaskColor); - data[1] = SALCOLOR_GREEN(nMaskColor); - data[2] = SALCOLOR_RED(nMaskColor); + data[0] = nMaskColor.GetBlue(); + data[1] = nMaskColor.GetGreen(); + data[2] = nMaskColor.GetRed(); data[3] = 0xff; } else @@ -1318,7 +1318,7 @@ SalBitmap* SvpSalGraphics::getBitmap( long nX, long nY, long nWidth, long nHeigh return pBitmap; } -SalColor SvpSalGraphics::getPixel( long nX, long nY ) +Color SvpSalGraphics::getPixel( long nX, long nY ) { cairo_surface_t *target = cairo_image_surface_create(CAIRO_FORMAT_ARGB32, 1, 1); cairo_t* cr = cairo_create(target); @@ -1333,7 +1333,7 @@ SalColor SvpSalGraphics::getPixel( long nX, long nY ) sal_uInt8 b = unpremultiply(data[SVP_CAIRO_BLUE], data[SVP_CAIRO_ALPHA]); sal_uInt8 g = unpremultiply(data[SVP_CAIRO_GREEN], data[SVP_CAIRO_ALPHA]); sal_uInt8 r = unpremultiply(data[SVP_CAIRO_RED], data[SVP_CAIRO_ALPHA]); - SalColor nRet = MAKE_SALCOLOR(r, g, b); + Color nRet = Color(r, g, b); cairo_surface_destroy(target); diff --git a/vcl/headless/svptext.cxx b/vcl/headless/svptext.cxx index 47f158d56b51..caa34e33f7b9 100644 --- a/vcl/headless/svptext.cxx +++ b/vcl/headless/svptext.cxx @@ -111,9 +111,9 @@ void SvpSalGraphics::DrawTextLayout(const CommonSalLayout& rLayout) m_aTextRenderImpl.DrawTextLayout(rLayout); } -void SvpSalGraphics::SetTextColor( SalColor nSalColor ) +void SvpSalGraphics::SetTextColor( Color nColor ) { - m_aTextRenderImpl.SetTextColor(nSalColor); + m_aTextRenderImpl.SetTextColor(nColor); } #if ENABLE_CAIRO_CANVAS diff --git a/vcl/inc/headless/svpgdi.hxx b/vcl/inc/headless/svpgdi.hxx index b14be042ed67..28c453d0cfbe 100644 --- a/vcl/inc/headless/svpgdi.hxx +++ b/vcl/inc/headless/svpgdi.hxx @@ -86,8 +86,8 @@ class VCL_DLLPUBLIC SvpSalGraphics : public SalGraphics cairo_surface_t* m_pSurface; basegfx::B2IVector m_aFrameSize; double m_fScale; - SalColor m_aLineColor; - SalColor m_aFillColor; + Color m_aLineColor; + Color m_aFillColor; PaintMode m_ePaintMode; public: @@ -99,7 +99,7 @@ private: void invert(const basegfx::B2DPolygon &rPoly, SalInvert nFlags); void copySource(const SalTwoRect& rTR, cairo_surface_t* source); void setupPolyPolygon(cairo_t* cr, const basegfx::B2DPolyPolygon& rPolyPoly); - void applyColor(cairo_t *cr, SalColor rColor); + void applyColor(cairo_t *cr, Color rColor); void drawPolyPolygon(const basegfx::B2DPolyPolygon& rPolyPoly); protected: vcl::Region m_aClipRegion; @@ -135,16 +135,16 @@ public: virtual bool setClipRegion( const vcl::Region& ) override; virtual void SetLineColor() override; - virtual void SetLineColor( SalColor nSalColor ) override; + virtual void SetLineColor( Color nColor ) override; virtual void SetFillColor() override; - virtual void SetFillColor( SalColor nSalColor ) override; + virtual void SetFillColor( Color nColor ) override; virtual void SetXORMode( bool bSet ) override; virtual void SetROPLineColor( SalROPColor nROPColor ) override; virtual void SetROPFillColor( SalROPColor nROPColor ) override; - virtual void SetTextColor( SalColor nSalColor ) override; + virtual void SetTextColor( Color nColor ) override; virtual void SetFont( const FontSelectPattern*, int nFallbackLevel ) override; virtual void GetFontMetric( ImplFontMetricDataRef&, int nFallbackLevel ) override; virtual const FontCharMapRef GetFontCharMap() const override; @@ -173,7 +173,7 @@ public: virtual void DrawTextLayout( const CommonSalLayout& ) override; virtual bool supportsOperation( OutDevSupportType ) const override; 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; virtual void drawRect( long nX, long nY, long nWidth, long nHeight ) override; virtual bool drawPolyPolygon( const basegfx::B2DPolyPolygon&, double fTransparency ) override; @@ -216,9 +216,9 @@ public: const SalBitmap& rTransparentBitmap ) override; 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; virtual void invert( long nX, long nY, long nWidth, long nHeight, SalInvert nFlags ) override; virtual void invert( sal_uInt32 nPoints, const SalPoint* pPtAry, SalInvert nFlags ) override; diff --git a/vcl/inc/opengl/LineRenderUtils.hxx b/vcl/inc/opengl/LineRenderUtils.hxx index a3df1d6b5192..1fa4e785d5fe 100644 --- a/vcl/inc/opengl/LineRenderUtils.hxx +++ b/vcl/inc/opengl/LineRenderUtils.hxx @@ -29,7 +29,7 @@ private: public: LineBuilder(std::vector<Vertex>& rVertices, std::vector<GLuint>& rIndices, - SalColor nColor, GLfloat fTransparency, + Color nColor, GLfloat fTransparency, GLfloat fLineWidth, bool bUseAA); void appendLineSegment(const glm::vec2& rPoint1, const glm::vec2& rNormal1, GLfloat aExtrusion1, diff --git a/vcl/inc/opengl/RenderList.hxx b/vcl/inc/opengl/RenderList.hxx index c356def2ff93..b8595921a46a 100644 --- a/vcl/inc/opengl/RenderList.hxx +++ b/vcl/inc/opengl/RenderList.hxx @@ -150,22 +150,22 @@ public: return maRenderEntries; } - void addDrawTextureWithMaskColor(OpenGLTexture const & rTexture, SalColor nColor, const SalTwoRect& r2Rect); + void addDrawTextureWithMaskColor(OpenGLTexture const & rTexture, Color nColor, const SalTwoRect& r2Rect); - void addDrawPixel(long nX, long nY, SalColor nColor); + void addDrawPixel(long nX, long nY, Color nColor); void addDrawRectangle(long nX, long nY, long nWidth, long nHeight, double fTransparency, - SalColor nLineColor, SalColor nFillColor); + Color nLineColor, Color nFillColor); - void addDrawLine(long nX1, long nY1, long nX2, long nY2, SalColor nLineColor, bool bUseAA); + void addDrawLine(long nX1, long nY1, long nX2, long nY2, Color nLineColor, bool bUseAA); void addDrawPolyPolygon(const basegfx::B2DPolyPolygon& rPolyPolygon, double fTransparency, - SalColor nLineColor, SalColor nFillColor, bool bUseAA); + Color nLineColor, Color nFillColor, bool bUseAA); void addDrawPolyLine(const basegfx::B2DPolygon& rPolygon, double fTransparency, const basegfx::B2DVector& rLineWidth, basegfx::B2DLineJoin eLineJoin, css::drawing::LineCap eLineCap, double fMiterMinimumAngle, - SalColor nLineColor, bool bUseAA); + Color nLineColor, bool bUseAA); }; #endif // INCLUDED_VCL_INC_OPENGL_RENDERLIST_H diff --git a/vcl/inc/opengl/VertexUtils.hxx b/vcl/inc/opengl/VertexUtils.hxx index de2c070abcc9..4d4fd12a116a 100644 --- a/vcl/inc/opengl/VertexUtils.hxx +++ b/vcl/inc/opengl/VertexUtils.hxx @@ -43,19 +43,19 @@ inline void addRectangle<GL_TRIANGLE_FAN>(std::vector<GLfloat>& rVertices, GLflo }); } -inline void createColor(SalColor nColor, GLfloat fTransparency, GLubyte& nR, GLubyte& nG, GLubyte& nB, GLubyte& nA) +inline void createColor(Color nColor, GLfloat fTransparency, GLubyte& nR, GLubyte& nG, GLubyte& nB, GLubyte& nA) { - nR = SALCOLOR_RED(nColor); - nG = SALCOLOR_GREEN(nColor); - nB = SALCOLOR_BLUE(nColor); + nR = nColor.GetRed(); + nG = nColor.GetGreen(); + nB = nColor.GetBlue(); nA = (1.0f - fTransparency) * 255.0f; } template<GLenum TYPE> -inline void addQuadColors(std::vector<GLubyte>& rColors, SalColor nColor, GLfloat fTransparency); +inline void addQuadColors(std::vector<GLubyte>& rColors, Color nColor, GLfloat fTransparency); template<> -inline void addQuadColors<GL_TRIANGLES>(std::vector<GLubyte>& rColors, SalColor nColor, GLfloat fTransparency) +inline void addQuadColors<GL_TRIANGLES>(std::vector<GLubyte>& rColors, Color nColor, GLfloat fTransparency) { GLubyte nR, nG, nB, nA; createColor(nColor, fTransparency, nR, nG, nB, nA); diff --git a/vcl/inc/opengl/program.hxx b/vcl/inc/opengl/program.hxx index 95d1c0e762d8..e18db93d57c4 100644 --- a/vcl/inc/opengl/program.hxx +++ b/vcl/inc/opengl/program.hxx @@ -87,8 +87,8 @@ public: void SetUniform2fv( const OString& rName, GLsizei nCount, GLfloat const * aValues ); void SetUniform1i( const OString& rName, GLint v1 ); void SetColor( const OString& rName, const Color& rColor ); - void SetColor( const OString& rName, SalColor nColor, sal_uInt8 nTransparency ); - void SetColorf( const OString& rName, SalColor nColor, double fTransparency ); + void SetColor( const OString& rName, Color nColor, sal_uInt8 nTransparency ); + void SetColorf( const OString& rName, Color nColor, double fTransparency ); void SetColorWithIntensity( const OString& rName, const Color& rColor, long nFactor ); void SetTexture( const OString& rName, OpenGLTexture& rTexture ); void SetTransform( const OString& rName, const OpenGLTexture& rTexture, diff --git a/vcl/inc/openglgdiimpl.hxx b/vcl/inc/openglgdiimpl.hxx index 97f2d3bec9b2..251d176946d7 100644 --- a/vcl/inc/openglgdiimpl.hxx +++ b/vcl/inc/openglgdiimpl.hxx @@ -92,14 +92,14 @@ protected: */ OpenGLTexture maOffscreenTex; - SalColor mnLineColor; - SalColor mnFillColor; + Color mnLineColor; + Color mnFillColor; #ifdef DBG_UTIL bool mProgramIsSolidColor; #endif sal_uInt32 mnDrawCount; sal_uInt32 mnDrawCountAtFlush; - SalColor mProgramSolidColor; + Color mProgramSolidColor; double mProgramSolidTransparency; std::unique_ptr<RenderList> mpRenderList; @@ -113,11 +113,11 @@ protected: public: bool UseProgram( const OUString& rVertexShader, const OUString& rFragmentShader, const OString& preamble = "" ); - bool UseSolid( SalColor nColor, sal_uInt8 nTransparency ); - bool UseSolid( SalColor nColor, double fTransparency ); - bool UseSolid( SalColor nColor ); + bool UseSolid( Color nColor, sal_uInt8 nTransparency ); + bool UseSolid( Color nColor, double fTransparency ); + bool UseSolid( Color nColor ); void UseSolid(); - bool UseLine(SalColor nColor, double fTransparency, GLfloat fLineWidth, bool bUseAA); + bool UseLine(Color nColor, double fTransparency, GLfloat fLineWidth, bool bUseAA); void UseLine(GLfloat fLineWidth, bool bUseAA); bool UseInvert50(); bool UseInvert(SalInvert nFlags); @@ -138,11 +138,11 @@ public: void DrawTextureDiff( OpenGLTexture& rTexture, OpenGLTexture& rMask, const SalTwoRect& rPosAry, bool bInverted ); void DrawTextureWithMask( OpenGLTexture& rTexture, OpenGLTexture& rMask, const SalTwoRect& rPosAry ); void DrawBlendedTexture( OpenGLTexture& rTexture, OpenGLTexture& rMask, OpenGLTexture& rAlpha, const SalTwoRect& rPosAry ); - void DrawMask( OpenGLTexture& rTexture, SalColor nMaskColor, const SalTwoRect& rPosAry ); + void DrawMask( OpenGLTexture& rTexture, Color nMaskColor, const SalTwoRect& rPosAry ); void DrawLinearGradient( const Gradient& rGradient, const tools::Rectangle& rRect ); void DrawAxialGradient( const Gradient& rGradient, const tools::Rectangle& rRect ); void DrawRadialGradient( const Gradient& rGradient, const tools::Rectangle& rRect ); - void DeferredTextDraw(OpenGLTexture const & rTexture, const SalColor nMaskColor, const SalTwoRect& rPosAry); + void DeferredTextDraw(OpenGLTexture const & rTexture, const Color nMaskColor, const SalTwoRect& rPosAry); void FlushDeferredDrawing(); void FlushLinesOrTriangles(DrawShaderType eType, RenderParameters const & rParameters); @@ -218,14 +218,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; @@ -238,7 +238,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; @@ -306,11 +306,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/inc/outdata.hxx b/vcl/inc/outdata.hxx index f48f0f991b64..e6aa49175f55 100644 --- a/vcl/inc/outdata.hxx +++ b/vcl/inc/outdata.hxx @@ -23,11 +23,6 @@ #include <tools/color.hxx> #include <vcl/salgtype.hxx> -inline SalColor ImplColorToSal( Color aColor ) -{ - return MAKE_SALCOLOR( aColor.GetRed(), aColor.GetGreen(), aColor.GetBlue() ); -} - inline bool ImplIsColorTransparent( Color aColor ) { return aColor.GetTransparency() != 0; diff --git a/vcl/inc/quartz/salbmp.h b/vcl/inc/quartz/salbmp.h index d7c2fb74db51..d2799add6847 100644 --- a/vcl/inc/quartz/salbmp.h +++ b/vcl/inc/quartz/salbmp.h @@ -93,7 +93,7 @@ public: public: CGImageRef CreateWithMask( const QuartzSalBitmap& rMask, int nX, int nY, int nWidth, int nHeight ) const; - CGImageRef CreateColorMask( int nX, int nY, int nWidth, int nHeight, SalColor nMaskColor ) const; + CGImageRef CreateColorMask( int nX, int nY, int nWidth, int nHeight, Color nMaskColor ) const; CGImageRef CreateCroppedImage( int nX, int nY, int nWidth, int nHeight ) const; }; diff --git a/vcl/inc/quartz/salgdi.h b/vcl/inc/quartz/salgdi.h index 4016fcb4a2cc..071cc0c079f2 100644 --- a/vcl/inc/quartz/salgdi.h +++ b/vcl/inc/quartz/salgdi.h @@ -223,7 +223,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; virtual void drawRect( long nX, long nY, long nWidth, long nHeight ) override; virtual void drawPolyLine( sal_uInt32 nPoints, const SalPoint* pPtAry ) override; @@ -255,10 +255,10 @@ public: const SalBitmap& rTransparentBitmap ) override; 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( long nX, long nY, long nWidth, long nHeight, SalInvert nFlags) override; @@ -313,12 +313,12 @@ public: // set the line color to transparent (= don't draw lines) 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; // set line color for raster operations @@ -326,7 +326,7 @@ public: // set fill color for raster operations virtual void SetROPFillColor( SalROPColor nROPColor ) override; // set the text color to a specific color - virtual void SetTextColor( SalColor nSalColor ) override; + virtual void SetTextColor( Color nColor ) override; // set the font virtual void SetFont( const FontSelectPattern*, int nFallbackLevel ) override; // get the current font's metrics diff --git a/vcl/inc/quartz/salgdicommon.hxx b/vcl/inc/quartz/salgdicommon.hxx index c73e07516cf0..d199b3cc95ba 100644 --- a/vcl/inc/quartz/salgdicommon.hxx +++ b/vcl/inc/quartz/salgdicommon.hxx @@ -38,7 +38,6 @@ class RGBAColor { public: RGBAColor( ::Color ); - RGBAColor( SalColor ); RGBAColor( float fRed, float fGreen, float fBlue, float fAlpha ); //NOTUSEDYET const CGFloat* AsArray() const { return m_fRGBA; } bool IsVisible() const { return m_fRGBA[3] > 0; } @@ -52,14 +51,6 @@ private: CGFloat m_fRGBA[4]; // red, green, blue, alpha }; -inline RGBAColor::RGBAColor( SalColor nSalColor ) -{ - m_fRGBA[0] = SALCOLOR_RED(nSalColor) * (1.0/255); - m_fRGBA[1] = SALCOLOR_GREEN(nSalColor) * (1.0/255); - m_fRGBA[2] = SALCOLOR_BLUE(nSalColor) * (1.0/255); - m_fRGBA[3] = 1.0; // opaque -} - inline RGBAColor::RGBAColor( ::Color nColor ) { m_fRGBA[0] = nColor.GetRed() * (1.0/255); diff --git a/vcl/inc/salgdi.hxx b/vcl/inc/salgdi.hxx index 655c3ea17aa1..71ef1eae1c08 100644 --- a/vcl/inc/salgdi.hxx +++ b/vcl/inc/salgdi.hxx @@ -102,14 +102,14 @@ public: virtual void SetLineColor() = 0; // set the line color to a specific color - virtual void SetLineColor( SalColor nSalColor ) = 0; + virtual void SetLineColor( Color nColor ) = 0; // set the fill color to transparent (= don't fill) virtual void SetFillColor() = 0; // set the fill color to a specific color, shapes will be // filled accordingly - virtual void SetFillColor( SalColor nSalColor ) = 0; + virtual void SetFillColor( Color nColor ) = 0; // enable/disable XOR drawing virtual void SetXORMode( bool bSet ) = 0; @@ -121,7 +121,7 @@ public: virtual void SetROPFillColor( SalROPColor nROPColor ) = 0; // set the text color to a specific color - virtual void SetTextColor( SalColor nSalColor ) = 0; + virtual void SetTextColor( Color nColor ) = 0; // set the font virtual void SetFont( const FontSelectPattern*, int nFallbackLevel ) = 0; @@ -221,7 +221,7 @@ public: // draw --> LineColor and FillColor and RasterOp and ClipRegion void DrawPixel( long nX, long nY, const OutputDevice *pOutDev ); - void DrawPixel( long nX, long nY, SalColor nSalColor, const OutputDevice *pOutDev ); + void DrawPixel( long nX, long nY, Color nColor, const OutputDevice *pOutDev ); void DrawLine( long nX1, long nY1, long nX2, long nY2, const OutputDevice *pOutDev ); @@ -304,7 +304,7 @@ public: void DrawMask( const SalTwoRect& rPosAry, const SalBitmap& rSalBitmap, - SalColor nMaskColor, + Color nMaskColor, const OutputDevice *pOutDev ); SalBitmap* GetBitmap( @@ -312,7 +312,7 @@ public: long nWidth, long nHeight, const OutputDevice *pOutDev ); - SalColor GetPixel( + Color GetPixel( long nX, long nY, const OutputDevice *pOutDev ); @@ -445,7 +445,7 @@ protected: // draw --> LineColor and FillColor and RasterOp and ClipRegion virtual void drawPixel( long nX, long nY ) = 0; - virtual void drawPixel( long nX, long nY, SalColor nSalColor ) = 0; + virtual void drawPixel( long nX, long nY, Color nColor ) = 0; virtual void drawLine( long nX1, long nY1, long nX2, long nY2 ) = 0; @@ -507,11 +507,11 @@ protected: virtual void drawMask( const SalTwoRect& rPosAry, const SalBitmap& rSalBitmap, - SalColor nMaskColor ) = 0; + Color nMaskColor ) = 0; virtual SalBitmap* getBitmap( long nX, long nY, long nWidth, long nHeight ) = 0; - virtual SalColor getPixel( long nX, long nY ) = 0; + virtual Color getPixel( long nX, long nY ) = 0; // invert --> ClipRegion (only Windows or VirDevs) virtual void invert( diff --git a/vcl/inc/salgdiimpl.hxx b/vcl/inc/salgdiimpl.hxx index 1771afaeaee8..89c6f4dba61d 100644 --- a/vcl/inc/salgdiimpl.hxx +++ b/vcl/inc/salgdiimpl.hxx @@ -24,6 +24,7 @@ #include <rtl/ustring.hxx> +#include <tools/color.hxx> #include <tools/poly.hxx> #include <tools/solar.h> @@ -68,14 +69,14 @@ public: virtual void SetLineColor() = 0; // set the line color to a specific color - virtual void SetLineColor( SalColor nSalColor ) = 0; + virtual void SetLineColor( Color nColor ) = 0; // set the fill color to transparent (= don't fill) virtual void SetFillColor() = 0; // set the fill color to a specific color, shapes will be // filled accordingly - virtual void SetFillColor( SalColor nSalColor ) = 0; + virtual void SetFillColor( Color nColor ) = 0; // enable/disable XOR drawing virtual void SetXORMode( bool bSet ) = 0; @@ -88,7 +89,7 @@ public: // draw --> LineColor and FillColor and RasterOp and ClipRegion virtual void drawPixel( long nX, long nY ) = 0; - virtual void drawPixel( long nX, long nY, SalColor nSalColor ) = 0; + virtual void drawPixel( long nX, long nY, Color nColor ) = 0; virtual void drawLine( long nX1, long nY1, long nX2, long nY2 ) = 0; @@ -146,11 +147,11 @@ public: virtual void drawMask( const SalTwoRect& rPosAry, const SalBitmap& rSalBitmap, - SalColor nMaskColor ) = 0; + Color nMaskColor ) = 0; virtual SalBitmap* getBitmap( long nX, long nY, long nWidth, long nHeight ) = 0; - virtual SalColor getPixel( long nX, long nY ) = 0; + virtual Color getPixel( long nX, long nY ) = 0; // invert --> ClipRegion (only Windows or VirDevs) virtual void invert( diff --git a/vcl/inc/textrender.hxx b/vcl/inc/textrender.hxx index 3866a54c6b6f..8a33c7b07abe 100644 --- a/vcl/inc/textrender.hxx +++ b/vcl/inc/textrender.hxx @@ -34,7 +34,7 @@ class TextRenderImpl public: virtual ~TextRenderImpl() {} - virtual void SetTextColor( SalColor nSalColor ) = 0; + virtual void SetTextColor( Color nColor ) = 0; virtual void SetFont( const FontSelectPattern*, int nFallbackLevel ) = 0; virtual void GetFontMetric( ImplFontMetricDataRef&, int nFallbackLevel ) = 0; virtual const FontCharMapRef GetFontCharMap() const = 0; diff --git a/vcl/inc/unx/cairotextrender.hxx b/vcl/inc/unx/cairotextrender.hxx index 2ee28bdb3837..bdbc201780b4 100644 --- a/vcl/inc/unx/cairotextrender.hxx +++ b/vcl/inc/unx/cairotextrender.hxx @@ -34,7 +34,7 @@ class VCL_DLLPUBLIC CairoTextRender : public TextRenderImpl { FreetypeFont* mpFreetypeFont[ MAX_FALLBACK ]; - SalColor mnTextColor; + Color mnTextColor; protected: virtual GlyphCache& getPlatformGlyphCache() = 0; @@ -50,7 +50,7 @@ public: CairoTextRender(); - virtual void SetTextColor( SalColor nSalColor ) override; + virtual void SetTextColor( Color nColor ) override; virtual void SetFont( const FontSelectPattern*, int nFallbackLevel ) override; virtual void GetFontMetric( ImplFontMetricDataRef&, int nFallbackLevel ) override; virtual const FontCharMapRef GetFontCharMap() const override; diff --git a/vcl/inc/unx/genpspgraphics.h b/vcl/inc/unx/genpspgraphics.h index 7c01d57e0786..52ef103aaf7d 100644 --- a/vcl/inc/unx/genpspgraphics.h +++ b/vcl/inc/unx/genpspgraphics.h @@ -75,14 +75,14 @@ public: virtual bool setClipRegion( const vcl::Region& ) override; virtual void SetLineColor() override; - virtual void SetLineColor( SalColor nSalColor ) override; + virtual void SetLineColor( Color nColor ) override; virtual void SetFillColor() override; - virtual void SetFillColor( SalColor nSalColor ) override; + virtual void SetFillColor( Color nColor ) override; virtual void SetXORMode( bool bSet ) override; virtual void SetROPLineColor( SalROPColor nROPColor ) override; virtual void SetROPFillColor( SalROPColor nROPColor ) override; - virtual void SetTextColor( SalColor nSalColor ) override; + virtual void SetTextColor( Color nColor ) override; virtual void SetFont( const FontSelectPattern*, int nFallbackLevel ) override; virtual void GetFontMetric( ImplFontMetricDataRef&, int nFallbackLevel ) override; virtual const FontCharMapRef GetFontCharMap() const override; @@ -118,7 +118,7 @@ public: virtual void DrawTextLayout( const CommonSalLayout& ) override; virtual bool supportsOperation( OutDevSupportType ) const override; 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; virtual void drawRect( long nX, long nY, long nWidth, long nHeight ) override; virtual void drawPolyLine( sal_uInt32 nPoints, const SalPoint* pPtAry ) override; @@ -162,9 +162,9 @@ public: const SalBitmap& rTransparentBitmap ) override; 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; virtual void invert( long nX, long nY, long nWidth, long nHeight, SalInvert nFlags ) override; virtual void invert( sal_uInt32 nPoints, const SalPoint* pPtAry, diff --git a/vcl/inc/unx/saldisp.hxx b/vcl/inc/unx/saldisp.hxx index 259af28e63a8..48756f3cbfe1 100644 --- a/vcl/inc/unx/saldisp.hxx +++ b/vcl/inc/unx/saldisp.hxx @@ -68,7 +68,7 @@ typedef enum { extern "C" srv_vendor_t sal_GetServerVendor( Display *p_display ); -// MSB/Bigendian view (SalColor == RGB, r=0xFF0000, g=0xFF00, b=0xFF) +// MSB/Bigendian view (Color == RGB, r=0xFF0000, g=0xFF00, b=0xFF) enum SalRGB { RGB, RBG, GBR, GRB, @@ -97,15 +97,15 @@ public: int GetClass() const { return c_class; } int GetDepth() const { return depth; } - Pixel GetTCPixel( SalColor nColor ) const; - SalColor GetTCColor( Pixel nPixel ) const; + Pixel GetTCPixel( Color nColor ) const; + Color GetTCColor( Pixel nPixel ) const; }; class SalColormap { const SalDisplay* m_pDisplay; Colormap m_hColormap; - std::vector<SalColor> m_aPalette; // Pseudocolor + std::vector<Color> m_aPalette; // Pseudocolor SalVisual m_aVisual; std::vector<sal_uInt16> m_aLookupTable; // Pseudocolor: 12bit reduction Pixel m_nWhitePixel; @@ -139,8 +139,8 @@ public: int r, int g, int b ) const; - Pixel GetPixel( SalColor nColor ) const; - SalColor GetColor( Pixel nPixel ) const; + Pixel GetPixel( Color nColor ) const; + Color GetColor( Pixel nPixel ) const; }; class SalI18N_InputMethod; diff --git a/vcl/inc/unx/salgdi.h b/vcl/inc/unx/salgdi.h index 887039b6b1d3..dded647ab97d 100644 --- a/vcl/inc/unx/salgdi.h +++ b/vcl/inc/unx/salgdi.h @@ -91,7 +91,7 @@ public: const SalColormap& GetColormap() const { return *m_pColormap; } using SalGraphics::GetPixel; - inline Pixel GetPixel( SalColor nSalColor ) const; + inline Pixel GetPixel( Color nColor ) const; const SalX11Screen& GetScreenNumber() const { return m_nXScreen; } @@ -104,17 +104,17 @@ public: virtual bool setClipRegion( const vcl::Region& ) override; virtual void SetLineColor() override; - virtual void SetLineColor( SalColor nSalColor ) override; + virtual void SetLineColor( Color nColor ) override; virtual void SetFillColor() override; - virtual void SetFillColor( SalColor nSalColor ) override; + virtual void SetFillColor( Color nColor ) override; virtual void SetXORMode( bool bSet ) override; virtual void SetROPLineColor( SalROPColor nROPColor ) override; virtual void SetROPFillColor( SalROPColor nROPColor ) override; - virtual void SetTextColor( SalColor nSalColor ) override; + virtual void SetTextColor( Color nColor ) override; virtual void SetFont( const FontSelectPattern*, int nFallbackLevel ) override; virtual void GetFontMetric( ImplFontMetricDataRef&, int nFallbackLevel ) override; virtual const FontCharMapRef GetFontCharMap() const override; @@ -149,7 +149,7 @@ public: virtual bool supportsOperation( OutDevSupportType ) const override; 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; virtual void drawRect( long nX, long nY, long nWidth, long nHeight ) override; virtual void drawPolyLine( sal_uInt32 nPoints, const SalPoint* pPtAry ) override; @@ -215,10 +215,10 @@ 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; virtual void invert( long nX, long nY, long nWidth, long nHeight, SalInvert nFlags ) override; virtual void invert( sal_uInt32 nPoints, const SalPoint* pPtAry, SalInvert nFlags ) override; @@ -305,7 +305,7 @@ public: protected: using SalGraphics::SetClipRegion; void SetClipRegion( GC pGC, Region pXReg = nullptr ) const; - bool GetDitherPixmap ( SalColor nSalColor ); + bool GetDitherPixmap ( Color nColor ); using SalGraphics::DrawBitmap; @@ -327,8 +327,8 @@ protected: Region mpClipRegion; #if ENABLE_CAIRO_CANVAS vcl::Region maClipRegion; - SalColor mnPenColor; - SalColor mnFillColor; + Color mnPenColor; + Color mnFillColor; #endif // ENABLE_CAIRO_CANVAS GC pFontGC_; // Font attributes @@ -356,8 +356,8 @@ inline const SalVisual& X11SalGraphics::GetVisual() const inline Display *X11SalGraphics::GetXDisplay() const { return GetColormap().GetXDisplay(); } -inline Pixel X11SalGraphics::GetPixel( SalColor nSalColor ) const -{ return GetColormap().GetPixel( nSalColor ); } +inline Pixel X11SalGraphics::GetPixel( Color nColor ) const +{ return GetColormap().GetPixel( nColor ); } #endif // INCLUDED_VCL_INC_UNX_SALGDI_H diff --git a/vcl/inc/win/salgdi.h b/vcl/inc/win/salgdi.h index 2431b388c67b..b1edef997d85 100644 --- a/vcl/inc/win/salgdi.h +++ b/vcl/inc/win/salgdi.h @@ -224,7 +224,7 @@ protected: virtual bool setClipRegion( const vcl::Region& ) override; // 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; virtual void drawRect( long nX, long nY, long nWidth, long nHeight ) override; virtual void drawPolyLine( sal_uInt32 nPoints, const SalPoint* pPtAry ) override; @@ -256,10 +256,10 @@ protected: const SalBitmap& rTransparentBitmap ) override; 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( long nX, long nY, long nWidth, long nHeight, SalInvert nFlags) override; @@ -317,12 +317,12 @@ public: // set the line color to transparent (= don't draw lines) 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; // set line color for raster operations @@ -330,7 +330,7 @@ public: // set fill color for raster operations virtual void SetROPFillColor( SalROPColor nROPColor ) override; // set the text color to a specific color - virtual void SetTextColor( SalColor nSalColor ) override; + virtual void SetTextColor( Color nColor ) override; // set the font virtual void SetFont( const FontSelectPattern*, int nFallbackLevel ) override; // get the current font's metrics @@ -396,7 +396,7 @@ public: // Init/Deinit Graphics void ImplUpdateSysColorEntries(); -int ImplIsSysColorEntry( SalColor nSalColor ); +int ImplIsSysColorEntry( Color nColor ); void ImplGetLogFontFromFontSelect( HDC, const FontSelectPattern*, LOGFONTW&, bool bTestVerticalAvail ); diff --git a/vcl/opengl/LineRenderUtils.cxx b/vcl/opengl/LineRenderUtils.cxx index 35f95c4b2da9..6ba78048b9e0 100644 --- a/vcl/opengl/LineRenderUtils.cxx +++ b/vcl/opengl/LineRenderUtils.cxx @@ -14,13 +14,13 @@ namespace vcl { LineBuilder::LineBuilder(std::vector<Vertex>& rVertices, std::vector<GLuint>& rIndices, - SalColor nColor, GLfloat fTransparency, + Color nColor, GLfloat fTransparency, GLfloat fLineWidth, bool bUseAA) : mrVertices(rVertices) , mrIndices(rIndices) - , mR(SALCOLOR_RED(nColor)) - , mG(SALCOLOR_GREEN(nColor)) - , mB(SALCOLOR_BLUE(nColor)) + , mR(nColor.GetRed()) + , mG(nColor.GetGreen()) + , mB(nColor.GetBlue()) , mA((1.0f - fTransparency) * 255.0f) , mfLineWidth(fLineWidth) , mfLineWidthAndAA(bUseAA ? fLineWidth : -fLineWidth) diff --git a/vcl/opengl/RenderList.cxx b/vcl/opengl/RenderList.cxx index 9a9924768a5a..927de11525b9 100644 --- a/vcl/opengl/RenderList.cxx +++ b/vcl/opengl/RenderList.cxx @@ -151,7 +151,7 @@ void appendPolyLine(vcl::LineBuilder& rBuilder, const basegfx::B2DPolygon& rPoly inline void appendTrapezoid(std::vector<Vertex>& rVertices, std::vector<GLuint>& rIndices, GLfloat x1, GLfloat y1, GLfloat x2, GLfloat y2, GLfloat x3, GLfloat y3, GLfloat x4, GLfloat y4, - SalColor nColor, GLfloat fTransparency) + Color nColor, GLfloat fTransparency) { GLubyte nR, nG, nB, nA; vcl::vertex::createColor(nColor, fTransparency, nR, nG, nB, nA); @@ -173,7 +173,7 @@ inline void appendTrapezoid(std::vector<Vertex>& rVertices, std::vector<GLuint>& void appendRectangle(std::vector<Vertex>& rVertices, std::vector<GLuint>& rIndices, GLfloat x1, GLfloat y1, GLfloat x2, GLfloat y2, - SalColor nColor, GLfloat fTransparency) + Color nColor, GLfloat fTransparency) { GLubyte nR, nG, nB, nA; vcl::vertex::createColor(nColor, fTransparency, nR, nG, nB, nA); @@ -195,7 +195,7 @@ void appendRectangle(std::vector<Vertex>& rVertices, std::vector<GLuint>& rIndic } // end anonymous namespace -void RenderList::addDrawPixel(long nX, long nY, SalColor nColor) +void RenderList::addDrawPixel(long nX, long nY, Color nColor) { if (nColor == SALCOLOR_NONE) return; @@ -208,7 +208,7 @@ void RenderList::addDrawPixel(long nX, long nY, SalColor nColor) } void RenderList::addDrawRectangle(long nX, long nY, long nWidth, long nHeight, double fTransparency, - SalColor nLineColor, SalColor nFillColor) + Color nLineColor, Color nFillColor) { if (nLineColor == SALCOLOR_NONE && nFillColor == SALCOLOR_NONE) return; @@ -256,7 +256,7 @@ void RenderList::addDrawRectangle(long nX, long nY, long nWidth, long nHeight, d } } -void RenderList::addDrawLine(long nX1, long nY1, long nX2, long nY2, SalColor nLineColor, bool bUseAA) +void RenderList::addDrawLine(long nX1, long nY1, long nX2, long nY2, Color nLineColor, bool bUseAA) { if (nLineColor == SALCOLOR_NONE) return; @@ -273,7 +273,7 @@ void RenderList::addDrawLine(long nX1, long nY1, long nX2, long nY2, SalColor nL } void RenderList::addDrawPolyPolygon(const basegfx::B2DPolyPolygon& rPolyPolygon, double fTransparency, - SalColor nLineColor, SalColor nFillColor, bool bUseAA) + Color nLineColor, Color nFillColor, bool bUseAA) { if (rPolyPolygon.count() <= 0) return; @@ -314,7 +314,7 @@ void RenderList::addDrawPolyPolygon(const basegfx::B2DPolyPolygon& rPolyPolygon, if (nLineColor != SALCOLOR_NONE || bUseAA) { - SalColor nColor = (nLineColor == SALCOLOR_NONE) ? nFillColor : nLineColor; + Color nColor = (nLineColor == SALCOLOR_NONE) ? nFillColor : nLineColor; vcl::LineBuilder aBuilder(rLineRenderParameter.maVertices, rLineRenderParameter.maIndices, nColor, fTransparency, 1.0f, bUseAA); @@ -348,7 +348,7 @@ void RenderList::addDrawPolyPolygon(const basegfx::B2DPolyPolygon& rPolyPolygon, } } -void RenderList::addDrawTextureWithMaskColor(OpenGLTexture const & rTexture, SalColor nColor, const SalTwoRect& r2Rect) +void RenderList::addDrawTextureWithMaskColor(OpenGLTexture const & rTexture, Color nColor, const SalTwoRect& r2Rect) { if (!rTexture) return; @@ -374,7 +374,7 @@ void RenderList::addDrawTextureWithMaskColor(OpenGLTexture const & rTexture, Sal void RenderList::addDrawPolyLine(const basegfx::B2DPolygon& rPolygon, double fTransparency, const basegfx::B2DVector& rLineWidth, basegfx::B2DLineJoin eLineJoin, css::drawing::LineCap eLineCap, double fMiterMinimumAngle, - SalColor nLineColor, bool bUseAA) + Color nLineColor, bool bUseAA) { if (rPolygon.count() <= 1) return; diff --git a/vcl/opengl/gdiimpl.cxx b/vcl/opengl/gdiimpl.cxx index 7d0be09a1b12..df4996a6ca09 100644 --- a/vcl/opengl/gdiimpl.cxx +++ b/vcl/opengl/gdiimpl.cxx @@ -325,7 +325,7 @@ void OpenGLSalGraphicsImpl::ImplSetClipBit( const vcl::Region& rClip, GLuint nMa glClear( GL_STENCIL_BUFFER_BIT ); CHECK_GL_ERROR(); - if( UseSolid( MAKE_SALCOLOR( 0xFF, 0xFF, 0xFF ) ) ) + if( UseSolid( Color( 0xFF, 0xFF, 0xFF ) ) ) { if( rClip.getRegionBand() ) DrawRegionBand( *rClip.getRegionBand() ); @@ -445,11 +445,11 @@ void OpenGLSalGraphicsImpl::SetLineColor() } // set the line color to a specific color -void OpenGLSalGraphicsImpl::SetLineColor( SalColor nSalColor ) +void OpenGLSalGraphicsImpl::SetLineColor( Color nColor ) { - if( mnLineColor != nSalColor ) + if( mnLineColor != nColor ) { - mnLineColor = nSalColor; + mnLineColor = nColor; } } @@ -464,11 +464,11 @@ void OpenGLSalGraphicsImpl::SetFillColor() // set the fill color to a specific color, shapes will be // filled accordingly -void OpenGLSalGraphicsImpl::SetFillColor( SalColor nSalColor ) +void OpenGLSalGraphicsImpl::SetFillColor( Color nColor ) { - if( mnFillColor != nSalColor ) + if( mnFillColor != nColor ) { - mnFillColor = nSalColor; + mnFillColor = nColor; } } @@ -487,13 +487,13 @@ void OpenGLSalGraphicsImpl::SetROPLineColor(SalROPColor nROPColor) switch (nROPColor) { case SalROPColor::N0: - mnLineColor = MAKE_SALCOLOR(0, 0, 0); + mnLineColor = Color(0, 0, 0); break; case SalROPColor::N1: - mnLineColor = MAKE_SALCOLOR(0xff, 0xff, 0xff); + mnLineColor = Color(0xff, 0xff, 0xff); break; case SalROPColor::Invert: - mnLineColor = MAKE_SALCOLOR(0xff, 0xff, 0xff); + mnLineColor = Color(0xff, 0xff, 0xff); break; } } @@ -503,13 +503,13 @@ void OpenGLSalGraphicsImpl::SetROPFillColor(SalROPColor nROPColor) switch (nROPColor) { case SalROPColor::N0: - mnFillColor = MAKE_SALCOLOR(0, 0, 0); + mnFillColor = Color(0, 0, 0); break; case SalROPColor::N1: - mnFillColor = MAKE_SALCOLOR(0xff, 0xff, 0xff); + mnFillColor = Color(0xff, 0xff, 0xff); break; case SalROPColor::Invert: - mnFillColor = MAKE_SALCOLOR(0xff, 0xff, 0xff); + mnFillColor = Color(0xff, 0xff, 0xff); break; } } @@ -591,7 +591,7 @@ bool OpenGLSalGraphicsImpl::UseProgram( const OUString& rVertexShader, const OUS return ( mpProgram != nullptr ); } -bool OpenGLSalGraphicsImpl::UseSolid( SalColor nColor, sal_uInt8 nTransparency ) +bool OpenGLSalGraphicsImpl::UseSolid( Color nColor, sal_uInt8 nTransparency ) { if( nColor == SALCOLOR_NONE ) return false; @@ -606,7 +606,7 @@ bool OpenGLSalGraphicsImpl::UseSolid( SalColor nColor, sal_uInt8 nTransparency ) return true; } -bool OpenGLSalGraphicsImpl::UseSolid( SalColor nColor, double fTransparency ) +bool OpenGLSalGraphicsImpl::UseSolid( Color nColor, double fTransparency ) { if( nColor == SALCOLOR_NONE ) return false; @@ -632,7 +632,7 @@ bool OpenGLSalGraphicsImpl::UseInvert50() return UseProgram( "dumbVertexShader", "invert50FragmentShader" ); } -bool OpenGLSalGraphicsImpl::UseSolid( SalColor nColor ) +bool OpenGLSalGraphicsImpl::UseSolid( Color nColor ) { return UseSolid( nColor, 0.0f ); } @@ -652,7 +652,7 @@ bool OpenGLSalGraphicsImpl::UseInvert( SalInvert nFlags ) } else { - if( !UseSolid( MAKE_SALCOLOR( 255, 255, 255 ) ) ) + if( !UseSolid( Color( 255, 255, 255 ) ) ) return false; mpProgram->SetBlendMode( GL_ONE_MINUS_DST_COLOR, GL_ZERO ); } @@ -683,7 +683,7 @@ void OpenGLSalGraphicsImpl::DrawLineSegment(float x1, float y1, float x2, float CHECK_GL_ERROR(); } -bool OpenGLSalGraphicsImpl::UseLine(SalColor nColor, double fTransparency, GLfloat fLineWidth, bool bUseAA) +bool OpenGLSalGraphicsImpl::UseLine(Color nColor, double fTransparency, GLfloat fLineWidth, bool bUseAA) { if( nColor == SALCOLOR_NONE ) return false; @@ -738,7 +738,7 @@ void OpenGLSalGraphicsImpl::DrawConvexPolygon( sal_uInt32 nPoints, const SalPoin #ifdef DBG_UTIL assert( mProgramIsSolidColor ); #endif - SalColor lastSolidColor = mProgramSolidColor; + Color lastSolidColor = mProgramSolidColor; double lastSolidTransparency = mProgramSolidTransparency; if (UseLine(lastSolidColor, lastSolidTransparency, 1.0f, true)) { @@ -783,7 +783,7 @@ void OpenGLSalGraphicsImpl::DrawConvexPolygon( const tools::Polygon& rPolygon, b #ifdef DBG_UTIL assert( mProgramIsSolidColor ); #endif - SalColor lastSolidColor = mProgramSolidColor; + Color lastSolidColor = mProgramSolidColor; double lastSolidTransparency = mProgramSolidTransparency; if (UseLine(lastSolidColor, lastSolidTransparency, 1.0f, true)) { @@ -835,7 +835,7 @@ void OpenGLSalGraphicsImpl::DrawTrapezoid( const basegfx::B2DTrapezoid& trapezoi #ifdef DBG_UTIL assert( mProgramIsSolidColor ); #endif - SalColor lastSolidColor = mProgramSolidColor; + Color lastSolidColor = mProgramSolidColor; double lastSolidTransparency = mProgramSolidTransparency; if (UseLine(lastSolidColor, lastSolidTransparency, 1.0f, true)) { @@ -1291,7 +1291,7 @@ void OpenGLSalGraphicsImpl::DrawBlendedTexture( OpenGLTexture& rTexture, OpenGLT mpProgram->Clean(); } -void OpenGLSalGraphicsImpl::DrawMask( OpenGLTexture& rMask, SalColor nMaskColor, const SalTwoRect& rPosAry ) +void OpenGLSalGraphicsImpl::DrawMask( OpenGLTexture& rMask, Color nMaskColor, const SalTwoRect& rPosAry ) { OpenGLZone aZone; @@ -1313,7 +1313,7 @@ void OpenGLSalGraphicsImpl::DrawMask( OpenGLTexture& rMask, SalColor nMaskColor, mpProgram->Clean(); } -void OpenGLSalGraphicsImpl::DeferredTextDraw(OpenGLTexture const & rTexture, SalColor aMaskColor, const SalTwoRect& rPosAry) +void OpenGLSalGraphicsImpl::DeferredTextDraw(OpenGLTexture const & rTexture, Color aMaskColor, const SalTwoRect& rPosAry) { mpRenderList->addDrawTextureWithMaskColor(rTexture, aMaskColor, rPosAry); PostBatchDraw(); @@ -1519,10 +1519,10 @@ void OpenGLSalGraphicsImpl::drawPixel(long nX, long nY) PostBatchDraw(); } -void OpenGLSalGraphicsImpl::drawPixel(long nX, long nY, SalColor nSalColor) +void OpenGLSalGraphicsImpl::drawPixel(long nX, long nY, Color nColor) { VCL_GL_INFO("::drawPixel: (" << nX << ", " << nY << ")"); - mpRenderList->addDrawPixel(nX, nY, nSalColor); + mpRenderList->addDrawPixel(nX, nY, nColor); PostBatchDraw(); } @@ -1711,7 +1711,7 @@ void OpenGLSalGraphicsImpl::drawBitmap( void OpenGLSalGraphicsImpl::drawMask( const SalTwoRect& rPosAry, const SalBitmap& rSalBitmap, - SalColor nMaskColor ) + Color nMaskColor ) { VCL_GL_INFO("::drawMask"); @@ -1741,7 +1741,7 @@ SalBitmap* OpenGLSalGraphicsImpl::getBitmap( long nX, long nY, long nWidth, long return pBitmap; } -SalColor OpenGLSalGraphicsImpl::getPixel( long nX, long nY ) +Color OpenGLSalGraphicsImpl::getPixel( long nX, long nY ) { FlushDeferredDrawing(); @@ -1753,7 +1753,7 @@ SalColor OpenGLSalGraphicsImpl::getPixel( long nX, long nY ) CHECK_GL_ERROR(); PostDraw(); - return MAKE_SALCOLOR( pixel[0], pixel[1], pixel[2] ); + return Color( pixel[0], pixel[1], pixel[2] ); } // invert --> ClipRegion (only Windows or VirDevs) @@ -2007,7 +2007,7 @@ bool OpenGLSalGraphicsImpl::drawGradient(const tools::PolyPolygon& rPolyPoly, Color aColor = rGradient.GetStartColor(); long nIntensity = rGradient.GetStartIntensity(); - if (UseSolid(MAKE_SALCOLOR(aColor.GetRed() * nIntensity / 100.0, + if (UseSolid(Color(aColor.GetRed() * nIntensity / 100.0, aColor.GetGreen()* nIntensity / 100.0, aColor.GetBlue() * nIntensity / 100.0))) { diff --git a/vcl/opengl/program.cxx b/vcl/opengl/program.cxx index ba5c2523344d..09a8a0d98d0b 100644 --- a/vcl/opengl/program.cxx +++ b/vcl/opengl/program.cxx @@ -233,13 +233,13 @@ void OpenGLProgram::SetUniform1i( const OString& rName, GLint v1 ) CHECK_GL_ERROR(); } -void OpenGLProgram::SetColor( const OString& rName, SalColor nColor, sal_uInt8 nTransparency ) +void OpenGLProgram::SetColor( const OString& rName, Color nColor, sal_uInt8 nTransparency ) { GLuint nUniform = GetUniformLocation( rName ); glUniform4f( nUniform, - static_cast<float>(SALCOLOR_RED( nColor )) / 255, - static_cast<float>(SALCOLOR_GREEN( nColor )) / 255, - static_cast<float>(SALCOLOR_BLUE( nColor )) / 255, + nColor.GetRed() / 255.0f, + nColor.GetGreen() / 255.0f, + nColor.GetBlue() / 255.0f, (100 - nTransparency) * (1.0 / 100) ); CHECK_GL_ERROR(); @@ -247,13 +247,13 @@ void OpenGLProgram::SetColor( const OString& rName, SalColor nColor, sal_uInt8 n SetBlendMode( GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA ); } -void OpenGLProgram::SetColorf( const OString& rName, SalColor nColor, double fTransparency ) +void OpenGLProgram::SetColorf( const OString& rName, Color nColor, double fTransparency ) { GLuint nUniform = GetUniformLocation( rName ); glUniform4f( nUniform, - static_cast<float>(SALCOLOR_RED( nColor )) / 255, - static_cast<float>(SALCOLOR_GREEN( nColor )) / 255, - static_cast<float>(SALCOLOR_BLUE( nColor )) / 255, + nColor.GetRed() / 255.0f, + nColor.GetGreen() / 255.0f, + nColor.GetBlue() / 255.0f, (1.0f - fTransparency) ); CHECK_GL_ERROR(); diff --git a/vcl/osx/a11ytextattributeswrapper.mm b/vcl/osx/a11ytextattributeswrapper.mm index 1af27ad4f247..f57aaac2680a 100644 --- a/vcl/osx/a11ytextattributeswrapper.mm +++ b/vcl/osx/a11ytextattributeswrapper.mm @@ -167,10 +167,10 @@ using namespace ::com::sun::star::uno; return [ NSNumber numberWithShort: value ]; } -+(void)addColor:(SalColor)nSalColor forAttribute:(NSString *)attribute andRange:(NSRange)range toString:(NSMutableAttributedString *)string { - if( nSalColor == sal_uInt32(COL_TRANSPARENT) ) ++(void)addColor:(Color)nColor forAttribute:(NSString *)attribute andRange:(NSRange)range toString:(NSMutableAttributedString *)string { + if( nColor == COL_TRANSPARENT ) return; - const RGBAColor aRGBAColor( nSalColor); + const RGBAColor aRGBAColor( nColor); CGColorRef aColorRef = CGColorCreate ( CGColorSpaceCreateWithName ( kCGColorSpaceGenericRGB ), aRGBAColor.AsArray() ); [ string addAttribute: attribute value: reinterpret_cast<id>(aColorRef) range: range ]; CGColorRelease( aColorRef ); diff --git a/vcl/osx/salinst.cxx b/vcl/osx/salinst.cxx index 891281614cb1..62a724a8bfae 100644 --- a/vcl/osx/salinst.cxx +++ b/vcl/osx/salinst.cxx @@ -1032,7 +1032,7 @@ CGImageRef CreateCGImage( const Image& rImage ) else if( aBmpEx.GetTransparentType() == TransparentType::Color ) { Color aTransColor( aBmpEx.GetTransparentColor() ); - SalColor nTransColor = MAKE_SALCOLOR( aTransColor.GetRed(), aTransColor.GetGreen(), aTransColor.GetBlue() ); + Color nTransColor( aTransColor.GetRed(), aTransColor.GetGreen(), aTransColor.GetBlue() ); xImage = pSalBmp->CreateColorMask( 0, 0, pSalBmp->mnWidth, pSalBmp->mnHeight, nTransColor ); } diff --git a/vcl/qt5/Qt5Graphics.cxx b/vcl/qt5/Qt5Graphics.cxx index 23249c5799c6..6ec6c341913a 100644 --- a/vcl/qt5/Qt5Graphics.cxx +++ b/vcl/qt5/Qt5Graphics.cxx @@ -33,13 +33,13 @@ Qt5Graphics::Qt5Graphics( Qt5Frame *pFrame, QImage *pQImage ) : m_pFrame( pFrame ) , m_pQImage( pQImage ) - , m_aLineColor( MAKE_SALCOLOR(0x00, 0x00, 0x00) ) - , m_aFillColor( MAKE_SALCOLOR(0xFF, 0xFF, 0XFF) ) + , m_aLineColor( 0x00, 0x00, 0x00 ) + , m_aFillColor( 0xFF, 0xFF, 0XFF ) , m_eCompositionMode( QPainter::CompositionMode_SourceOver ) , m_pFontCollection( nullptr ) , m_pFontData{ nullptr, } , m_pTextStyle{ nullptr, } - , m_aTextColor( MAKE_SALCOLOR(0x00, 0x00, 0x00) ) + , m_aTextColor( 0x00, 0x00, 0x00 ) { ResetClipRegion(); } diff --git a/vcl/qt5/Qt5Graphics.hxx b/vcl/qt5/Qt5Graphics.hxx index a9a71c64b5e2..0ece5ec5f036 100644 --- a/vcl/qt5/Qt5Graphics.hxx +++ b/vcl/qt5/Qt5Graphics.hxx @@ -43,14 +43,14 @@ class Qt5Graphics : public SalGraphics QImage* m_pQImage; QRegion m_aClipRegion; QPainterPath m_aClipPath; - SalColor m_aLineColor; - SalColor m_aFillColor; + Color m_aLineColor; + Color m_aFillColor; QPainter::CompositionMode m_eCompositionMode; PhysicalFontCollection* m_pFontCollection; const Qt5FontFace* m_pFontData[MAX_FALLBACK]; std::unique_ptr<Qt5Font> m_pTextStyle[MAX_FALLBACK]; - SalColor m_aTextColor; + Color m_aTextColor; Qt5Graphics(Qt5Frame* pFrame, QImage* pQImage); @@ -91,7 +91,7 @@ public: virtual void ResetClipRegion() override; 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; virtual void drawRect(long nX, long nY, long nWidth, long nHeight) override; virtual void drawPolyLine(sal_uInt32 nPoints, const SalPoint* pPtAry) override; @@ -119,10 +119,10 @@ public: virtual void drawBitmap(const SalTwoRect& rPosAry, const SalBitmap& rSalBitmap, const SalBitmap& rTransparentBitmap) override; 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; virtual void invert(long nX, long nY, long nWidth, long nHeight, SalInvert nFlags) override; virtual void invert(sal_uInt32 nPoints, const SalPoint* pPtAry, SalInvert nFlags) override; @@ -151,16 +151,16 @@ public: virtual long GetGraphicsWidth() const override; virtual void SetLineColor() override; - virtual void SetLineColor(SalColor nSalColor) override; + virtual void SetLineColor(Color nColor) override; virtual void SetFillColor() override; - virtual void SetFillColor(SalColor nSalColor) override; + virtual void SetFillColor(Color nColor) override; virtual void SetXORMode(bool bSet) override; virtual void SetROPLineColor(SalROPColor nROPColor) override; virtual void SetROPFillColor(SalROPColor nROPColor) override; // Text rendering + font support - virtual void SetTextColor(SalColor nSalColor) override; + virtual void SetTextColor(Color nColor) override; virtual void SetFont(const FontSelectPattern*, int nFallbackLevel) override; virtual void GetFontMetric(ImplFontMetricDataRef&, int nFallbackLevel) override; virtual const FontCharMapRef GetFontCharMap() const override; diff --git a/vcl/qt5/Qt5Graphics_GDI.cxx b/vcl/qt5/Qt5Graphics_GDI.cxx index fe1b98112b33..7bed0a43aed6 100644 --- a/vcl/qt5/Qt5Graphics_GDI.cxx +++ b/vcl/qt5/Qt5Graphics_GDI.cxx @@ -169,10 +169,10 @@ void Qt5Graphics::drawPixel(long nX, long nY) aPainter.update(nX, nY, 1, 1); } -void Qt5Graphics::drawPixel(long nX, long nY, SalColor nSalColor) +void Qt5Graphics::drawPixel(long nX, long nY, Color nColor) { Qt5Painter aPainter(*this); - aPainter.setPen(QColor(QRgb(nSalColor))); + aPainter.setPen(QColor(QRgb(nColor))); aPainter.setPen(Qt::SolidLine); aPainter.drawPoint(nX, nY); aPainter.update(nX, nY, 1, 1); @@ -425,7 +425,7 @@ void Qt5Graphics::drawBitmap(const SalTwoRect& rPosAry, const SalBitmap& /*rSalB } void Qt5Graphics::drawMask(const SalTwoRect& rPosAry, const SalBitmap& /*rSalBitmap*/, - SalColor /*nMaskColor*/) + Color /*nMaskColor*/) { if (rPosAry.mnSrcWidth <= 0 || rPosAry.mnSrcHeight <= 0 || rPosAry.mnDestWidth <= 0 || rPosAry.mnDestHeight <= 0) @@ -440,7 +440,7 @@ SalBitmap* Qt5Graphics::getBitmap(long nX, long nY, long nWidth, long nHeight) return new Qt5Bitmap(m_pQImage->copy(nX, nY, nWidth, nHeight)); } -SalColor Qt5Graphics::getPixel(long nX, long nY) { return m_pQImage->pixel(nX, nY); } +Color Qt5Graphics::getPixel(long nX, long nY) { return m_pQImage->pixel(nX, nY); } void Qt5Graphics::invert(long /*nX*/, long /*nY*/, long /*nWidth*/, long /*nHeight*/, SalInvert /*nFlags*/) @@ -586,11 +586,11 @@ long Qt5Graphics::GetGraphicsWidth() const { return m_pQImage->width(); } void Qt5Graphics::SetLineColor() { m_aLineColor = SALCOLOR_NONE; } -void Qt5Graphics::SetLineColor(SalColor nSalColor) { m_aLineColor = nSalColor; } +void Qt5Graphics::SetLineColor(Color nColor) { m_aLineColor = nColor; } void Qt5Graphics::SetFillColor() { m_aFillColor = SALCOLOR_NONE; } -void Qt5Graphics::SetFillColor(SalColor nSalColor) { m_aFillColor = nSalColor; } +void Qt5Graphics::SetFillColor(Color nColor) { m_aFillColor = nColor; } void Qt5Graphics::SetXORMode(bool bSet) { diff --git a/vcl/qt5/Qt5Graphics_Text.cxx b/vcl/qt5/Qt5Graphics_Text.cxx index 8d25e97df786..2dbeaecfdf2c 100644 --- a/vcl/qt5/Qt5Graphics_Text.cxx +++ b/vcl/qt5/Qt5Graphics_Text.cxx @@ -30,7 +30,7 @@ #include <QtGui/QRawFont> #include <QtCore/QStringList> -void Qt5Graphics::SetTextColor(SalColor nSalColor) { m_aTextColor = nSalColor; } +void Qt5Graphics::SetTextColor(Color nColor) { m_aTextColor = nColor; } void Qt5Graphics::SetFont(const FontSelectPattern* pReqFont, int nFallbackLevel) { diff --git a/vcl/quartz/salbmp.cxx b/vcl/quartz/salbmp.cxx index aba40b44d8e0..5333eca2b961 100644 --- a/vcl/quartz/salbmp.cxx +++ b/vcl/quartz/salbmp.cxx @@ -907,7 +907,7 @@ CGImageRef QuartzSalBitmap::CreateWithMask( const QuartzSalBitmap& rMask, /** creates an image from the given rectangle, replacing all black pixels with nMaskColor and make all other full transparent */ CGImageRef QuartzSalBitmap::CreateColorMask( int nX, int nY, int nWidth, - int nHeight, SalColor nMaskColor ) const + int nHeight, Color nMaskColor ) const { CGImageRef xMask = nullptr; if (m_pUserBuffer.get() && (nX + nWidth <= mnWidth) && (nY + nHeight <= mnHeight)) @@ -922,9 +922,9 @@ CGImageRef QuartzSalBitmap::CreateColorMask( int nX, int nY, int nWidth, { sal_uInt32 nColor; reinterpret_cast<sal_uInt8*>(&nColor)[0] = 0xff; - reinterpret_cast<sal_uInt8*>(&nColor)[1] = SALCOLOR_RED( nMaskColor ); - reinterpret_cast<sal_uInt8*>(&nColor)[2] = SALCOLOR_GREEN( nMaskColor ); - reinterpret_cast<sal_uInt8*>(&nColor)[3] = SALCOLOR_BLUE( nMaskColor ); + reinterpret_cast<sal_uInt8*>(&nColor)[1] = nMaskColor.GetRed(); + reinterpret_cast<sal_uInt8*>(&nColor)[2] = nMaskColor.GetGreen(); + reinterpret_cast<sal_uInt8*>(&nColor)[3] = nMaskColor.GetBlue(); sal_uInt8* pSource = m_pUserBuffer.get(); if( nY ) diff --git a/vcl/quartz/salgdi.cxx b/vcl/quartz/salgdi.cxx index a6c9a528bff7..7ee45db62aef 100644 --- a/vcl/quartz/salgdi.cxx +++ b/vcl/quartz/salgdi.cxx @@ -272,10 +272,10 @@ SalGraphicsImpl* AquaSalGraphics::GetImpl() const return nullptr; } -void AquaSalGraphics::SetTextColor( SalColor nSalColor ) +void AquaSalGraphics::SetTextColor( Color nColor ) { - maTextColor = RGBAColor( nSalColor ); - // SAL_ DEBUG(std::hex << nSalColor << std::dec << "={" << maTextColor.GetRed() << ", " << maTextColor.GetGreen() << ", " << maTextColor.GetBlue() << ", " << maTextColor.GetAlpha() << "}"); + maTextColor = RGBAColor( nColor ); + // SAL_ DEBUG(std::hex << nColor << std::dec << "={" << maTextColor.GetRed() << ", " << maTextColor.GetGreen() << ", " << maTextColor.GetBlue() << ", " << maTextColor.GetAlpha() << "}"); } void AquaSalGraphics::GetFontMetric(ImplFontMetricDataRef& rxFontMetric, int nFallbackLevel) diff --git a/vcl/quartz/salgdicommon.cxx b/vcl/quartz/salgdicommon.cxx index 76644b4f0a11..11643e4f16cd 100644 --- a/vcl/quartz/salgdicommon.cxx +++ b/vcl/quartz/salgdicommon.cxx @@ -481,18 +481,18 @@ static void getBoundRect( sal_uInt32 nPoints, const SalPoint *pPtAry, rHeight = nY2 - nY1 + 1; } -static SalColor ImplGetROPSalColor( SalROPColor nROPColor ) +static Color ImplGetROPColor( SalROPColor nROPColor ) { - SalColor nSalColor; + Color nColor; if ( nROPColor == SalROPColor::N0 ) { - nSalColor = MAKE_SALCOLOR( 0, 0, 0 ); + nColor = Color( 0, 0, 0 ); } else { - nSalColor = MAKE_SALCOLOR( 255, 255, 255 ); + nColor = Color( 255, 255, 255 ); } - return nSalColor; + return nColor; } // apply the XOR mask to the target context if active and dirty @@ -901,7 +901,7 @@ void AquaSalGraphics::drawLine( long nX1, long nY1, long nX2, long nY2 ) DBG_DRAW_OPERATION_EXIT("drawLine"); } -void AquaSalGraphics::drawMask( const SalTwoRect& rPosAry, const SalBitmap& rSalBitmap, SalColor nMaskColor ) +void AquaSalGraphics::drawMask( const SalTwoRect& rPosAry, const SalBitmap& rSalBitmap, Color nMaskColor ) { DBG_DRAW_OPERATION("drawMask",); @@ -937,9 +937,9 @@ void AquaSalGraphics::drawPixel( long nX, long nY ) ImplDrawPixel( nX, nY, maLineColor ); } -void AquaSalGraphics::drawPixel( long nX, long nY, SalColor nSalColor ) +void AquaSalGraphics::drawPixel( long nX, long nY, Color nColor ) { - const RGBAColor aPixelColor( nSalColor ); + const RGBAColor aPixelColor( nColor ); ImplDrawPixel( nX, nY, aPixelColor ); } @@ -1487,7 +1487,7 @@ long AquaSalGraphics::GetGraphicsWidth() const return w; } -SalColor AquaSalGraphics::getPixel( long nX, long nY ) +Color AquaSalGraphics::getPixel( long nX, long nY ) { // return default value on printers or when out of bounds if( !mxLayer || (nX < 0) || (nX >= mnWidth) || @@ -1527,8 +1527,8 @@ SalColor AquaSalGraphics::getPixel( long nX, long nY ) SAL_INFO( "vcl.cg", "CGContextRelease(" << xOnePixelContext << ")" ); CGContextRelease( xOnePixelContext ); - SalColor nSalColor = MAKE_SALCOLOR( aPixel.r, aPixel.g, aPixel.b ); - return nSalColor; + Color nColor( aPixel.r, aPixel.g, aPixel.b ); + return nColor; } void AquaSalGraphics::GetResolution( sal_Int32& rDPIX, sal_Int32& rDPIY ) @@ -1838,9 +1838,9 @@ void AquaSalGraphics::SetLineColor() } } -void AquaSalGraphics::SetLineColor( SalColor nSalColor ) +void AquaSalGraphics::SetLineColor( Color nColor ) { - maLineColor = RGBAColor( nSalColor ); + maLineColor = RGBAColor( nColor ); if( CheckContext() ) { SAL_INFO( "vcl.cg", "CGContextSetRGBStrokeColor(" << mrContext << "," << maLineColor << ")" ); @@ -1860,9 +1860,9 @@ void AquaSalGraphics::SetFillColor() } } -void AquaSalGraphics::SetFillColor( SalColor nSalColor ) +void AquaSalGraphics::SetFillColor( Color nColor ) { - maFillColor = RGBAColor( nSalColor ); + maFillColor = RGBAColor( nColor ); if( CheckContext() ) { SAL_INFO( "vcl.cg", "CGContextSetRGBFillColor(" << mrContext << "," << maFillColor << ")" ); @@ -1940,7 +1940,7 @@ void AquaSalGraphics::SetROPFillColor( SalROPColor nROPColor ) { if( ! mbPrinter ) { - SetFillColor( ImplGetROPSalColor( nROPColor ) ); + SetFillColor( ImplGetROPColor( nROPColor ) ); } } @@ -1948,7 +1948,7 @@ void AquaSalGraphics::SetROPLineColor( SalROPColor nROPColor ) { if( ! mbPrinter ) { - SetLineColor( ImplGetROPSalColor( nROPColor ) ); + SetLineColor( ImplGetROPColor( nROPColor ) ); } } diff --git a/vcl/source/gdi/salgdilayout.cxx b/vcl/source/gdi/salgdilayout.cxx index 48fb33ed5a6c..49cc105d5d54 100644 --- a/vcl/source/gdi/salgdilayout.cxx +++ b/vcl/source/gdi/salgdilayout.cxx @@ -373,11 +373,11 @@ void SalGraphics::DrawPixel( long nX, long nY, const OutputDevice *pOutDev ) drawPixel( nX, nY ); } -void SalGraphics::DrawPixel( long nX, long nY, SalColor nSalColor, const OutputDevice *pOutDev ) +void SalGraphics::DrawPixel( long nX, long nY, Color nColor, const OutputDevice *pOutDev ) { if( (m_nLayout & SalLayoutFlags::BiDiRtl) || (pOutDev && pOutDev->IsRTLEnabled()) ) mirror( nX, pOutDev ); - drawPixel( nX, nY, nSalColor ); + drawPixel( nX, nY, nColor ); } void SalGraphics::DrawLine( long nX1, long nY1, long nX2, long nY2, const OutputDevice *pOutDev ) @@ -594,7 +594,7 @@ void SalGraphics::DrawBitmap( const SalTwoRect& rPosAry, void SalGraphics::DrawMask( const SalTwoRect& rPosAry, const SalBitmap& rSalBitmap, - SalColor nMaskColor, const OutputDevice *pOutDev ) + Color nMaskColor, const OutputDevice *pOutDev ) { if( (m_nLayout & SalLayoutFlags::BiDiRtl) || (pOutDev && pOutDev->IsRTLEnabled()) ) { @@ -613,7 +613,7 @@ SalBitmap* SalGraphics::GetBitmap( long nX, long nY, long nWidth, long nHeight, return getBitmap( nX, nY, nWidth, nHeight ); } -SalColor SalGraphics::GetPixel( long nX, long nY, const OutputDevice *pOutDev ) +Color SalGraphics::GetPixel( long nX, long nY, const OutputDevice *pOutDev ) { if( (m_nLayout & SalLayoutFlags::BiDiRtl) || (pOutDev && pOutDev->IsRTLEnabled()) ) mirror( nX, pOutDev ); diff --git a/vcl/source/outdev/gradient.cxx b/vcl/source/outdev/gradient.cxx index ca02fba67e96..71c6eb8b9b19 100644 --- a/vcl/source/outdev/gradient.cxx +++ b/vcl/source/outdev/gradient.cxx @@ -332,7 +332,7 @@ void OutputDevice::DrawLinearGradient( const tools::Rectangle& rRect, nGreen = static_cast<sal_uInt8>(nStartGreen); nBlue = static_cast<sal_uInt8>(nStartBlue); - mpGraphics->SetFillColor( MAKE_SALCOLOR( nRed, nGreen, nBlue ) ); + mpGraphics->SetFillColor( Color( nRed, nGreen, nBlue ) ); aBorderRect.SetBottom( static_cast<long>( aBorderRect.Top() + fBorder ) ); aRect.SetTop( aBorderRect.Bottom() ); @@ -394,7 +394,7 @@ void OutputDevice::DrawLinearGradient( const tools::Rectangle& rRect, fTempColor = static_cast<double>(nStartBlue) * (1.0-fAlpha) + static_cast<double>(nEndBlue) * fAlpha; nBlue = GetGradientColorValue(static_cast<long>(fTempColor)); - mpGraphics->SetFillColor( MAKE_SALCOLOR( nRed, nGreen, nBlue ) ); + mpGraphics->SetFillColor( Color( nRed, nGreen, nBlue ) ); // Polygon for this color step aRect.SetTop( static_cast<long>( fGradientLine + static_cast<double>(i) * fScanInc ) ); @@ -428,7 +428,7 @@ void OutputDevice::DrawLinearGradient( const tools::Rectangle& rRect, nGreen = GetGradientColorValue(nEndGreen); nBlue = GetGradientColorValue(nEndBlue); - mpGraphics->SetFillColor( MAKE_SALCOLOR( nRed, nGreen, nBlue ) ); + mpGraphics->SetFillColor( Color( nRed, nGreen, nBlue ) ); aRect.SetTop( static_cast<long>( fGradientLine + static_cast<double>(nSteps) * fScanInc ) ); aRect.SetBottom( static_cast<long>( fMirrorGradientLine - static_cast<double>(nSteps) * fScanInc ) ); @@ -517,7 +517,7 @@ void OutputDevice::DrawComplexGradient( const tools::Rectangle& rRect, sal_uInt8 nRed = static_cast<sal_uInt8>(nStartRed), nGreen = static_cast<sal_uInt8>(nStartGreen), nBlue = static_cast<sal_uInt8>(nStartBlue); bool bPaintLastPolygon( false ); // #107349# Paint last polygon only if loop has generated any output - mpGraphics->SetFillColor( MAKE_SALCOLOR( nRed, nGreen, nBlue ) ); + mpGraphics->SetFillColor( Color( nRed, nGreen, nBlue ) ); if( xPolyPoly ) { @@ -579,12 +579,12 @@ void OutputDevice::DrawComplexGradient( const tools::Rectangle& rRect, // full aPoly. Thus, here, we're painting the band before // the one painted in the window outdev path below. To get // matching colors, have to delay color setting here. - mpGraphics->SetFillColor( MAKE_SALCOLOR( nRed, nGreen, nBlue ) ); + mpGraphics->SetFillColor( Color( nRed, nGreen, nBlue ) ); } else { // #107349# Set fill color _before_ geometry painting - mpGraphics->SetFillColor( MAKE_SALCOLOR( nRed, nGreen, nBlue ) ); + mpGraphics->SetFillColor( Color( nRed, nGreen, nBlue ) ); ImplDrawPolygon( aPoly, pClixPolyPoly ); } @@ -607,7 +607,7 @@ void OutputDevice::DrawComplexGradient( const tools::Rectangle& rRect, nBlue = GetGradientColorValue( nEndBlue ); } - mpGraphics->SetFillColor( MAKE_SALCOLOR( nRed, nGreen, nBlue ) ); + mpGraphics->SetFillColor( Color( nRed, nGreen, nBlue ) ); ImplDrawPolygon( rPoly, pClixPolyPoly ); } } diff --git a/vcl/source/outdev/mask.cxx b/vcl/source/outdev/mask.cxx index 6c52a544d394..6a5e619ede8e 100644 --- a/vcl/source/outdev/mask.cxx +++ b/vcl/source/outdev/mask.cxx @@ -128,11 +128,11 @@ void OutputDevice::DrawDeviceMask( const Bitmap& rMask, const Color& rMaskColor, Bitmap aTmp( rMask ); aTmp.Mirror( nMirrFlags ); mpGraphics->DrawMask( aPosAry, *aTmp.ImplGetImpBitmap()->ImplGetSalBitmap(), - ImplColorToSal( rMaskColor ) , this); + rMaskColor, this); } else mpGraphics->DrawMask( aPosAry, *xImpBmp->ImplGetSalBitmap(), - ImplColorToSal( rMaskColor ), this ); + rMaskColor, this ); } } diff --git a/vcl/source/outdev/outdevstate.cxx b/vcl/source/outdev/outdevstate.cxx index fa4ee99a82a4..38698b210330 100644 --- a/vcl/source/outdev/outdevstate.cxx +++ b/vcl/source/outdev/outdevstate.cxx @@ -586,7 +586,7 @@ void OutputDevice::InitLineColor() else if( RasterOp::Invert == meRasterOp ) mpGraphics->SetROPLineColor( SalROPColor::Invert ); else - mpGraphics->SetLineColor( ImplColorToSal( maLineColor ) ); + mpGraphics->SetLineColor( maLineColor ); } else mpGraphics->SetLineColor(); @@ -608,7 +608,7 @@ void OutputDevice::InitFillColor() else if( RasterOp::Invert == meRasterOp ) mpGraphics->SetROPFillColor( SalROPColor::Invert ); else - mpGraphics->SetFillColor( ImplColorToSal( maFillColor ) ); + mpGraphics->SetFillColor( maFillColor ); } else mpGraphics->SetFillColor(); diff --git a/vcl/source/outdev/pixel.cxx b/vcl/source/outdev/pixel.cxx index afa4673cce33..04f35b41e777 100644 --- a/vcl/source/outdev/pixel.cxx +++ b/vcl/source/outdev/pixel.cxx @@ -33,7 +33,6 @@ Color OutputDevice::GetPixel( const Point& rPt ) const { - Color aColor; if ( mpGraphics || AcquireGraphics() ) @@ -45,10 +44,7 @@ Color OutputDevice::GetPixel( const Point& rPt ) const { const long nX = ImplLogicXToDevicePixel( rPt.X() ); const long nY = ImplLogicYToDevicePixel( rPt.Y() ); - const SalColor aSalCol = mpGraphics->GetPixel( nX, nY, this ); - aColor.SetRed( SALCOLOR_RED( aSalCol ) ); - aColor.SetGreen( SALCOLOR_GREEN( aSalCol ) ); - aColor.SetBlue( SALCOLOR_BLUE( aSalCol ) ); + aColor = mpGraphics->GetPixel( nX, nY, this ); } } return aColor; @@ -107,7 +103,7 @@ void OutputDevice::DrawPixel( const Point& rPt, const Color& rColor ) if ( mbOutputClipped ) return; - mpGraphics->DrawPixel( aPt.X(), aPt.Y(), ImplColorToSal( aColor ), this ); + mpGraphics->DrawPixel( aPt.X(), aPt.Y(), aColor, this ); if( mpAlphaVDev ) mpAlphaVDev->DrawPixel( rPt ); @@ -150,7 +146,7 @@ void OutputDevice::DrawPixel( const tools::Polygon& rPts, const Color* pColors ) for ( sal_uInt16 i = 0; i < nSize; i++ ) { const Point aPt( ImplLogicToDevicePixel( rPts[ i ] ) ); - mpGraphics->DrawPixel( aPt.X(), aPt.Y(), ImplColorToSal( pColors[ i ] ), this ); + mpGraphics->DrawPixel( aPt.X(), aPt.Y(), pColors[ i ], this ); } } } diff --git a/vcl/source/outdev/text.cxx b/vcl/source/outdev/text.cxx index 204feccc9da6..a3547b1bb491 100644 --- a/vcl/source/outdev/text.cxx +++ b/vcl/source/outdev/text.cxx @@ -69,7 +69,7 @@ void OutputDevice::ImplInitTextColor() if ( mbInitTextColor ) { - mpGraphics->SetTextColor( ImplColorToSal( GetTextColor() ) ); + mpGraphics->SetTextColor( GetTextColor() ); mbInitTextColor = false; } } @@ -145,7 +145,7 @@ void OutputDevice::ImplDrawTextBackground( const SalLayout& rSalLayout ) mpGraphics->SetLineColor(); mbInitLineColor = true; } - mpGraphics->SetFillColor( ImplColorToSal( GetTextFillColor() ) ); + mpGraphics->SetFillColor( GetTextFillColor() ); mbInitFillColor = true; ImplDrawTextRect( nX, nY, 0, -(mpFontInstance->mxFontMetric->GetAscent() + mnEmphasisAscent), diff --git a/vcl/source/outdev/textline.cxx b/vcl/source/outdev/textline.cxx index a15b788f8b01..bff62fe6e660 100644 --- a/vcl/source/outdev/textline.cxx +++ b/vcl/source/outdev/textline.cxx @@ -100,7 +100,7 @@ void OutputDevice::ImplDrawWaveLine( long nBaseX, long nBaseY, // If the height is 1 pixel, it's enough output a line if ( (nLineWidth == 1) && (nHeight == 1) ) { - mpGraphics->SetLineColor( ImplColorToSal( rColor ) ); + mpGraphics->SetLineColor( rColor ); mbInitLineColor = true; long nEndX = nStartX+nWidth; @@ -132,7 +132,7 @@ void OutputDevice::ImplDrawWaveLine( long nBaseX, long nBaseY, mpGraphics->SetLineColor(); mbInitLineColor = true; } - mpGraphics->SetFillColor( ImplColorToSal( rColor ) ); + mpGraphics->SetFillColor( rColor ); mbInitFillColor = true; bDrawPixAsRect = true; nPixWidth = nLineWidth; @@ -140,7 +140,7 @@ void OutputDevice::ImplDrawWaveLine( long nBaseX, long nBaseY, } else { - mpGraphics->SetLineColor( ImplColorToSal( rColor ) ); + mpGraphics->SetLineColor( rColor ); mbInitLineColor = true; nPixWidth = 1; nPixHeight = 1; @@ -350,7 +350,7 @@ void OutputDevice::ImplDrawStraightTextLine( long nBaseX, long nBaseY, mpGraphics->SetLineColor(); mbInitLineColor = true; } - mpGraphics->SetFillColor( ImplColorToSal( aColor ) ); + mpGraphics->SetFillColor( aColor ); mbInitFillColor = true; long nLeft = nDistX; @@ -557,7 +557,7 @@ void OutputDevice::ImplDrawStrikeoutLine( long nBaseX, long nBaseY, mpGraphics->SetLineColor(); mbInitLineColor = true; } - mpGraphics->SetFillColor( ImplColorToSal( aColor ) ); + mpGraphics->SetFillColor( aColor ); mbInitFillColor = true; const long& nLeft = nDistX; 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); } diff --git a/vcl/win/gdi/gdiimpl.cxx b/vcl/win/gdi/gdiimpl.cxx index e3dfddf10302..f18fbcf40779 100644 --- a/vcl/win/gdi/gdiimpl.cxx +++ b/vcl/win/gdi/gdiimpl.cxx @@ -215,14 +215,14 @@ static BYTE aOrdDither16Bit[8][8] = { 5, 3, 4, 2, 5, 3, 4, 2 } }; -SalColor ImplGetROPSalColor( SalROPColor nROPColor ) +Color ImplGetROPColor( SalROPColor nROPColor ) { - SalColor nSalColor; + Color nColor; if ( nROPColor == SalROPColor::N0 ) - nSalColor = MAKE_SALCOLOR( 0, 0, 0 ); + nColor = Color( 0, 0, 0 ); else - nSalColor = MAKE_SALCOLOR( 255, 255, 255 ); - return nSalColor; + nColor = Color( 255, 255, 255 ); + return nColor; } int ImplIsPaletteEntry( BYTE nRed, BYTE nGreen, BYTE nBlue ) @@ -624,11 +624,10 @@ void ImplDrawBitmap( HDC hDC, const SalTwoRect& rPosAry, const WinSalBitmap& rSa const BitmapPalette& rPalette = pBitmapBuffer->maPalette; if (rPalette.GetEntryCount() == 2) { - SalColor nCol; - nCol = ImplColorToSal(rPalette[0].GetColor()); - nTextColor = RGB( SALCOLOR_RED(nCol), SALCOLOR_GREEN(nCol), SALCOLOR_BLUE(nCol) ); - nCol = ImplColorToSal(rPalette[1].GetColor()); - nBkColor = RGB( SALCOLOR_RED(nCol), SALCOLOR_GREEN(nCol), SALCOLOR_BLUE(nCol) ); + Color nCol = rPalette[0].GetColor(); + nTextColor = RGB( nCol.GetRed(), nCol.GetGreen(), nCol.GetBlue() ); + nCol = rPalette[1].GetColor(); + nBkColor = RGB( nCol.GetRed(), nCol.GetGreen(), nCol.GetBlue() ); } const_cast<WinSalBitmap&>(rSalBitmap).ReleaseBuffer(pBitmapBuffer, BitmapAccessMode::Info); } @@ -820,7 +819,7 @@ bool WinSalGraphicsImpl::drawAlphaRect( long nX, long nY, long nWidth, void WinSalGraphicsImpl::drawMask( const SalTwoRect& rPosAry, const SalBitmap& rSSalBitmap, - SalColor nMaskColor ) + Color nMaskColor ) { SAL_WARN_IF( mrParent.isPrinter(), "vcl", "No transparency print possible!" ); @@ -829,9 +828,9 @@ void WinSalGraphicsImpl::drawMask( const SalTwoRect& rPosAry, const WinSalBitmap& rSalBitmap = static_cast<const WinSalBitmap&>(rSSalBitmap); SalTwoRect aPosAry = rPosAry; - const BYTE cRed = SALCOLOR_RED( nMaskColor ); - const BYTE cGreen = SALCOLOR_GREEN( nMaskColor ); - const BYTE cBlue = SALCOLOR_BLUE( nMaskColor ); + const BYTE cRed = nMaskColor.GetRed(); + const BYTE cGreen = nMaskColor.GetGreen(); + const BYTE cBlue = nMaskColor.GetBlue(); HDC hDC = mrParent.getHDC(); HBRUSH hMaskBrush = CreateSolidBrush( RGB( cRed, cGreen, cBlue ) ); HBRUSH hOldBrush = SelectBrush( hDC, hMaskBrush ); @@ -888,14 +887,14 @@ SalBitmap* WinSalGraphicsImpl::getBitmap( long nX, long nY, long nDX, long nDY ) return pSalBitmap; } -SalColor WinSalGraphicsImpl::getPixel( long nX, long nY ) +Color WinSalGraphicsImpl::getPixel( long nX, long nY ) { COLORREF aWinCol = ::GetPixel( mrParent.getHDC(), static_cast<int>(nX), static_cast<int>(nY) ); if ( CLR_INVALID == aWinCol ) - return MAKE_SALCOLOR( 0, 0, 0 ); + return Color( 0, 0, 0 ); else - return MAKE_SALCOLOR( GetRValue( aWinCol ), + return Color( GetRValue( aWinCol ), GetGValue( aWinCol ), GetBValue( aWinCol ) ); } @@ -1366,12 +1365,12 @@ void WinSalGraphicsImpl::SetLineColor() mbStockPen = TRUE; } -void WinSalGraphicsImpl::SetLineColor( SalColor nSalColor ) +void WinSalGraphicsImpl::SetLineColor( Color nColor ) { - maLineColor = nSalColor; - COLORREF nPenColor = PALETTERGB( SALCOLOR_RED( nSalColor ), - SALCOLOR_GREEN( nSalColor ), - SALCOLOR_BLUE( nSalColor ) ); + maLineColor = nColor; + COLORREF nPenColor = PALETTERGB( nColor.GetRed(), + nColor.GetGreen(), + nColor.GetBlue() ); HPEN hNewPen = nullptr; bool bStockPen = FALSE; @@ -1396,7 +1395,7 @@ void WinSalGraphicsImpl::SetLineColor( SalColor nSalColor ) { if ( !mrParent.isPrinter() ) { - if ( GetSalData()->mhDitherPal && ImplIsSysColorEntry( nSalColor ) ) + if ( GetSalData()->mhDitherPal && ImplIsSysColorEntry( nColor ) ) nPenColor = PALRGB_TO_RGB( nPenColor ); } @@ -1444,13 +1443,13 @@ void WinSalGraphicsImpl::SetFillColor() mbStockBrush = TRUE; } -void WinSalGraphicsImpl::SetFillColor( SalColor nSalColor ) +void WinSalGraphicsImpl::SetFillColor( Color nColor ) { - maFillColor = nSalColor; + maFillColor = nColor; SalData* pSalData = GetSalData(); - BYTE nRed = SALCOLOR_RED( nSalColor ); - BYTE nGreen = SALCOLOR_GREEN( nSalColor ); - BYTE nBlue = SALCOLOR_BLUE( nSalColor ); + BYTE nRed = nColor.GetRed(); + BYTE nGreen = nColor.GetGreen(); + BYTE nBlue = nColor.GetBlue(); COLORREF nBrushColor = PALETTERGB( nRed, nGreen, nBlue ); HBRUSH hNewBrush = nullptr; bool bStockBrush = FALSE; @@ -1497,7 +1496,7 @@ void WinSalGraphicsImpl::SetFillColor( SalColor nSalColor ) hNewBrush = CreateDIBPatternBrush( pSalData->mhDitherDIB, DIB_RGB_COLORS ); } - else if ( ImplIsSysColorEntry( nSalColor ) ) + else if ( ImplIsSysColorEntry( nColor ) ) { nBrushColor = PALRGB_TO_RGB( nBrushColor ); hNewBrush = CreateSolidBrush( nBrushColor ); @@ -1555,12 +1554,12 @@ void WinSalGraphicsImpl::SetXORMode( bool bSet) void WinSalGraphicsImpl::SetROPLineColor( SalROPColor nROPColor ) { - SetLineColor( ImplGetROPSalColor( nROPColor ) ); + SetLineColor( ImplGetROPColor( nROPColor ) ); } void WinSalGraphicsImpl::SetROPFillColor( SalROPColor nROPColor ) { - SetFillColor( ImplGetROPSalColor( nROPColor ) ); + SetFillColor( ImplGetROPColor( nROPColor ) ); } void WinSalGraphicsImpl::drawPixelImpl( long nX, long nY, COLORREF crColor ) @@ -1582,15 +1581,15 @@ void WinSalGraphicsImpl::drawPixel( long nX, long nY ) drawPixelImpl( nX, nY, mnPenColor ); } -void WinSalGraphicsImpl::drawPixel( long nX, long nY, SalColor nSalColor ) +void WinSalGraphicsImpl::drawPixel( long nX, long nY, Color nColor ) { - COLORREF nCol = PALETTERGB( SALCOLOR_RED( nSalColor ), - SALCOLOR_GREEN( nSalColor ), - SALCOLOR_BLUE( nSalColor ) ); + COLORREF nCol = PALETTERGB( nColor.GetRed(), + nColor.GetGreen(), + nColor.GetBlue() ); if ( !mrParent.isPrinter() && GetSalData()->mhDitherPal && - ImplIsSysColorEntry( nSalColor ) ) + ImplIsSysColorEntry( nColor ) ) nCol = PALRGB_TO_RGB( nCol ); drawPixelImpl( nX, nY, nCol ); @@ -1903,7 +1902,7 @@ bool WinSalGraphicsImpl::drawPolyPolygon( const basegfx::B2DPolyPolygon& rPolyPo { Gdiplus::Graphics aGraphics(mrParent.getHDC()); const sal_uInt8 aTrans(sal_uInt8(255) - static_cast<sal_uInt8>(basegfx::fround(fTransparency * 255.0))); - const Gdiplus::Color aTestColor(aTrans, SALCOLOR_RED(maFillColor), SALCOLOR_GREEN(maFillColor), SALCOLOR_BLUE(maFillColor)); + const Gdiplus::Color aTestColor(aTrans, maFillColor.GetRed(), maFillColor.GetGreen(), maFillColor.GetBlue()); const Gdiplus::SolidBrush aSolidBrush(aTestColor.GetValue()); Gdiplus::GraphicsPath aGraphicsPath(Gdiplus::FillModeAlternate); @@ -1969,7 +1968,7 @@ bool WinSalGraphicsImpl::drawPolyLine( { Gdiplus::Graphics aGraphics(mrParent.getHDC()); const sal_uInt8 aTrans = static_cast<sal_uInt8>(basegfx::fround( 255 * (1.0 - fTransparency) )); - const Gdiplus::Color aTestColor(aTrans, SALCOLOR_RED(maLineColor), SALCOLOR_GREEN(maLineColor), SALCOLOR_BLUE(maLineColor)); + const Gdiplus::Color aTestColor(aTrans, maLineColor.GetRed(), maLineColor.GetGreen(), maLineColor.GetBlue()); Gdiplus::Pen aPen(aTestColor.GetValue(), Gdiplus::REAL(rLineWidths.getX())); Gdiplus::GraphicsPath aGraphicsPath(Gdiplus::FillModeAlternate); bool bNoLineJoin(false); diff --git a/vcl/win/gdi/gdiimpl.hxx b/vcl/win/gdi/gdiimpl.hxx index 350882198b32..f4810c1e1f3b 100644 --- a/vcl/win/gdi/gdiimpl.hxx +++ b/vcl/win/gdi/gdiimpl.hxx @@ -43,8 +43,8 @@ private: COLORREF mnBrushColor; // BrushColor // remember RGB values for SetLineColor/SetFillColor - SalColor maLineColor; - SalColor maFillColor; + Color maLineColor; + Color maFillColor; bool tryDrawBitmapGdiPlus(const SalTwoRect& rTR, const SalBitmap& rSrcBitmap); void drawPixelImpl( long nX, long nY, COLORREF crColor ); @@ -75,14 +75,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; @@ -95,7 +95,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; @@ -152,11 +152,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/win/gdi/salfont.cxx b/vcl/win/gdi/salfont.cxx index a6e050be9328..9dbde8fd52d7 100644 --- a/vcl/win/gdi/salfont.cxx +++ b/vcl/win/gdi/salfont.cxx @@ -726,15 +726,15 @@ void WinFontFace::GetFontCapabilities( HDC hDC ) const } } -void WinSalGraphics::SetTextColor( SalColor nSalColor ) +void WinSalGraphics::SetTextColor( Color nColor ) { - COLORREF aCol = PALETTERGB( SALCOLOR_RED( nSalColor ), - SALCOLOR_GREEN( nSalColor ), - SALCOLOR_BLUE( nSalColor ) ); + COLORREF aCol = PALETTERGB( nColor.GetRed(), + nColor.GetGreen(), + nColor.GetBlue() ); if( !mbPrinter && GetSalData()->mhDitherPal && - ImplIsSysColorEntry( nSalColor ) ) + ImplIsSysColorEntry( nColor ) ) { aCol = PALRGB_TO_RGB( aCol ); } diff --git a/vcl/win/gdi/salgdi.cxx b/vcl/win/gdi/salgdi.cxx index ffdd874cdd50..7933226e362c 100644 --- a/vcl/win/gdi/salgdi.cxx +++ b/vcl/win/gdi/salgdi.cxx @@ -342,12 +342,12 @@ void ImplFreeSalGDI() pSalData->mbResourcesAlreadyFreed = true; } -int ImplIsSysColorEntry( SalColor nSalColor ) +int ImplIsSysColorEntry( Color nColor ) { SysColorEntry* pEntry = pFirstSysColor; - const DWORD nTestRGB = static_cast<DWORD>(RGB( SALCOLOR_RED( nSalColor ), - SALCOLOR_GREEN( nSalColor ), - SALCOLOR_BLUE( nSalColor ) )); + const DWORD nTestRGB = static_cast<DWORD>(RGB( nColor.GetRed(), + nColor.GetGreen(), + nColor.GetBlue() )); while ( pEntry ) { @@ -730,9 +730,9 @@ void WinSalGraphics::SetLineColor() mpImpl->SetLineColor(); } -void WinSalGraphics::SetLineColor( SalColor nSalColor ) +void WinSalGraphics::SetLineColor( Color nColor ) { - mpImpl->SetLineColor( nSalColor ); + mpImpl->SetLineColor( nColor ); } void WinSalGraphics::SetFillColor() @@ -740,9 +740,9 @@ void WinSalGraphics::SetFillColor() mpImpl->SetFillColor(); } -void WinSalGraphics::SetFillColor( SalColor nSalColor ) +void WinSalGraphics::SetFillColor( Color nColor ) { - mpImpl->SetFillColor( nSalColor ); + mpImpl->SetFillColor( nColor ); } void WinSalGraphics::SetXORMode( bool bSet) @@ -765,9 +765,9 @@ void WinSalGraphics::drawPixel( long nX, long nY ) mpImpl->drawPixel( nX, nY ); } -void WinSalGraphics::drawPixel( long nX, long nY, SalColor nSalColor ) +void WinSalGraphics::drawPixel( long nX, long nY, Color nColor ) { - mpImpl->drawPixel( nX, nY, nSalColor ); + mpImpl->drawPixel( nX, nY, nColor ); } void WinSalGraphics::drawLine( long nX1, long nY1, long nX2, long nY2 ) diff --git a/vcl/win/gdi/salgdi2.cxx b/vcl/win/gdi/salgdi2.cxx index 5f9cb45913b2..c34a215eb304 100644 --- a/vcl/win/gdi/salgdi2.cxx +++ b/vcl/win/gdi/salgdi2.cxx @@ -210,7 +210,7 @@ bool WinSalGraphics::drawAlphaRect( long nX, long nY, long nWidth, void WinSalGraphics::drawMask( const SalTwoRect& rPosAry, const SalBitmap& rSSalBitmap, - SalColor nMaskColor ) + Color nMaskColor ) { mpImpl->drawMask( rPosAry, rSSalBitmap, nMaskColor ); } @@ -220,7 +220,7 @@ SalBitmap* WinSalGraphics::getBitmap( long nX, long nY, long nDX, long nDY ) return mpImpl->getBitmap( nX, nY, nDX, nDY ); } -SalColor WinSalGraphics::getPixel( long nX, long nY ) +Color WinSalGraphics::getPixel( long nX, long nY ) { return mpImpl->getPixel( nX, nY ); } diff --git a/vcl/win/gdi/salnativewidgets-luna.cxx b/vcl/win/gdi/salnativewidgets-luna.cxx index 848fc42fe1f5..e7f9ab232c42 100644 --- a/vcl/win/gdi/salnativewidgets-luna.cxx +++ b/vcl/win/gdi/salnativewidgets-luna.cxx @@ -1279,11 +1279,11 @@ bool WinSalGraphics::drawNativeControl( ControlType nType, // We can do OpenGL OpenGLCompatibleDC aBlackDC(*this, cacheRect.Left(), cacheRect.Top(), cacheRect.GetWidth()+1, cacheRect.GetHeight()+1); SetTextAlign(aBlackDC.getCompatibleHDC(), TA_LEFT|TA_TOP|TA_NOUPDATECP); - aBlackDC.fill(MAKE_SALCOLOR(0, 0, 0)); + aBlackDC.fill(RGB(0, 0, 0)); OpenGLCompatibleDC aWhiteDC(*this, cacheRect.Left(), cacheRect.Top(), cacheRect.GetWidth()+1, cacheRect.GetHeight()+1); SetTextAlign(aWhiteDC.getCompatibleHDC(), TA_LEFT|TA_TOP|TA_NOUPDATECP); - aWhiteDC.fill(MAKE_SALCOLOR(0xff, 0xff, 0xff)); + aWhiteDC.fill(RGB(0xff, 0xff, 0xff)); if (ImplDrawNativeControl(aBlackDC.getCompatibleHDC(), hTheme, rc, nType, nPart, nState, aValue, aCaptionStr) && ImplDrawNativeControl(aWhiteDC.getCompatibleHDC(), hTheme, rc, nType, nPart, nState, aValue, aCaptionStr)) diff --git a/vcl/win/gdi/winlayout.cxx b/vcl/win/gdi/winlayout.cxx index a89e77065361..f7c407c78fe1 100644 --- a/vcl/win/gdi/winlayout.cxx +++ b/vcl/win/gdi/winlayout.cxx @@ -151,7 +151,7 @@ bool WinFontInstance::CacheGlyphToAtlas(HDC hDC, HFONT hFont, int nGlyphIndex, S SetTextColor(aDC.getCompatibleHDC(), RGB(0, 0, 0)); SetBkColor(aDC.getCompatibleHDC(), RGB(255, 255, 255)); - aDC.fill(MAKE_SALCOLOR(0xff, 0xff, 0xff)); + aDC.fill(RGB(0xff, 0xff, 0xff)); pTxt->BindDC(aDC.getCompatibleHDC(), tools::Rectangle(0, 0, nBitmapWidth, nBitmapHeight)); auto pRT = pTxt->GetRenderTarget(); @@ -371,7 +371,7 @@ bool WinSalGraphics::DrawCachedGlyphs(const CommonSalLayout& rLayout) rLayout.GetBoundRect(*this, aRect); COLORREF color = GetTextColor(hDC); - SalColor salColor = MAKE_SALCOLOR(GetRValue(color), GetGValue(color), GetBValue(color)); + Color salColor = Color(GetRValue(color), GetGValue(color), GetBValue(color)); WinOpenGLSalGraphicsImpl *pImpl = dynamic_cast<WinOpenGLSalGraphicsImpl*>(mpImpl.get()); if (!pImpl) @@ -486,7 +486,7 @@ void WinSalGraphics::DrawTextLayout(const CommonSalLayout& rLayout) ::SetTextAlign(aDC.getCompatibleHDC(), nTextAlign); COLORREF color = ::GetTextColor(hDC); - SalColor salColor = MAKE_SALCOLOR(GetRValue(color), GetGValue(color), GetBValue(color)); + Color salColor(GetRValue(color), GetGValue(color), GetBValue(color)); // the actual drawing DrawTextLayout(rLayout, aDC.getCompatibleHDC(), !bForceGDI); |