Kaydet (Commit) a9b3f13a authored tarafından Thorsten Behrens's avatar Thorsten Behrens Kaydeden (comit) Miklos Vajna

tdf#44388: handle the NULL clip correctly for pdf output

With the rework to use basegfx polygon clipping (a334752d), the case
'fully clipped away', aka NULL clip, aka nothing visible, stopped
working.

Manifests itself as an empty clip polygon, but with m_bClipRegion being
true. Explicitely write out as zero-surface clip polygon.

i#65128 is related.

Change-Id: I57389fcd057d75dfa4e0de9ebb86794437c70b55
(cherry picked from commit 86b47f51)
Reviewed-on: https://gerrit.libreoffice.org/17725Tested-by: 's avatarJenkins <ci@libreoffice.org>
Reviewed-by: 's avatarMiklos Vajna <vmiklos@collabora.co.uk>
üst fdc60b74
...@@ -11982,14 +11982,14 @@ void PDFWriterImpl::updateGraphicsState(Mode const mode) ...@@ -11982,14 +11982,14 @@ void PDFWriterImpl::updateGraphicsState(Mode const mode)
if( m_aCurrentPDFState.m_bClipRegion != rNewState.m_bClipRegion || if( m_aCurrentPDFState.m_bClipRegion != rNewState.m_bClipRegion ||
( rNewState.m_bClipRegion && m_aCurrentPDFState.m_aClipRegion != rNewState.m_aClipRegion ) ) ( rNewState.m_bClipRegion && m_aCurrentPDFState.m_aClipRegion != rNewState.m_aClipRegion ) )
{ {
if( m_aCurrentPDFState.m_bClipRegion && m_aCurrentPDFState.m_aClipRegion.count() ) if( m_aCurrentPDFState.m_bClipRegion )
{ {
aLine.append( "Q " ); aLine.append( "Q " );
// invalidate everything but the clip region // invalidate everything but the clip region
m_aCurrentPDFState = GraphicsState(); m_aCurrentPDFState = GraphicsState();
rNewState.m_nUpdateFlags = sal::static_int_cast<sal_uInt16>(~GraphicsState::updateClipRegion); rNewState.m_nUpdateFlags = sal::static_int_cast<sal_uInt16>(~GraphicsState::updateClipRegion);
} }
if( rNewState.m_bClipRegion && rNewState.m_aClipRegion.count() ) if( rNewState.m_bClipRegion )
{ {
// clip region is always stored in private PDF mapmode // clip region is always stored in private PDF mapmode
MapMode aNewMapMode = rNewState.m_aMapMode; MapMode aNewMapMode = rNewState.m_aMapMode;
...@@ -11998,7 +11998,10 @@ void PDFWriterImpl::updateGraphicsState(Mode const mode) ...@@ -11998,7 +11998,10 @@ void PDFWriterImpl::updateGraphicsState(Mode const mode)
m_aCurrentPDFState.m_aMapMode = rNewState.m_aMapMode; m_aCurrentPDFState.m_aMapMode = rNewState.m_aMapMode;
aLine.append( "q " ); aLine.append( "q " );
m_aPages.back().appendPolyPolygon( rNewState.m_aClipRegion, aLine ); if( rNewState.m_aClipRegion.count() )
m_aPages.back().appendPolyPolygon( rNewState.m_aClipRegion, aLine );
else
aLine.append( "0 0 m h " ); // NULL clip, i.e. nothing visible
aLine.append( "W* n\n" ); aLine.append( "W* n\n" );
rNewState.m_aMapMode = aNewMapMode; rNewState.m_aMapMode = aNewMapMode;
getReferenceDevice()->SetMapMode( rNewState.m_aMapMode ); getReferenceDevice()->SetMapMode( rNewState.m_aMapMode );
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment