summaryrefslogtreecommitdiff
path: root/vcl/opengl/gdiimpl.cxx
diff options
context:
space:
mode:
authorMichael Meeks <michael.meeks@collabora.com>2015-12-31 21:19:48 +0000
committerMichael Meeks <michael.meeks@collabora.com>2015-12-31 22:38:44 +0000
commite81c4d3ea00949cb4d8c3f44e09e70b19eebb826 (patch)
treee7a5a5116fbdab553aa42b94ed0a44e54575fce4 /vcl/opengl/gdiimpl.cxx
parenteb65936f1996cc37632f7241cf07fc85ff633049 (diff)
tdf#95507 - implement opengl / 50% invert method.
Change-Id: I8488cb8e8074831a6f81e6c8c122462c9819d25d Reviewed-on: https://gerrit.libreoffice.org/21025 Reviewed-by: Michael Meeks <michael.meeks@collabora.com> Tested-by: Michael Meeks <michael.meeks@collabora.com>
Diffstat (limited to 'vcl/opengl/gdiimpl.cxx')
-rw-r--r--vcl/opengl/gdiimpl.cxx60
1 files changed, 26 insertions, 34 deletions
diff --git a/vcl/opengl/gdiimpl.cxx b/vcl/opengl/gdiimpl.cxx
index 549f8ae01778..21ff21147394 100644
--- a/vcl/opengl/gdiimpl.cxx
+++ b/vcl/opengl/gdiimpl.cxx
@@ -551,6 +551,13 @@ bool OpenGLSalGraphicsImpl::UseSolid( SalColor nColor, double fTransparency )
return true;
}
+bool OpenGLSalGraphicsImpl::UseInvert50()
+{
+ if( !UseProgram( "dumbVertexShader", "invert50FragmentShader" ) )
+ return false;
+ return true;
+}
+
bool OpenGLSalGraphicsImpl::UseSolid( SalColor nColor )
{
return UseSolid( nColor, 0.0f );
@@ -575,13 +582,24 @@ bool OpenGLSalGraphicsImpl::UseSolidAA( SalColor nColor )
return UseSolidAA( nColor, 0.0 );
}
-bool OpenGLSalGraphicsImpl::UseInvert()
+bool OpenGLSalGraphicsImpl::UseInvert( SalInvert nFlags )
{
OpenGLZone aZone;
- if( !UseSolid( MAKE_SALCOLOR( 255, 255, 255 ) ) )
- return false;
- mpProgram->SetBlendMode( GL_ONE_MINUS_DST_COLOR, GL_ZERO );
+ if( ( nFlags & SAL_INVERT_50 ) ||
+ ( nFlags & SAL_INVERT_TRACKFRAME ) )
+ {
+ if( !UseInvert50() )
+ return false;
+ mpProgram->SetBlendMode( GL_ONE_MINUS_DST_COLOR,
+ GL_ONE_MINUS_SRC_COLOR );
+ }
+ else
+ {
+ if( !UseSolid( MAKE_SALCOLOR( 255, 255, 255 ) ) )
+ return false;
+ mpProgram->SetBlendMode( GL_ONE_MINUS_DST_COLOR, GL_ZERO );
+ }
return true;
}
@@ -1742,25 +1760,10 @@ void OpenGLSalGraphicsImpl::invert(
long nWidth, long nHeight,
SalInvert nFlags)
{
- // TODO Figure out what are those:
- // * SAL_INVERT_50 (50/50 pattern?)
- // * SAL_INVERT_TRACKFRAME (dash-line rectangle?)
-
PreDraw();
- if( nFlags & SAL_INVERT_TRACKFRAME )
- {
-
- }
- else if( nFlags & SAL_INVERT_50 )
- {
-
- }
- else // just invert
- {
- if( UseInvert() )
- DrawRect( nX, nY, nWidth, nHeight );
- }
+ if( UseInvert( nFlags ) )
+ DrawRect( nX, nY, nWidth, nHeight );
PostDraw();
}
@@ -1769,19 +1772,8 @@ void OpenGLSalGraphicsImpl::invert( sal_uInt32 nPoints, const SalPoint* pPtAry,
{
PreDraw();
- if( nFlags & SAL_INVERT_TRACKFRAME )
- {
-
- }
- else if( nFlags & SAL_INVERT_50 )
- {
-
- }
- else // just invert
- {
- if( UseInvert() )
- DrawPolygon( nPoints, pPtAry );
- }
+ if( UseInvert( nFlags ) )
+ DrawPolygon( nPoints, pPtAry );
PostDraw();
}