[Libreoffice-commits] core.git: Branch 'libreoffice-6-4' - vcl/source

Jan-Marek Glogowski (via logerrit) logerrit at kemper.freedesktop.org
Thu Nov 28 10:03:50 UTC 2019


 vcl/source/outdev/clipping.cxx |    3 ++-
 vcl/source/outdev/gradient.cxx |   15 ++++++++-------
 2 files changed, 10 insertions(+), 8 deletions(-)

New commits:
commit eacfff3748b56507c24d52dc4979ee75ee164dd1
Author:     Jan-Marek Glogowski <jan-marek.glogowski at extern.cib.de>
AuthorDate: Tue Nov 26 03:38:01 2019 +0000
Commit:     Xisco FaulĂ­ <xiscofauli at libreoffice.org>
CommitDate: Thu Nov 28 11:03:12 2019 +0100

    tdf#128337 clip the metafile Gradient drawing
    
    This basically reverts the patches for tdf#125670. Instead this
    just checks the mpGraphics in InitClipRegion() before using it,
    to prevent the crash from the tdf#125670 bug report.
    
    Additionally it drops the early mbOutputClipped return, as the
    output device doesn't matter for the metafile drawing and the
    preview of the tdf#125670 bugdoc and the Impress full screen
    view otherwise don't show the gradients.
    
    This patch works for me in the following tested scenarios:
    1. Bugdoc tdf#125670 doesn't crash
    2. Bugdoc tdf#125670 draws gradients in Impress full screen
    3. Correct thumbnail pictures for both bug documents
    
    With all these side effects, I have no idea, if this is finally
    the correct fix and doesn't break anything else...
    
    Change-Id: I8c48210d4255e50339710fc14819d15686417c9c
    Reviewed-on: https://gerrit.libreoffice.org/83722
    Tested-by: Jenkins
    Reviewed-by: Jan-Marek Glogowski <glogow at fbihome.de>
    (cherry picked from commit e021901b6c4f60735512c8d36b625be4f8edfd77)
    Reviewed-on: https://gerrit.libreoffice.org/83951
    Reviewed-by: Xisco FaulĂ­ <xiscofauli at libreoffice.org>

diff --git a/vcl/source/outdev/clipping.cxx b/vcl/source/outdev/clipping.cxx
index 416dc3be6595..1c6e4551c102 100644
--- a/vcl/source/outdev/clipping.cxx
+++ b/vcl/source/outdev/clipping.cxx
@@ -170,7 +170,8 @@ void OutputDevice::InitClipRegion()
     {
         if ( mbClipRegionSet )
         {
-            mpGraphics->ResetClipRegion();
+            if (mpGraphics)
+                mpGraphics->ResetClipRegion();
             mbClipRegionSet = false;
         }
 
diff --git a/vcl/source/outdev/gradient.cxx b/vcl/source/outdev/gradient.cxx
index 7fc37b31c9ab..2e8406714daf 100644
--- a/vcl/source/outdev/gradient.cxx
+++ b/vcl/source/outdev/gradient.cxx
@@ -50,6 +50,10 @@ void OutputDevice::DrawGradient( const tools::PolyPolygon& rPolyPoly,
 {
     assert(!is_double_buffered_window());
 
+    if (mbInitClipRegion)
+        InitClipRegion();
+    // don't return on mbOutputClipped here, as we may need to draw the clipped metafile, even if the output is clipped
+
     if ( rPolyPoly.Count() && rPolyPoly[ 0 ].GetSize() )
     {
         if ( mnDrawMode & ( DrawModeFlags::BlackGradient | DrawModeFlags::WhiteGradient | DrawModeFlags::SettingsGradient) )
@@ -94,20 +98,17 @@ void OutputDevice::DrawGradient( const tools::PolyPolygon& rPolyPoly,
                 if( !mpGraphics && !AcquireGraphics() )
                     return;
 
-                if( mbInitClipRegion )
-                    InitClipRegion();
-
-                if (mbOutputClipped)
-                    return;
-
                 // secure clip region
                 Push( PushFlags::CLIPREGION );
                 IntersectClipRegion( aBoundRect );
 
+                if (mbInitClipRegion)
+                    InitClipRegion();
+
                 // try to draw gradient natively
                 bDrawn = mpGraphics->DrawGradient( aClixPolyPoly, aGradient );
 
-                if (!bDrawn)
+                if (!bDrawn && !mbOutputClipped)
                 {
                     // draw gradients without border
                     if( mbLineColor || mbInitLineColor )


More information about the Libreoffice-commits mailing list