diff options
author | Michael Meeks <michael.meeks@collabora.com> | 2015-03-19 14:38:23 +0000 |
---|---|---|
committer | Michael Meeks <michael.meeks@collabora.com> | 2015-04-10 12:13:36 +0100 |
commit | 057347dad41f7df3222cc483fdff83fa631606bb (patch) | |
tree | 0d34d8f77eaced4054ce6b16cddf0104f3bcdd6a /svx/source/xoutdev | |
parent | 7a2e0a335593bcd04caf5ba3fd7a9b0e2d933567 (diff) |
Fix OutputDevice members / stack allocation.
Change-Id: Ie57434607b61085a882af40b63d6a4b7aac0d4d3
Diffstat (limited to 'svx/source/xoutdev')
-rw-r--r-- | svx/source/xoutdev/_xoutbmp.cxx | 38 | ||||
-rw-r--r-- | svx/source/xoutdev/xattrbmp.cxx | 24 | ||||
-rw-r--r-- | svx/source/xoutdev/xtabdash.cxx | 16 | ||||
-rw-r--r-- | svx/source/xoutdev/xtabgrdt.cxx | 10 | ||||
-rw-r--r-- | svx/source/xoutdev/xtabhtch.cxx | 16 | ||||
-rw-r--r-- | svx/source/xoutdev/xtablend.cxx | 16 |
6 files changed, 60 insertions, 60 deletions
diff --git a/svx/source/xoutdev/_xoutbmp.cxx b/svx/source/xoutdev/_xoutbmp.cxx index 1f39734d3dff..5e4a7e7d8b99 100644 --- a/svx/source/xoutdev/_xoutbmp.cxx +++ b/svx/source/xoutdev/_xoutbmp.cxx @@ -250,27 +250,27 @@ sal_uInt16 XOutBitmap::WriteGraphic( const Graphic& rGraphic, OUString& rFileNam { if( pMtfSize_100TH_MM && ( rGraphic.GetType() != GRAPHIC_BITMAP ) ) { - VirtualDevice aVDev; - const Size aSize( aVDev.LogicToPixel( *pMtfSize_100TH_MM, MAP_100TH_MM ) ); + ScopedVclPtr< VirtualDevice > pVDev(new VirtualDevice()); + const Size aSize( pVDev->LogicToPixel( *pMtfSize_100TH_MM, MAP_100TH_MM ) ); - if( aVDev.SetOutputSizePixel( aSize ) ) + if( pVDev->SetOutputSizePixel( aSize ) ) { - const Wallpaper aWallpaper( aVDev.GetBackground() ); + const Wallpaper aWallpaper( pVDev->GetBackground() ); const Point aPt; - aVDev.SetBackground( Wallpaper( Color( COL_BLACK ) ) ); - aVDev.Erase(); - rGraphic.Draw( &aVDev, aPt, aSize ); + pVDev->SetBackground( Wallpaper( Color( COL_BLACK ) ) ); + pVDev->Erase(); + rGraphic.Draw( pVDev.get(), aPt, aSize ); - const Bitmap aBitmap( aVDev.GetBitmap( aPt, aSize ) ); + const Bitmap aBitmap( pVDev->GetBitmap( aPt, aSize ) ); - aVDev.SetBackground( aWallpaper ); - aVDev.Erase(); - rGraphic.Draw( &aVDev, aPt, aSize ); + pVDev->SetBackground( aWallpaper ); + pVDev->Erase(); + rGraphic.Draw( pVDev.get(), aPt, aSize ); - aVDev.SetRasterOp( ROP_XOR ); - aVDev.DrawBitmap( aPt, aSize, aBitmap ); - aGraphic = BitmapEx( aBitmap, aVDev.GetBitmap( aPt, aSize ) ); + pVDev->SetRasterOp( ROP_XOR ); + pVDev->DrawBitmap( aPt, aSize, aBitmap ); + aGraphic = BitmapEx( aBitmap, pVDev->GetBitmap( aPt, aSize ) ); } else aGraphic = rGraphic.GetBitmapEx(); @@ -283,13 +283,13 @@ sal_uInt16 XOutBitmap::WriteGraphic( const Graphic& rGraphic, OUString& rFileNam { if( pMtfSize_100TH_MM && ( rGraphic.GetType() != GRAPHIC_BITMAP ) ) { - VirtualDevice aVDev; - const Size aSize( aVDev.LogicToPixel( *pMtfSize_100TH_MM, MAP_100TH_MM ) ); + ScopedVclPtr< VirtualDevice > pVDev(new VirtualDevice()); + const Size aSize( pVDev->LogicToPixel( *pMtfSize_100TH_MM, MAP_100TH_MM ) ); - if( aVDev.SetOutputSizePixel( aSize ) ) + if( pVDev->SetOutputSizePixel( aSize ) ) { - rGraphic.Draw( &aVDev, Point(), aSize ); - aGraphic = aVDev.GetBitmap( Point(), aSize ); + rGraphic.Draw( pVDev.get(), Point(), aSize ); + aGraphic = pVDev->GetBitmap( Point(), aSize ); } else aGraphic = rGraphic.GetBitmap(); diff --git a/svx/source/xoutdev/xattrbmp.cxx b/svx/source/xoutdev/xattrbmp.cxx index 0518bdddf0e6..cecfc7c27725 100644 --- a/svx/source/xoutdev/xattrbmp.cxx +++ b/svx/source/xoutdev/xattrbmp.cxx @@ -140,7 +140,7 @@ const GraphicObject& XOBitmap::GetGraphicObject() const void XOBitmap::Bitmap2Array() { - VirtualDevice aVD; + ScopedVclPtr<VirtualDevice> pVDev( new VirtualDevice() ); bool bPixelColor = false; const Bitmap aBitmap( GetBitmap() ); const sal_uInt16 nLines = 8; // type dependent @@ -148,23 +148,23 @@ void XOBitmap::Bitmap2Array() if( !pPixelArray ) pPixelArray = new sal_uInt16[ nLines * nLines ]; - aVD.SetOutputSizePixel( aBitmap.GetSizePixel() ); - aVD.DrawBitmap( Point(), aBitmap ); - aPixelColor = aBckgrColor = aVD.GetPixel( Point() ); + pVDev->SetOutputSizePixel( aBitmap.GetSizePixel() ); + pVDev->DrawBitmap( Point(), aBitmap ); + aPixelColor = aBckgrColor = pVDev->GetPixel( Point() ); // create array and determine foreground and background color for( sal_uInt16 i = 0; i < nLines; i++ ) { for( sal_uInt16 j = 0; j < nLines; j++ ) { - if ( aVD.GetPixel( Point( j, i ) ) == aBckgrColor ) + if ( pVDev->GetPixel( Point( j, i ) ) == aBckgrColor ) *( pPixelArray + j + i * nLines ) = 0; else { *( pPixelArray + j + i * nLines ) = 1; if( !bPixelColor ) { - aPixelColor = aVD.GetPixel( Point( j, i ) ); + aPixelColor = pVDev->GetPixel( Point( j, i ) ); bPixelColor = true; } } @@ -175,13 +175,13 @@ void XOBitmap::Bitmap2Array() /// convert array, fore- and background color into a bitmap void XOBitmap::Array2Bitmap() { - VirtualDevice aVD; - sal_uInt16 nLines = 8; // type dependent + ScopedVclPtr<VirtualDevice> pVDev( new VirtualDevice() ); + sal_uInt16 nLines = 8; // type dependent if( !pPixelArray ) return; - aVD.SetOutputSizePixel( Size( nLines, nLines ) ); + pVDev->SetOutputSizePixel( Size( nLines, nLines ) ); // create bitmap for( sal_uInt16 i = 0; i < nLines; i++ ) @@ -189,13 +189,13 @@ void XOBitmap::Array2Bitmap() for( sal_uInt16 j = 0; j < nLines; j++ ) { if( *( pPixelArray + j + i * nLines ) == 0 ) - aVD.DrawPixel( Point( j, i ), aBckgrColor ); + pVDev->DrawPixel( Point( j, i ), aBckgrColor ); else - aVD.DrawPixel( Point( j, i ), aPixelColor ); + pVDev->DrawPixel( Point( j, i ), aPixelColor ); } } - aGraphicObject = GraphicObject( aVD.GetBitmap( Point(), Size( nLines, nLines ) ) ); + aGraphicObject = GraphicObject( pVDev->GetBitmap( Point(), Size( nLines, nLines ) ) ); bGraphicDirty = false; } diff --git a/svx/source/xoutdev/xtabdash.cxx b/svx/source/xoutdev/xtabdash.cxx index 129490a8b82a..07d02a1c724e 100644 --- a/svx/source/xoutdev/xtabdash.cxx +++ b/svx/source/xoutdev/xtabdash.cxx @@ -135,11 +135,11 @@ Bitmap XDashList::ImpCreateBitmapForXDash(const XDash* pDash) aStrokeAttribute)); // prepare VirtualDevice - VirtualDevice aVirtualDevice; + ScopedVclPtr< VirtualDevice > pVirtualDevice(new VirtualDevice()); const drawinglayer::geometry::ViewInformation2D aNewViewInformation2D; - aVirtualDevice.SetOutputSizePixel(aSize); - aVirtualDevice.SetDrawMode(rStyleSettings.GetHighContrastMode() + pVirtualDevice->SetOutputSizePixel(aSize); + pVirtualDevice->SetDrawMode(rStyleSettings.GetHighContrastMode() ? DRAWMODE_SETTINGSLINE | DRAWMODE_SETTINGSFILL | DRAWMODE_SETTINGSTEXT | DRAWMODE_SETTINGSGRADIENT : DRAWMODE_DEFAULT); @@ -150,17 +150,17 @@ Bitmap XDashList::ImpCreateBitmapForXDash(const XDash* pDash) static const Color aW(COL_WHITE); static const Color aG(0xef, 0xef, 0xef); - aVirtualDevice.DrawCheckered(aNull, aSize, nLen, aW, aG); + pVirtualDevice->DrawCheckered(aNull, aSize, nLen, aW, aG); } else { - aVirtualDevice.SetBackground(rStyleSettings.GetFieldColor()); - aVirtualDevice.Erase(); + pVirtualDevice->SetBackground(rStyleSettings.GetFieldColor()); + pVirtualDevice->Erase(); } // create processor and draw primitives boost::scoped_ptr<drawinglayer::processor2d::BaseProcessor2D> pProcessor2D(drawinglayer::processor2d::createPixelProcessor2DFromOutputDevice( - aVirtualDevice, + *pVirtualDevice.get(), aNewViewInformation2D)); if(pProcessor2D) @@ -172,7 +172,7 @@ Bitmap XDashList::ImpCreateBitmapForXDash(const XDash* pDash) } // get result bitmap and scale - Bitmap aRetval(aVirtualDevice.GetBitmap(Point(0, 0), aVirtualDevice.GetOutputSizePixel())); + Bitmap aRetval(pVirtualDevice->GetBitmap(Point(0, 0), pVirtualDevice->GetOutputSizePixel())); if(1 != nFactor) { diff --git a/svx/source/xoutdev/xtabgrdt.cxx b/svx/source/xoutdev/xtabgrdt.cxx index f25a215fd29f..560765974e4c 100644 --- a/svx/source/xoutdev/xtabgrdt.cxx +++ b/svx/source/xoutdev/xtabgrdt.cxx @@ -181,17 +181,17 @@ Bitmap XGradientList::CreateBitmapForUI( long nIndex ) aBlack)); // prepare VirtualDevice - VirtualDevice aVirtualDevice; + ScopedVclPtr< VirtualDevice > pVirtualDevice(new VirtualDevice()); const drawinglayer::geometry::ViewInformation2D aNewViewInformation2D; - aVirtualDevice.SetOutputSizePixel(rSize); - aVirtualDevice.SetDrawMode(rStyleSettings.GetHighContrastMode() + pVirtualDevice->SetOutputSizePixel(rSize); + pVirtualDevice->SetDrawMode(rStyleSettings.GetHighContrastMode() ? DRAWMODE_SETTINGSLINE | DRAWMODE_SETTINGSFILL | DRAWMODE_SETTINGSTEXT | DRAWMODE_SETTINGSGRADIENT : DRAWMODE_DEFAULT); // create processor and draw primitives boost::scoped_ptr<drawinglayer::processor2d::BaseProcessor2D> pProcessor2D(drawinglayer::processor2d::createPixelProcessor2DFromOutputDevice( - aVirtualDevice, + *pVirtualDevice.get(), aNewViewInformation2D)); if(pProcessor2D) @@ -206,7 +206,7 @@ Bitmap XGradientList::CreateBitmapForUI( long nIndex ) } // get result bitmap and scale - aRetval = aVirtualDevice.GetBitmap(Point(0, 0), aVirtualDevice.GetOutputSizePixel()); + aRetval = pVirtualDevice->GetBitmap(Point(0, 0), pVirtualDevice->GetOutputSizePixel()); } return aRetval; diff --git a/svx/source/xoutdev/xtabhtch.cxx b/svx/source/xoutdev/xtabhtch.cxx index ba73c5c7c8b4..555347669a3b 100644 --- a/svx/source/xoutdev/xtabhtch.cxx +++ b/svx/source/xoutdev/xtabhtch.cxx @@ -142,11 +142,11 @@ Bitmap XHatchList::CreateBitmapForUI( long nIndex ) aBlack)); // prepare VirtualDevice - VirtualDevice aVirtualDevice; + ScopedVclPtr< VirtualDevice > pVirtualDevice(new VirtualDevice()); const drawinglayer::geometry::ViewInformation2D aNewViewInformation2D; - aVirtualDevice.SetOutputSizePixel(rSize); - aVirtualDevice.SetDrawMode(rStyleSettings.GetHighContrastMode() + pVirtualDevice->SetOutputSizePixel(rSize); + pVirtualDevice->SetDrawMode(rStyleSettings.GetHighContrastMode() ? DRAWMODE_SETTINGSLINE | DRAWMODE_SETTINGSFILL | DRAWMODE_SETTINGSTEXT | DRAWMODE_SETTINGSGRADIENT : DRAWMODE_DEFAULT); @@ -156,17 +156,17 @@ Bitmap XHatchList::CreateBitmapForUI( long nIndex ) static const sal_uInt32 nLen(8); static const Color aW(COL_WHITE); static const Color aG(0xef, 0xef, 0xef); - aVirtualDevice.DrawCheckered(aNull, rSize, nLen, aW, aG); + pVirtualDevice->DrawCheckered(aNull, rSize, nLen, aW, aG); } else { - aVirtualDevice.SetBackground(rStyleSettings.GetFieldColor()); - aVirtualDevice.Erase(); + pVirtualDevice->SetBackground(rStyleSettings.GetFieldColor()); + pVirtualDevice->Erase(); } // create processor and draw primitives boost::scoped_ptr<drawinglayer::processor2d::BaseProcessor2D> pProcessor2D(drawinglayer::processor2d::createPixelProcessor2DFromOutputDevice( - aVirtualDevice, + *pVirtualDevice.get(), aNewViewInformation2D)); if(pProcessor2D) @@ -180,7 +180,7 @@ Bitmap XHatchList::CreateBitmapForUI( long nIndex ) } // get result bitmap and scale - aRetval = aVirtualDevice.GetBitmap(Point(0, 0), aVirtualDevice.GetOutputSizePixel()); + aRetval = pVirtualDevice->GetBitmap(Point(0, 0), pVirtualDevice->GetOutputSizePixel()); } return aRetval; diff --git a/svx/source/xoutdev/xtablend.cxx b/svx/source/xoutdev/xtablend.cxx index cd4dae3f091b..1c5b8a843bf3 100644 --- a/svx/source/xoutdev/xtablend.cxx +++ b/svx/source/xoutdev/xtablend.cxx @@ -125,11 +125,11 @@ Bitmap XLineEndList::CreateBitmapForUI( long nIndex ) aLineStartEndAttribute)); // prepare VirtualDevice - VirtualDevice aVirtualDevice; + ScopedVclPtr< VirtualDevice > pVirtualDevice(new VirtualDevice()); const drawinglayer::geometry::ViewInformation2D aNewViewInformation2D; - aVirtualDevice.SetOutputSizePixel(aSize); - aVirtualDevice.SetDrawMode(rStyleSettings.GetHighContrastMode() + pVirtualDevice->SetOutputSizePixel(aSize); + pVirtualDevice->SetDrawMode(rStyleSettings.GetHighContrastMode() ? DRAWMODE_SETTINGSLINE | DRAWMODE_SETTINGSFILL | DRAWMODE_SETTINGSTEXT | DRAWMODE_SETTINGSGRADIENT : DRAWMODE_DEFAULT); @@ -139,17 +139,17 @@ Bitmap XLineEndList::CreateBitmapForUI( long nIndex ) static const sal_uInt32 nLen(8); static const Color aW(COL_WHITE); static const Color aG(0xef, 0xef, 0xef); - aVirtualDevice.DrawCheckered(aNull, aSize, nLen, aW, aG); + pVirtualDevice->DrawCheckered(aNull, aSize, nLen, aW, aG); } else { - aVirtualDevice.SetBackground(rStyleSettings.GetFieldColor()); - aVirtualDevice.Erase(); + pVirtualDevice->SetBackground(rStyleSettings.GetFieldColor()); + pVirtualDevice->Erase(); } // create processor and draw primitives boost::scoped_ptr<drawinglayer::processor2d::BaseProcessor2D> pProcessor2D(drawinglayer::processor2d::createPixelProcessor2DFromOutputDevice( - aVirtualDevice, + *pVirtualDevice.get(), aNewViewInformation2D)); if(pProcessor2D) @@ -161,7 +161,7 @@ Bitmap XLineEndList::CreateBitmapForUI( long nIndex ) } // get result bitmap and scale - aRetval = aVirtualDevice.GetBitmap(Point(0, 0), aVirtualDevice.GetOutputSizePixel()); + aRetval = pVirtualDevice->GetBitmap(Point(0, 0), pVirtualDevice->GetOutputSizePixel()); } return aRetval; |