summaryrefslogtreecommitdiff
path: root/vcl/source
diff options
context:
space:
mode:
authorJan-Marek Glogowski <jan-marek.glogowski@extern.cib.de>2019-11-26 03:38:01 +0000
committerJan-Marek Glogowski <glogow@fbihome.de>2019-11-27 21:52:08 +0100
commite021901b6c4f60735512c8d36b625be4f8edfd77 (patch)
treeb9ac3864079d3ef559a388cec66ec71699a6a6ae /vcl/source
parentc4186cb28476fc6286d7d3b9af3d98d6f9440a43 (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')
-rw-r--r--vcl/source/outdev/clipping.cxx3
-rw-r--r--vcl/source/outdev/gradient.cxx15
2 files changed, 10 insertions, 8 deletions
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 )