diff options
author | Michael Meeks <michael.meeks@collabora.com> | 2015-03-19 16:56:13 +0000 |
---|---|---|
committer | Michael Meeks <michael.meeks@collabora.com> | 2015-04-10 12:21:37 +0100 |
commit | aeacfe0967f930f5e16711a32b90784fc856f0ec (patch) | |
tree | d7a67c12ad4ab2de3cb663018c2b5e347ab12fe2 /filter/source/graphicfilter/eos2met/eos2met.cxx | |
parent | ed953d1842caf0b8a00d1528cd012e3a9b83bdd2 (diff) |
Fix OutputDevice members / stack allocation: filter.
Change-Id: Ib67fd510626809baab774382d37b20462253fc31
Diffstat (limited to 'filter/source/graphicfilter/eos2met/eos2met.cxx')
-rw-r--r-- | filter/source/graphicfilter/eos2met/eos2met.cxx | 37 |
1 files changed, 19 insertions, 18 deletions
diff --git a/filter/source/graphicfilter/eos2met/eos2met.cxx b/filter/source/graphicfilter/eos2met/eos2met.cxx index 780ac5dcfc4d..c2bb58460a93 100644 --- a/filter/source/graphicfilter/eos2met/eos2met.cxx +++ b/filter/source/graphicfilter/eos2met/eos2met.cxx @@ -156,7 +156,7 @@ private: sal_uInt32 nWrittenBitmaps; // number of already written Bitmaps sal_uInt32 nActBitmapPercent; // percentage of the next bitmap that's already written - ::std::unique_ptr< VirtualDevice > apDummyVDev; + ScopedVclPtr<VirtualDevice> apDummyVDev; OutputDevice* pCompDev; com::sun::star::uno::Reference< com::sun::star::task::XStatusIndicator > xStatusIndicator; @@ -261,6 +261,7 @@ public: pCompDev = reinterpret_cast< OutputDevice* >( Application::GetAppWindow() ); if( !pCompDev ) { + apDummyVDev.disposeAndClear(); apDummyVDev.reset( new VirtualDevice ); pCompDev = apDummyVDev.get(); } @@ -1850,12 +1851,12 @@ void METWriter::WriteOrders( const GDIMetaFile* pMTF ) if( aGDIFont.GetAlign() != ALIGN_BASELINE) { - VirtualDevice aVDev; + ScopedVclPtr<VirtualDevice> pVDev( new VirtualDevice() ); if( aGDIFont.GetAlign()==ALIGN_TOP ) - aPt.Y()+=(long)aVDev.GetFontMetric( aGDIFont ).GetAscent(); + aPt.Y()+=(long)pVDev->GetFontMetric( aGDIFont ).GetAscent(); else - aPt.Y()-=(long)aVDev.GetFontMetric( aGDIFont ).GetDescent(); + aPt.Y()-=(long)pVDev->GetFontMetric( aGDIFont ).GetDescent(); } METSetMix(eGDIRasterOp); @@ -1879,11 +1880,11 @@ void METWriter::WriteOrders( const GDIMetaFile* pMTF ) if( aGDIFont.GetAlign() != ALIGN_BASELINE ) { - VirtualDevice aVDev; + ScopedVclPtr<VirtualDevice> pVDev( new VirtualDevice() ); if( aGDIFont.GetAlign() == ALIGN_TOP ) - aPt.Y()+=(long)aVDev.GetFontMetric(aGDIFont).GetAscent(); + aPt.Y()+=(long)pVDev->GetFontMetric(aGDIFont).GetAscent(); else - aPt.Y()-=(long)aVDev.GetFontMetric(aGDIFont).GetDescent(); + aPt.Y()-=(long)pVDev->GetFontMetric(aGDIFont).GetDescent(); } METSetMix(eGDIRasterOp); @@ -1922,7 +1923,7 @@ void METWriter::WriteOrders( const GDIMetaFile* pMTF ) case META_STRETCHTEXT_ACTION: { const MetaStretchTextAction* pA = static_cast<const MetaStretchTextAction*>(pMA); - VirtualDevice aVDev; + ScopedVclPtr<VirtualDevice> pVDev( new VirtualDevice() ); sal_uInt16 i; sal_Int32 nNormSize; OUString aStr; @@ -1931,14 +1932,14 @@ void METWriter::WriteOrders( const GDIMetaFile* pMTF ) Point aPt( pA->GetPoint() ); Point aPt2; - aVDev.SetFont( aGDIFont ); + pVDev->SetFont( aGDIFont ); if( aGDIFont.GetAlign() != ALIGN_BASELINE) { if( aGDIFont.GetAlign() == ALIGN_TOP ) - aPt.Y()+=(long)aVDev.GetFontMetric().GetAscent(); + aPt.Y()+=(long)pVDev->GetFontMetric().GetAscent(); else - aPt.Y()-=(long)aVDev.GetFontMetric().GetDescent(); + aPt.Y()-=(long)pVDev->GetFontMetric().GetDescent(); } METSetMix(eGDIRasterOp); @@ -1949,7 +1950,7 @@ void METWriter::WriteOrders( const GDIMetaFile* pMTF ) METSetChrSet(FindChrSet(aGDIFont)); aStr = pA->GetText().copy(pA->GetIndex(),pA->GetLen()); boost::scoped_array<long> pDXAry(new long[aStr.getLength()]); - nNormSize = aVDev.GetTextArray( aStr, pDXAry.get() ); + nNormSize = pVDev->GetTextArray( aStr, pDXAry.get() ); for ( i = 0; i < aStr.getLength(); i++ ) { @@ -2067,24 +2068,24 @@ void METWriter::WriteOrders( const GDIMetaFile* pMTF ) case META_GRADIENT_ACTION: { - VirtualDevice aVDev; + ScopedVclPtr<VirtualDevice> pVDev( new VirtualDevice() ); GDIMetaFile aTmpMtf; const MetaGradientAction* pA = static_cast<const MetaGradientAction*>(pMA); - aVDev.SetMapMode( aTargetMapMode ); - aVDev.AddGradientActions( pA->GetRect(), pA->GetGradient(), aTmpMtf ); + pVDev->SetMapMode( aTargetMapMode ); + pVDev->AddGradientActions( pA->GetRect(), pA->GetGradient(), aTmpMtf ); WriteOrders( &aTmpMtf ); } break; case META_HATCH_ACTION: { - VirtualDevice aVDev; + ScopedVclPtr<VirtualDevice> pVDev( new VirtualDevice() ); GDIMetaFile aTmpMtf; const MetaHatchAction* pA = static_cast<const MetaHatchAction*>(pMA); - aVDev.SetMapMode( aTargetMapMode ); - aVDev.AddHatchActions( pA->GetPolyPolygon(), pA->GetHatch(), aTmpMtf ); + pVDev->SetMapMode( aTargetMapMode ); + pVDev->AddHatchActions( pA->GetPolyPolygon(), pA->GetHatch(), aTmpMtf ); WriteOrders( &aTmpMtf ); } break; |