[Libreoffice-commits] core.git: Branch 'feature/opengl-vcl2' - vcl/opengl vcl/source

Louis-Francis Ratté-Boulianne lfrb at collabora.com
Wed Nov 19 07:10:20 PST 2014


 vcl/opengl/gdiimpl.cxx         |    1 -
 vcl/source/outdev/gradient.cxx |   19 ++++++++-----------
 2 files changed, 8 insertions(+), 12 deletions(-)

New commits:
commit 738f3b4e026ec4d57d7de691df9d253f4497d9b0
Author: Louis-Francis Ratté-Boulianne <lfrb at collabora.com>
Date:   Wed Nov 19 10:09:42 2014 -0500

    vcl: Apply the OutputDevice transformation to the gradient clipping polygon
    
    Change-Id: I16845c6cb0c110749112d608c209020f21549e70

diff --git a/vcl/opengl/gdiimpl.cxx b/vcl/opengl/gdiimpl.cxx
index c008cc2..53c7ce0 100644
--- a/vcl/opengl/gdiimpl.cxx
+++ b/vcl/opengl/gdiimpl.cxx
@@ -1705,7 +1705,6 @@ bool OpenGLSalGraphicsImpl::drawGradient(const tools::PolyPolygon& rPolyPoly,
     aBoundRect.Top()--;
     aBoundRect.Right()++;
     aBoundRect.Bottom()++;
-    //TODO: lfrb: some missing transformation with the polygon in outdev
 
     PreDraw();
 
diff --git a/vcl/source/outdev/gradient.cxx b/vcl/source/outdev/gradient.cxx
index 77be6a0..8916e76 100644
--- a/vcl/source/outdev/gradient.cxx
+++ b/vcl/source/outdev/gradient.cxx
@@ -41,8 +41,6 @@ void OutputDevice::DrawGradient( const Rectangle& rRect,
 void OutputDevice::DrawGradient( const tools::PolyPolygon& rPolyPoly,
                                  const Gradient& rGradient )
 {
-    bool bDrawn = false;
-
     if ( mnDrawMode & DRAWMODE_NOGRADIENT )
         return;     // nothing to draw!
 
@@ -52,12 +50,7 @@ void OutputDevice::DrawGradient( const tools::PolyPolygon& rPolyPoly,
     if ( mbOutputClipped )
         return;
 
-    if ( mpGraphics || AcquireGraphics() )
-    {
-        bDrawn = mpGraphics->DrawGradient( rPolyPoly, rGradient, this );
-    }
-
-    if ( !bDrawn && rPolyPoly.Count() && rPolyPoly[ 0 ].GetSize() )
+    if ( rPolyPoly.Count() && rPolyPoly[ 0 ].GetSize() )
     {
         if ( mnDrawMode & ( DRAWMODE_BLACKGRADIENT | DRAWMODE_WHITEGRADIENT | DRAWMODE_SETTINGSGRADIENT) )
         {
@@ -95,6 +88,9 @@ void OutputDevice::DrawGradient( const tools::PolyPolygon& rPolyPoly,
             // do nothing if the rectangle is empty
             if ( !aRect.IsEmpty() )
             {
+                tools::PolyPolygon aClipPolyPoly( ImplLogicToDevicePixel( rPolyPoly ) );
+                bool bDrawn = false;
+
                 if( !mpGraphics && !AcquireGraphics() )
                     return;
 
@@ -105,10 +101,11 @@ void OutputDevice::DrawGradient( const tools::PolyPolygon& rPolyPoly,
                 if( mbInitClipRegion )
                     InitClipRegion();
 
-                if( !mbOutputClipped )
-                {
-                    tools::PolyPolygon aClipPolyPoly( ImplLogicToDevicePixel( rPolyPoly ) );
+                // try to draw gradient natively
+                bDrawn = mpGraphics->DrawGradient( aClipPolyPoly, aGradient, this );
 
+                if( !bDrawn && !mbOutputClipped )
+                {
                     // draw gradients without border
                     if( mbLineColor || mbInitLineColor )
                     {


More information about the Libreoffice-commits mailing list