diff options
author | Noel Grandin <noel.grandin@collabora.co.uk> | 2018-03-14 11:11:02 +0200 |
---|---|---|
committer | Noel Grandin <noel.grandin@collabora.co.uk> | 2018-03-26 08:44:50 +0200 |
commit | bea081b5099786e5fcadddd72c247b9a9488286a (patch) | |
tree | dd165f81e850cb9bcfa23b713bd60e3fb26d21ee /vcl/opengl | |
parent | a488c7ad2763b944713997911c1ddb0315d8c93f (diff) |
replace SalColor with Color
Change-Id: I615640a378a61cf6e44e84a647ce06bdd8a52807
Reviewed-on: https://gerrit.libreoffice.org/51239
Tested-by: Jenkins <ci@libreoffice.org>
Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
Diffstat (limited to 'vcl/opengl')
-rw-r--r-- | vcl/opengl/LineRenderUtils.cxx | 8 | ||||
-rw-r--r-- | vcl/opengl/RenderList.cxx | 18 | ||||
-rw-r--r-- | vcl/opengl/gdiimpl.cxx | 58 | ||||
-rw-r--r-- | vcl/opengl/program.cxx | 16 |
4 files changed, 50 insertions, 50 deletions
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(); |