diff options
Diffstat (limited to 'vcl/source')
-rw-r--r-- | vcl/source/filter/graphicfilter.cxx | 30 | ||||
-rw-r--r-- | vcl/source/gdi/graph.cxx | 10 | ||||
-rw-r--r-- | vcl/source/gdi/impgraph.cxx | 24 |
3 files changed, 40 insertions, 24 deletions
diff --git a/vcl/source/filter/graphicfilter.cxx b/vcl/source/filter/graphicfilter.cxx index 5720ef90028b..5f7ddcc185f3 100644 --- a/vcl/source/filter/graphicfilter.cxx +++ b/vcl/source/filter/graphicfilter.cxx @@ -1326,7 +1326,7 @@ sal_uInt16 GraphicFilter::ImportGraphic( Graphic& rGraphic, const OUString& rPat sal_uInt16 nStatus; GraphicReader* pContext = rGraphic.GetContext(); GfxLinkType eLinkType = GFX_LINK_TYPE_NONE; - bool bDummyContext = ( pContext == reinterpret_cast<GraphicReader*>(1) ); + bool bDummyContext = rGraphic.IsDummyContext(); const bool bLinkSet = rGraphic.IsLink(); FilterConfigItem* pFilterConfigItem = nullptr; @@ -1376,7 +1376,7 @@ sal_uInt16 GraphicFilter::ImportGraphic( Graphic& rGraphic, const OUString& rPat { if( bDummyContext ) { - rGraphic.SetContext( nullptr ); + rGraphic.SetDummyContext( false ); nStreamBegin = 0; } else @@ -1387,7 +1387,7 @@ sal_uInt16 GraphicFilter::ImportGraphic( Graphic& rGraphic, const OUString& rPat // if pending, return GRFILTER_OK in order to request more bytes if( rIStream.GetError() == ERRCODE_IO_PENDING ) { - rGraphic.SetContext( reinterpret_cast<GraphicReader*>(1) ); + rGraphic.SetDummyContext(true); rIStream.ResetError(); rIStream.Seek( nStreamBegin ); return (sal_uInt16) ImplSetError( GRFILTER_OK ); @@ -1418,8 +1418,8 @@ sal_uInt16 GraphicFilter::ImportGraphic( Graphic& rGraphic, const OUString& rPat { if( aFilterName.equalsIgnoreAsciiCase( IMP_GIF ) ) { - if( rGraphic.GetContext() == reinterpret_cast<GraphicReader*>(1) ) - rGraphic.SetContext( nullptr ); + if( rGraphic.IsDummyContext()) + rGraphic.SetDummyContext( false ); if( !ImportGIF( rIStream, rGraphic ) ) nStatus = GRFILTER_FILTERERROR; @@ -1428,8 +1428,8 @@ sal_uInt16 GraphicFilter::ImportGraphic( Graphic& rGraphic, const OUString& rPat } else if( aFilterName.equalsIgnoreAsciiCase( IMP_PNG ) ) { - if ( rGraphic.GetContext() == reinterpret_cast<GraphicReader*>(1) ) - rGraphic.SetContext( nullptr ); + if( rGraphic.IsDummyContext()) + rGraphic.SetDummyContext( false ); vcl::PNGReader aPNGReader( rIStream ); @@ -1486,8 +1486,8 @@ sal_uInt16 GraphicFilter::ImportGraphic( Graphic& rGraphic, const OUString& rPat } else if( aFilterName.equalsIgnoreAsciiCase( IMP_JPEG ) ) { - if( rGraphic.GetContext() == reinterpret_cast<GraphicReader*>(1) ) - rGraphic.SetContext( nullptr ); + if( rGraphic.IsDummyContext()) + rGraphic.SetDummyContext( false ); // set LOGSIZE flag always, if not explicitly disabled // (see #90508 and #106763) @@ -1501,8 +1501,8 @@ sal_uInt16 GraphicFilter::ImportGraphic( Graphic& rGraphic, const OUString& rPat } else if( aFilterName.equalsIgnoreAsciiCase( IMP_SVG ) ) { - if( rGraphic.GetContext() == reinterpret_cast<GraphicReader*>(1) ) - rGraphic.SetContext( nullptr ); + if( rGraphic.IsDummyContext()) + rGraphic.SetDummyContext( false ); const sal_uInt32 nStreamPosition(rIStream.Tell()); const sal_uInt32 nStreamLength(rIStream.Seek(STREAM_SEEK_TO_END) - nStreamPosition); @@ -1571,16 +1571,16 @@ sal_uInt16 GraphicFilter::ImportGraphic( Graphic& rGraphic, const OUString& rPat } else if( aFilterName.equalsIgnoreAsciiCase( IMP_XBM ) ) { - if( rGraphic.GetContext() == reinterpret_cast<GraphicReader*>(1) ) - rGraphic.SetContext( nullptr ); + if( rGraphic.IsDummyContext()) + rGraphic.SetDummyContext( false ); if( !ImportXBM( rIStream, rGraphic ) ) nStatus = GRFILTER_FILTERERROR; } else if( aFilterName.equalsIgnoreAsciiCase( IMP_XPM ) ) { - if( rGraphic.GetContext() == reinterpret_cast<GraphicReader*>(1) ) - rGraphic.SetContext( nullptr ); + if( rGraphic.IsDummyContext()) + rGraphic.SetDummyContext( false ); if( !ImportXPM( rIStream, rGraphic ) ) nStatus = GRFILTER_FILTERERROR; diff --git a/vcl/source/gdi/graph.cxx b/vcl/source/gdi/graph.cxx index 2c14d8f3bc9a..b46efa024dad 100644 --- a/vcl/source/gdi/graph.cxx +++ b/vcl/source/gdi/graph.cxx @@ -506,6 +506,16 @@ void Graphic::SetContext( GraphicReader* pReader ) mpImpGraphic->ImplSetContext( pReader ); } +void Graphic::SetDummyContext( bool value ) +{ + mpImpGraphic->ImplSetDummyContext( value ); +} + +bool Graphic::IsDummyContext() +{ + return mpImpGraphic->ImplIsDummyContext(); +} + bool Graphic::SwapOut() { ImplTestRefCount(); diff --git a/vcl/source/gdi/impgraph.cxx b/vcl/source/gdi/impgraph.cxx index 21d2119e7a99..a8f1d0c7301b 100644 --- a/vcl/source/gdi/impgraph.cxx +++ b/vcl/source/gdi/impgraph.cxx @@ -98,7 +98,8 @@ ImpGraphic::ImpGraphic() : mnSizeBytes ( 0UL ), mnRefCount ( 1UL ), mbSwapOut ( false ), - mbSwapUnderway ( false ) + mbSwapUnderway ( false ), + mbDummyContext ( false ) { } @@ -111,7 +112,8 @@ ImpGraphic::ImpGraphic( const ImpGraphic& rImpGraphic ) : mnSizeBytes ( rImpGraphic.mnSizeBytes ), mnRefCount ( 1UL ), mbSwapOut ( rImpGraphic.mbSwapOut ), - mbSwapUnderway ( false ) + mbSwapUnderway ( false ), + mbDummyContext ( rImpGraphic.mbDummyContext ) { if( mpSwapFile ) mpSwapFile->nRefCount++; @@ -142,7 +144,8 @@ ImpGraphic::ImpGraphic( const Bitmap& rBitmap ) : mnSizeBytes ( 0UL ), mnRefCount ( 1UL ), mbSwapOut ( false ), - mbSwapUnderway ( false ) + mbSwapUnderway ( false ), + mbDummyContext ( false ) { } @@ -156,7 +159,8 @@ ImpGraphic::ImpGraphic( const BitmapEx& rBitmapEx ) : mnSizeBytes ( 0UL ), mnRefCount ( 1UL ), mbSwapOut ( false ), - mbSwapUnderway ( false ) + mbSwapUnderway ( false ), + mbDummyContext ( false ) { } @@ -170,6 +174,7 @@ ImpGraphic::ImpGraphic(const SvgDataPtr& rSvgDataPtr) mnRefCount( 1UL ), mbSwapOut( false ), mbSwapUnderway( false ), + mbDummyContext ( false ), maSvgData(rSvgDataPtr) { } @@ -184,7 +189,8 @@ ImpGraphic::ImpGraphic( const Animation& rAnimation ) : mnSizeBytes ( 0UL ), mnRefCount ( 1UL ), mbSwapOut ( false ), - mbSwapUnderway ( false ) + mbSwapUnderway ( false ), + mbDummyContext ( false ) { } @@ -198,16 +204,15 @@ ImpGraphic::ImpGraphic( const GDIMetaFile& rMtf ) : mnSizeBytes ( 0UL ), mnRefCount ( 1UL ), mbSwapOut ( false ), - mbSwapUnderway ( false ) + mbSwapUnderway ( false ), + mbDummyContext ( false ) { } ImpGraphic::~ImpGraphic() { ImplClear(); - - if( reinterpret_cast<sal_uLong>(mpContext) > 1UL ) - delete mpContext; + delete mpContext; } ImpGraphic& ImpGraphic::operator=( const ImpGraphic& rImpGraphic ) @@ -939,6 +944,7 @@ sal_uLong ImpGraphic::ImplGetAnimationLoopCount() const void ImpGraphic::ImplSetContext( GraphicReader* pReader ) { mpContext = pReader; + mbDummyContext = false; } bool ImpGraphic::ImplReadEmbedded( SvStream& rIStm ) |