diff options
author | Jan-Marek Glogowski <jan-marek.glogowski@extern.cib.de> | 2019-11-26 03:38:01 +0000 |
---|---|---|
committer | Jan-Marek Glogowski <glogow@fbihome.de> | 2019-11-27 21:52:08 +0100 |
commit | e021901b6c4f60735512c8d36b625be4f8edfd77 (patch) | |
tree | b9ac3864079d3ef559a388cec66ec71699a6a6ae /vcl/source/outdev/gradient.cxx | |
parent | c4186cb28476fc6286d7d3b9af3d98d6f9440a43 (diff) |
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@fbihome.de>
Diffstat (limited to 'vcl/source/outdev/gradient.cxx')
-rw-r--r-- | vcl/source/outdev/gradient.cxx | 15 |
1 files changed, 8 insertions, 7 deletions
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 ) |