summaryrefslogtreecommitdiff
path: root/canvas
diff options
context:
space:
mode:
authorMichael Meeks <michael.meeks@collabora.com>2015-04-28 11:41:31 +0100
committerMichael Meeks <michael.meeks@collabora.com>2015-04-28 15:08:48 +0100
commite8b97a52c96df9c8e8055407b1e40ed7cb9cfc67 (patch)
treeb322529f4a54a6427862cb20cb4cf87fb6a5d065 /canvas
parent2b0be6c0e9d23f1b8535ba7033732ae2e3bfb5c9 (diff)
parent0cde74f788a054fa2b65107a030dd463b8d11c7a (diff)
Merge remote-tracking branch 'origin/feature/vclptr'
Resolve several thousand lines of conflicts. Conflicts: accessibility/source/extended/accessiblelistbox.cxx accessibility/source/standard/vclxaccessiblecombobox.cxx accessibility/source/standard/vclxaccessibledropdowncombobox.cxx accessibility/source/standard/vclxaccessibledropdownlistbox.cxx accessibility/source/standard/vclxaccessiblelistbox.cxx accessibility/source/standard/vclxaccessibletextfield.cxx basctl/source/basicide/basidesh.cxx cui/source/inc/chardlg.hxx cui/source/tabpages/tpbitmap.cxx dbaccess/source/ui/dlg/UserAdmin.cxx dbaccess/source/ui/querydesign/ConnectionLineAccess.cxx extensions/source/propctrlr/propertyeditor.hxx extensions/source/scanner/sanedlg.cxx filter/source/pdf/impdialog.cxx include/sfx2/mgetempl.hxx include/sfx2/sidebar/SidebarToolBox.hxx include/sfx2/viewsh.hxx include/svtools/brwbox.hxx include/svtools/filectrl.hxx include/svtools/scrwin.hxx include/svx/dlgctrl.hxx include/svx/sidebar/Popup.hxx include/svx/sidebar/PopupContainer.hxx include/svx/sidebar/PopupControl.hxx include/svx/sidebar/SidebarDialControl.hxx include/svx/sidebar/ValueSetWithTextControl.hxx sc/source/ui/condformat/condformatdlgentry.cxx sc/source/ui/navipi/navipi.cxx sc/source/ui/sidebar/CellBorderStyleControl.hxx sd/source/ui/animations/CustomAnimationDialog.cxx sd/source/ui/inc/DrawViewShell.hxx sd/source/ui/inc/Ruler.hxx sd/source/ui/inc/SlideSorter.hxx sd/source/ui/inc/ViewTabBar.hxx sd/source/ui/inc/Window.hxx sd/source/ui/inc/morphdlg.hxx sd/source/ui/inc/sdpreslt.hxx sd/source/ui/sidebar/CurrentMasterPagesSelector.hxx sd/source/ui/sidebar/LayoutMenu.hxx sd/source/ui/sidebar/MasterPagesSelector.hxx sd/source/ui/sidebar/NavigatorWrapper.hxx sd/source/ui/sidebar/PanelBase.hxx sd/source/ui/sidebar/RecentMasterPagesSelector.cxx sd/source/ui/sidebar/RecentMasterPagesSelector.hxx sd/source/ui/slideshow/showwindow.hxx sd/source/ui/slidesorter/view/SlsInsertAnimator.cxx sd/source/ui/slidesorter/view/SlsLayeredDevice.hxx sd/source/ui/view/ViewShellBase.cxx sd/source/ui/view/drviewsa.cxx sfx2/source/appl/fileobj.hxx sfx2/source/appl/opengrf.cxx sfx2/source/control/thumbnailviewacc.hxx sfx2/source/dialog/securitypage.cxx sfx2/source/dialog/templdlg.cxx sfx2/source/doc/docinsert.cxx sfx2/source/doc/guisaveas.cxx sfx2/source/inc/alienwarn.hxx sfx2/source/sidebar/Deck.cxx sfx2/source/sidebar/Deck.hxx sfx2/source/sidebar/DeckTitleBar.cxx sfx2/source/sidebar/DeckTitleBar.hxx sfx2/source/sidebar/MenuButton.cxx sfx2/source/sidebar/MenuButton.hxx sfx2/source/sidebar/Panel.cxx sfx2/source/sidebar/Panel.hxx sfx2/source/sidebar/PanelTitleBar.hxx sfx2/source/sidebar/SidebarDockingWindow.hxx sfx2/source/sidebar/SidebarToolBox.cxx sfx2/source/sidebar/TabBar.hxx sfx2/source/sidebar/TabItem.cxx sfx2/source/sidebar/TabItem.hxx sfx2/source/sidebar/TitleBar.hxx sfx2/source/toolbox/imgmgr.cxx starmath/inc/edit.hxx starmath/inc/smmod.hxx starmath/qa/cppunit/test_starmath.cxx starmath/source/edit.cxx starmath/source/smmod.cxx svtools/source/brwbox/brwbox1.cxx svtools/source/brwbox/datwin.hxx svtools/source/contnr/fileview.cxx svtools/source/contnr/simptabl.cxx svtools/source/control/filectrl.cxx svtools/source/control/valueimp.hxx svx/inc/GalleryControl.hxx svx/source/dialog/dlgctrl.cxx svx/source/dialog/swframeexample.cxx svx/source/fmcomp/fmgridif.cxx svx/source/gallery2/GalleryControl.cxx svx/source/sidebar/EmptyPanel.hxx svx/source/sidebar/area/AreaPropertyPanel.hxx svx/source/sidebar/area/AreaTransparencyGradientControl.hxx svx/source/sidebar/graphic/GraphicPropertyPanel.hxx svx/source/sidebar/insert/InsertPropertyPanel.cxx svx/source/sidebar/insert/InsertPropertyPanel.hxx svx/source/sidebar/line/LinePropertyPanel.hxx svx/source/sidebar/line/LineWidthControl.cxx svx/source/sidebar/line/LineWidthControl.hxx svx/source/sidebar/line/LineWidthValueSet.hxx svx/source/sidebar/paragraph/ParaPropertyPanel.hxx svx/source/sidebar/possize/SidebarDialControl.cxx svx/source/sidebar/text/TextCharacterSpacingPopup.hxx svx/source/sidebar/text/TextPropertyPanel.hxx svx/source/sidebar/tools/PopupContainer.cxx svx/source/sidebar/tools/PopupControl.cxx svx/source/sidebar/tools/ValueSetWithTextControl.cxx svx/source/svdraw/svdfmtf.hxx svx/source/svdraw/svdibrow.cxx svx/source/tbxctrls/colrctrl.cxx svx/source/tbxctrls/tbcontrl.cxx sw/source/ui/dbui/mmaddressblockpage.cxx sw/source/ui/dialog/uiregionsw.cxx sw/source/ui/index/cnttab.cxx sw/source/uibase/inc/drpcps.hxx sw/source/uibase/sidebar/PageColumnControl.hxx sw/source/uibase/sidebar/PageMarginControl.hxx sw/source/uibase/sidebar/PageOrientationControl.hxx sw/source/uibase/sidebar/PagePropertyPanel.hxx sw/source/uibase/sidebar/PageSizeControl.hxx sw/source/uibase/uiview/view2.cxx sw/source/uibase/utlui/navipi.cxx vcl/inc/svdata.hxx vcl/source/control/combobox.cxx vcl/source/control/lstbox.cxx vcl/source/window/dockwin.cxx vcl/source/window/winproc.cxx Change-Id: I056cf3026ff17d65cca0b6e6588bda4a88fa8d95
Diffstat (limited to 'canvas')
-rw-r--r--canvas/source/cairo/cairo_canvasfont.cxx2
-rw-r--r--canvas/source/cairo/cairo_canvashelper.cxx4
-rw-r--r--canvas/source/cairo/cairo_canvashelper.hxx4
-rw-r--r--canvas/source/cairo/cairo_canvashelper_text.cxx4
-rw-r--r--canvas/source/cairo/cairo_devicehelper.cxx2
-rw-r--r--canvas/source/cairo/cairo_devicehelper.hxx2
-rw-r--r--canvas/source/cairo/cairo_textlayout.cxx10
-rw-r--r--canvas/source/directx/dx_9rm.cxx3
-rw-r--r--canvas/source/directx/dx_devicehelper.cxx6
-rw-r--r--canvas/source/directx/dx_devicehelper.hxx5
-rw-r--r--canvas/source/opengl/ogl_canvashelper.cxx12
-rw-r--r--canvas/source/vcl/backbuffer.cxx12
-rw-r--r--canvas/source/vcl/backbuffer.hxx3
-rw-r--r--canvas/source/vcl/bitmapbackbuffer.cxx7
-rw-r--r--canvas/source/vcl/bitmapbackbuffer.hxx2
-rw-r--r--canvas/source/vcl/canvasfont.cxx6
-rw-r--r--canvas/source/vcl/canvashelper_texturefill.cxx14
-rw-r--r--canvas/source/vcl/impltools.hxx2
-rw-r--r--canvas/source/vcl/spritecanvashelper.cxx10
-rw-r--r--canvas/source/vcl/spritecanvashelper.hxx4
-rw-r--r--canvas/source/vcl/textlayout.cxx26
21 files changed, 81 insertions, 59 deletions
diff --git a/canvas/source/cairo/cairo_canvasfont.cxx b/canvas/source/cairo/cairo_canvasfont.cxx
index 9a2b8650ba54..bdfe3a193e73 100644
--- a/canvas/source/cairo/cairo_canvasfont.cxx
+++ b/canvas/source/cairo/cairo_canvasfont.cxx
@@ -63,7 +63,7 @@ namespace cairocanvas
// adjust to stretched/shrunk font
if( !::rtl::math::approxEqual( rFontMatrix.m00, rFontMatrix.m11) )
{
- OutputDevice* pOutDev( mpRefDevice->getOutputDevice() );
+ VclPtr<OutputDevice> pOutDev( mpRefDevice->getOutputDevice() );
if( pOutDev )
{
diff --git a/canvas/source/cairo/cairo_canvashelper.cxx b/canvas/source/cairo/cairo_canvashelper.cxx
index 6157ea671020..7a918f4b38be 100644
--- a/canvas/source/cairo/cairo_canvashelper.cxx
+++ b/canvas/source/cairo/cairo_canvashelper.cxx
@@ -83,7 +83,7 @@ namespace cairocanvas
{
mpSurface.reset();
mpCairo.reset();
- mpVirtualDevice.reset();
+ mpVirtualDevice.disposeAndClear();
mpDevice = NULL;
mpSurfaceProvider = NULL;
}
@@ -105,7 +105,7 @@ namespace cairocanvas
void CanvasHelper::setSurface( const SurfaceSharedPtr& pSurface, bool bHasAlpha )
{
mbHaveAlpha = bHasAlpha;
- mpVirtualDevice.reset();
+ mpVirtualDevice.disposeAndClear();
mpSurface = pSurface;
mpCairo = pSurface->getCairo();
}
diff --git a/canvas/source/cairo/cairo_canvashelper.hxx b/canvas/source/cairo/cairo_canvashelper.hxx
index b67904d6ebf5..ed6f702a53aa 100644
--- a/canvas/source/cairo/cairo_canvashelper.hxx
+++ b/canvas/source/cairo/cairo_canvashelper.hxx
@@ -28,6 +28,8 @@
#include <basegfx/vector/b2dsize.hxx>
#include <com/sun/star/rendering/XLinePolyPolygon2D.hpp>
+#include <vcl/vclptr.hxx>
+#include <vcl/virdev.hxx>
#include <boost/utility.hpp>
#include <vcl/cairo.hxx>
@@ -269,7 +271,7 @@ namespace cairocanvas
private:
- boost::shared_ptr<VirtualDevice> mpVirtualDevice;
+ VclPtr<VirtualDevice> mpVirtualDevice;
void useStates( const ::com::sun::star::rendering::ViewState& viewState,
const ::com::sun::star::rendering::RenderState& renderState,
diff --git a/canvas/source/cairo/cairo_canvashelper_text.cxx b/canvas/source/cairo/cairo_canvashelper_text.cxx
index f3c4c05083c3..2a98ea7b6e09 100644
--- a/canvas/source/cairo/cairo_canvashelper_text.cxx
+++ b/canvas/source/cairo/cairo_canvashelper_text.cxx
@@ -175,7 +175,7 @@ namespace cairocanvas
class DeviceSettingsGuard
{
private:
- OutputDevice *mpVirtualDevice;
+ VclPtr<OutputDevice> mpVirtualDevice;
cairo_t *mpCairo;
bool mbMappingWasEnabled;
public:
@@ -272,7 +272,7 @@ namespace cairocanvas
cairo_fill(mpCairo.get());
#endif
::Point aOutpos;
- if( !setupTextOutput( *mpVirtualDevice, pOwner, aOutpos, viewState, renderState, xFont ) )
+ if( !setupTextOutput( *mpVirtualDevice.get(), pOwner, aOutpos, viewState, renderState, xFont ) )
return uno::Reference< rendering::XCachedPrimitive >(NULL); // no output necessary
// change text direction and layout mode
diff --git a/canvas/source/cairo/cairo_devicehelper.cxx b/canvas/source/cairo/cairo_devicehelper.cxx
index 9e7ba2e13ca5..684b61afcf2c 100644
--- a/canvas/source/cairo/cairo_devicehelper.cxx
+++ b/canvas/source/cairo/cairo_devicehelper.cxx
@@ -209,7 +209,7 @@ namespace cairocanvas
uno::Any DeviceHelper::getDeviceHandle() const
{
- return uno::makeAny( reinterpret_cast< sal_Int64 >(mpRefDevice) );
+ return uno::makeAny( reinterpret_cast< sal_Int64 >(mpRefDevice.get()) );
}
uno::Any DeviceHelper::getSurfaceHandle() const
diff --git a/canvas/source/cairo/cairo_devicehelper.hxx b/canvas/source/cairo/cairo_devicehelper.hxx
index 81f71810d61d..eafc5065e10b 100644
--- a/canvas/source/cairo/cairo_devicehelper.hxx
+++ b/canvas/source/cairo/cairo_devicehelper.hxx
@@ -116,7 +116,7 @@ namespace cairocanvas
*/
SurfaceProvider* mpSurfaceProvider;
- OutputDevice* mpRefDevice;
+ VclPtr<OutputDevice> mpRefDevice;
::cairo::SurfaceSharedPtr mpSurface;
};
}
diff --git a/canvas/source/cairo/cairo_textlayout.cxx b/canvas/source/cairo/cairo_textlayout.cxx
index f5a197846e72..03d319473e7c 100644
--- a/canvas/source/cairo/cairo_textlayout.cxx
+++ b/canvas/source/cairo/cairo_textlayout.cxx
@@ -179,14 +179,14 @@ namespace cairocanvas
if( !pOutDev )
return geometry::RealRectangle2D();
- VirtualDevice aVDev( *pOutDev );
- aVDev.SetFont( mpFont->getVCLFont() );
+ ScopedVclPtrInstance< VirtualDevice > pVDev( *pOutDev );
+ pVDev->SetFont( mpFont->getVCLFont() );
// need metrics for Y offset, the XCanvas always renders
// relative to baseline
- const ::FontMetric& aMetric( aVDev.GetFontMetric() );
+ const ::FontMetric& aMetric( pVDev->GetFontMetric() );
- setupLayoutMode( aVDev, mnTextDirection );
+ setupLayoutMode( *pVDev.get(), mnTextDirection );
const sal_Int32 nAboveBaseline( -aMetric.GetIntLeading() - aMetric.GetAscent() );
const sal_Int32 nBelowBaseline( aMetric.GetDescent() );
@@ -200,7 +200,7 @@ namespace cairocanvas
else
{
return geometry::RealRectangle2D( 0, nAboveBaseline,
- aVDev.GetTextWidth(
+ pVDev->GetTextWidth(
maText.Text,
::canvas::tools::numeric_cast<sal_uInt16>(maText.StartPosition),
::canvas::tools::numeric_cast<sal_uInt16>(maText.Length) ),
diff --git a/canvas/source/directx/dx_9rm.cxx b/canvas/source/directx/dx_9rm.cxx
index b9ee8833a769..34e393897839 100644
--- a/canvas/source/directx/dx_9rm.cxx
+++ b/canvas/source/directx/dx_9rm.cxx
@@ -666,7 +666,8 @@ namespace dxcanvas
maVertexCache.reserve(1024);
mpWindow.reset(
- new SystemChildWindow(
+ VclPtr<SystemChildWindow>::Create(
+
const_cast<vcl::Window *>(&rWindow), 0) );
// system child window must not receive mouse events
diff --git a/canvas/source/directx/dx_devicehelper.cxx b/canvas/source/directx/dx_devicehelper.cxx
index cc824719c3d7..759bb0b70f17 100644
--- a/canvas/source/directx/dx_devicehelper.cxx
+++ b/canvas/source/directx/dx_devicehelper.cxx
@@ -52,6 +52,10 @@ namespace dxcanvas
{
}
+ DeviceHelper::~DeviceHelper()
+ {
+ }
+
void DeviceHelper::init( HDC hdc, OutputDevice* pOutDev,
rendering::XGraphicDevice& rDevice )
{
@@ -191,7 +195,7 @@ namespace dxcanvas
uno::Any DeviceHelper::getDeviceHandle() const
{
- return uno::makeAny( reinterpret_cast< sal_Int64 >(mpOutDev) );
+ return uno::makeAny( reinterpret_cast< sal_Int64 >(mpOutDev.get()) );
}
uno::Any DeviceHelper::getSurfaceHandle() const
diff --git a/canvas/source/directx/dx_devicehelper.hxx b/canvas/source/directx/dx_devicehelper.hxx
index bb455c3cc916..cdf1e943243e 100644
--- a/canvas/source/directx/dx_devicehelper.hxx
+++ b/canvas/source/directx/dx_devicehelper.hxx
@@ -28,7 +28,7 @@
#include "dx_bitmap.hxx"
#include <canvas/rendering/isurfaceproxymanager.hxx>
-
+#include <vcl/vclptr.hxx>
#include <boost/utility.hpp>
class OutputDevice;
@@ -40,6 +40,7 @@ namespace dxcanvas
{
public:
DeviceHelper();
+ ~DeviceHelper();
/** Init the device helper
@@ -105,7 +106,7 @@ namespace dxcanvas
*/
com::sun::star::rendering::XGraphicDevice* mpDevice;
HDC mnHDC;
- OutputDevice* mpOutDev;
+ VclPtr<OutputDevice> mpOutDev;
};
typedef ::rtl::Reference< com::sun::star::rendering::XGraphicDevice > DeviceRef;
diff --git a/canvas/source/opengl/ogl_canvashelper.cxx b/canvas/source/opengl/ogl_canvashelper.cxx
index f6d641f8bb2b..501e7f83fe6b 100644
--- a/canvas/source/opengl/ogl_canvashelper.cxx
+++ b/canvas/source/opengl/ogl_canvashelper.cxx
@@ -725,8 +725,8 @@ namespace oglcanvas
if( mpDevice )
{
- VirtualDevice aVDev;
- aVDev.EnableOutput(false);
+ ScopedVclPtrInstance< VirtualDevice > pVDev;
+ pVDev->EnableOutput(false);
CanvasFont* pFont=dynamic_cast<CanvasFont*>(xLayoutetText->getFont().get());
const rendering::StringContext& rTxt=xLayoutetText->getText();
@@ -749,7 +749,7 @@ namespace oglcanvas
// adjust to stretched font
if(!::rtl::math::approxEqual(rFontMatrix.m00, rFontMatrix.m11))
{
- const Size aSize = aVDev.GetFontMetric( aFont ).GetSize();
+ const Size aSize = pVDev->GetFontMetric( aFont ).GetSize();
const double fDividend( rFontMatrix.m10 + rFontMatrix.m11 );
double fStretch = (rFontMatrix.m00 + rFontMatrix.m01);
@@ -762,7 +762,7 @@ namespace oglcanvas
}
// set font
- aVDev.SetFont(aFont);
+ pVDev->SetFont(aFont);
mpRecordedActions->push_back( Action() );
Action& rAct=mpRecordedActions->back();
@@ -780,7 +780,7 @@ namespace oglcanvas
pDXArray[i] = basegfx::fround( aLogicalAdvancements[i] );
// get the glyphs
- aVDev.GetTextOutlines(rAct.maPolyPolys,
+ pVDev->GetTextOutlines(rAct.maPolyPolys,
rTxt.Text,
0,
rTxt.StartPosition,
@@ -792,7 +792,7 @@ namespace oglcanvas
else
{
// get the glyphs
- aVDev.GetTextOutlines(rAct.maPolyPolys,
+ pVDev->GetTextOutlines(rAct.maPolyPolys,
rTxt.Text,
0,
rTxt.StartPosition,
diff --git a/canvas/source/vcl/backbuffer.cxx b/canvas/source/vcl/backbuffer.cxx
index 73d6320fcba5..356caa9254e7 100644
--- a/canvas/source/vcl/backbuffer.cxx
+++ b/canvas/source/vcl/backbuffer.cxx
@@ -25,7 +25,7 @@ namespace vclcanvas
{
BackBuffer::BackBuffer( const OutputDevice& rRefDevice,
bool bMonochromeBuffer ) :
- maVDev( new VirtualDevice( rRefDevice,
+ maVDev( VclPtr<VirtualDevice>::Create( rRefDevice,
sal_uInt16(bMonochromeBuffer) ) )
{
if( !bMonochromeBuffer )
@@ -43,14 +43,20 @@ namespace vclcanvas
}
}
+ BackBuffer::~BackBuffer()
+ {
+ SolarMutexGuard aGuard;
+ maVDev.disposeAndClear();
+ }
+
OutputDevice& BackBuffer::getOutDev()
{
- return maVDev.get();
+ return *maVDev.get();
}
const OutputDevice& BackBuffer::getOutDev() const
{
- return maVDev.get();
+ return *maVDev.get();
}
void BackBuffer::setSize( const ::Size& rNewSize )
diff --git a/canvas/source/vcl/backbuffer.hxx b/canvas/source/vcl/backbuffer.hxx
index 0fea559876dd..0beeda2e0467 100644
--- a/canvas/source/vcl/backbuffer.hxx
+++ b/canvas/source/vcl/backbuffer.hxx
@@ -43,6 +43,7 @@ namespace vclcanvas
*/
BackBuffer( const OutputDevice& rRefDevice,
bool bMonochromeBuffer=false );
+ virtual ~BackBuffer();
virtual OutputDevice& getOutDev() SAL_OVERRIDE;
virtual const OutputDevice& getOutDev() const SAL_OVERRIDE;
@@ -50,7 +51,7 @@ namespace vclcanvas
void setSize( const ::Size& rNewSize );
private:
- ::canvas::vcltools::VCLObject<VirtualDevice> maVDev;
+ VclPtr< VirtualDevice > maVDev;
};
typedef ::boost::shared_ptr< BackBuffer > BackBufferSharedPtr;
diff --git a/canvas/source/vcl/bitmapbackbuffer.cxx b/canvas/source/vcl/bitmapbackbuffer.cxx
index d140ea002a10..bd01d71b5c54 100644
--- a/canvas/source/vcl/bitmapbackbuffer.cxx
+++ b/canvas/source/vcl/bitmapbackbuffer.cxx
@@ -45,8 +45,7 @@ namespace vclcanvas
// are supposed to be called with already locked solar mutex)
SolarMutexGuard aGuard;
- if( mpVDev )
- delete mpVDev;
+ mpVDev.disposeAndClear();
}
OutputDevice& BitmapBackBuffer::getOutDev()
@@ -113,8 +112,8 @@ namespace vclcanvas
// VDev not yet created, do it now. Create an alpha-VDev,
// if bitmap has transparency.
mpVDev = maBitmap->IsTransparent() ?
- new VirtualDevice( mrRefDevice, 0, 0 ) :
- new VirtualDevice( mrRefDevice );
+ VclPtr<VirtualDevice>::Create( mrRefDevice, 0, 0 ) :
+ VclPtr<VirtualDevice>::Create( mrRefDevice );
OSL_ENSURE( mpVDev,
"BitmapBackBuffer::createVDev(): Unable to create VirtualDevice" );
diff --git a/canvas/source/vcl/bitmapbackbuffer.hxx b/canvas/source/vcl/bitmapbackbuffer.hxx
index c3f2a27a7ba7..b51867994a68 100644
--- a/canvas/source/vcl/bitmapbackbuffer.hxx
+++ b/canvas/source/vcl/bitmapbackbuffer.hxx
@@ -66,7 +66,7 @@ namespace vclcanvas
void updateVDev() const;
::canvas::vcltools::VCLObject<BitmapEx> maBitmap;
- mutable VirtualDevice* mpVDev; // created only on demand
+ mutable VclPtr<VirtualDevice> mpVDev; // created only on demand
const OutputDevice& mrRefDevice;
diff --git a/canvas/source/vcl/canvasfont.cxx b/canvas/source/vcl/canvasfont.cxx
index 5477ea6bb257..6c4437da1205 100644
--- a/canvas/source/vcl/canvasfont.cxx
+++ b/canvas/source/vcl/canvasfont.cxx
@@ -121,9 +121,9 @@ namespace vclcanvas
SolarMutexGuard aGuard;
OutputDevice& rOutDev = mpOutDevProvider->getOutDev();
- VirtualDevice aVDev( rOutDev );
- aVDev.SetFont(getVCLFont());
- const ::FontMetric& aMetric( aVDev.GetFontMetric() );
+ ScopedVclPtrInstance< VirtualDevice > pVDev( rOutDev );
+ pVDev->SetFont(getVCLFont());
+ const ::FontMetric& aMetric( pVDev->GetFontMetric() );
return rendering::FontMetrics(
aMetric.GetAscent(),
diff --git a/canvas/source/vcl/canvashelper_texturefill.cxx b/canvas/source/vcl/canvashelper_texturefill.cxx
index f57e49812acc..b46746e2cf8b 100644
--- a/canvas/source/vcl/canvashelper_texturefill.cxx
+++ b/canvas/source/vcl/canvashelper_texturefill.cxx
@@ -1026,8 +1026,8 @@ namespace vclcanvas
// cannot do direct XOR, but have to
// prepare the filled polygon within a
// VDev
- VirtualDevice aVDev( rOutDev );
- aVDev.SetOutputSizePixel( aPolygonDeviceRect.GetSize() );
+ ScopedVclPtrInstance< VirtualDevice > pVDev( rOutDev );
+ pVDev->SetOutputSizePixel( aPolygonDeviceRect.GetSize() );
// shift output to origin of VDev
const ::Point aOutPos( aPt - aPolygonDeviceRect.TopLeft() );
@@ -1036,8 +1036,8 @@ namespace vclcanvas
const vcl::Region aPolyClipRegion( aPolyPoly );
- aVDev.SetClipRegion( aPolyClipRegion );
- textureFill( aVDev,
+ pVDev->SetClipRegion( aPolyClipRegion );
+ textureFill( *pVDev.get(),
*pGrfObj,
aOutPos,
aIntegerNextTileX,
@@ -1051,12 +1051,12 @@ namespace vclcanvas
// target position.
const ::Point aEmptyPoint;
Bitmap aContentBmp(
- aVDev.GetBitmap( aEmptyPoint,
- aVDev.GetOutputSizePixel() ) );
+ pVDev->GetBitmap( aEmptyPoint,
+ pVDev->GetOutputSizePixel() ) );
sal_uInt8 nCol( static_cast< sal_uInt8 >(
::basegfx::fround( 255.0*( 1.0 - textures[0].Alpha ) ) ) );
- AlphaMask aAlpha( aVDev.GetOutputSizePixel(),
+ AlphaMask aAlpha( pVDev->GetOutputSizePixel(),
&nCol );
BitmapEx aOutputBmpEx( aContentBmp, aAlpha );
diff --git a/canvas/source/vcl/impltools.hxx b/canvas/source/vcl/impltools.hxx
index 059495523db0..c294efd89ae7 100644
--- a/canvas/source/vcl/impltools.hxx
+++ b/canvas/source/vcl/impltools.hxx
@@ -158,7 +158,7 @@ namespace vclcanvas
}
}
- OutputDevice* mpOutDev;
+ VclPtr<OutputDevice> mpOutDev;
const bool mbMappingWasEnabled;
const sal_uInt16 mnAntiAliasing;
};
diff --git a/canvas/source/vcl/spritecanvashelper.cxx b/canvas/source/vcl/spritecanvashelper.cxx
index 682950534135..51a234feca1c 100644
--- a/canvas/source/vcl/spritecanvashelper.cxx
+++ b/canvas/source/vcl/spritecanvashelper.cxx
@@ -189,6 +189,12 @@ namespace vclcanvas
#endif
}
+ SpriteCanvasHelper::~SpriteCanvasHelper()
+ {
+ SolarMutexGuard aGuard;
+ maVDev.disposeAndClear();
+ }
+
void SpriteCanvasHelper::init( const OutDevProviderSharedPtr& rOutDev,
SpriteCanvas& rOwningSpriteCanvas,
::canvas::SpriteRedrawManager& rManager,
@@ -318,7 +324,7 @@ namespace vclcanvas
mpRedrawManager->forEachSprite(
::boost::bind(
&spriteRedraw,
- ::boost::ref( maVDev.get() ),
+ ::boost::ref( *maVDev.get() ),
_1 ) );
// flush to screen
@@ -576,7 +582,7 @@ namespace vclcanvas
::std::for_each( rSortedUpdateSprites.begin(),
rSortedUpdateSprites.end(),
::boost::bind( &spriteRedrawStub2,
- ::boost::ref( maVDev.get() ),
+ ::boost::ref( *maVDev.get() ),
::vcl::unotools::b2DPointFromPoint(
aOutputPosition),
_1 ) );
diff --git a/canvas/source/vcl/spritecanvashelper.hxx b/canvas/source/vcl/spritecanvashelper.hxx
index dc165d460296..a6b3c0393c8a 100644
--- a/canvas/source/vcl/spritecanvashelper.hxx
+++ b/canvas/source/vcl/spritecanvashelper.hxx
@@ -23,6 +23,7 @@
#include <com/sun/star/rendering/XSpriteCanvas.hpp>
#include <com/sun/star/rendering/XIntegerBitmap.hpp>
+#include <vcl/vclptr.hxx>
#include <vcl/virdev.hxx>
#include <canvas/spriteredrawmanager.hxx>
@@ -40,6 +41,7 @@ namespace vclcanvas
{
public:
SpriteCanvasHelper();
+ ~SpriteCanvasHelper();
void init( const OutDevProviderSharedPtr& rOutDev,
SpriteCanvas& rOwningSpriteCanvas,
@@ -150,7 +152,7 @@ namespace vclcanvas
Typically, sprites will be composited in the background,
before pushing them to screen. This happens here.
*/
- ::canvas::vcltools::VCLObject< VirtualDevice > maVDev;
+ VclPtr< VirtualDevice > maVDev;
/// For the frame counter timings
::canvas::tools::ElapsedTime maLastUpdate;
diff --git a/canvas/source/vcl/textlayout.cxx b/canvas/source/vcl/textlayout.cxx
index d64f7dfa7fb7..6cf534220e26 100644
--- a/canvas/source/vcl/textlayout.cxx
+++ b/canvas/source/vcl/textlayout.cxx
@@ -104,10 +104,10 @@ namespace vclcanvas
SolarMutexGuard aGuard;
OutputDevice& rOutDev = mpOutDevProvider->getOutDev();
- VirtualDevice aVDev( rOutDev );
- aVDev.SetFont( mpFont->getVCLFont() );
+ ScopedVclPtrInstance< VirtualDevice > pVDev( rOutDev );
+ pVDev->SetFont( mpFont->getVCLFont() );
- setupLayoutMode( aVDev, mnTextDirection );
+ setupLayoutMode( *pVDev.get(), mnTextDirection );
const rendering::ViewState aViewState(
geometry::AffineMatrix2D(1,0,0, 0,1,0),
@@ -124,7 +124,7 @@ namespace vclcanvas
uno::Sequence< uno::Reference< rendering::XPolyPolygon2D> > aOutlineSequence;
::basegfx::B2DPolyPolygonVector aOutlines;
- if (aVDev.GetTextOutlines(
+ if (pVDev->GetTextOutlines(
aOutlines,
maText.Text,
maText.StartPosition,
@@ -157,10 +157,10 @@ namespace vclcanvas
OutputDevice& rOutDev = mpOutDevProvider->getOutDev();
- VirtualDevice aVDev( rOutDev );
- aVDev.SetFont( mpFont->getVCLFont() );
+ ScopedVclPtrInstance< VirtualDevice > pVDev( rOutDev );
+ pVDev->SetFont( mpFont->getVCLFont() );
- setupLayoutMode( aVDev, mnTextDirection );
+ setupLayoutMode( *pVDev.get(), mnTextDirection );
const rendering::ViewState aViewState(
geometry::AffineMatrix2D(1,0,0, 0,1,0),
@@ -177,7 +177,7 @@ namespace vclcanvas
MetricVector aMetricVector;
uno::Sequence<geometry::RealRectangle2D> aBoundingBoxes;
- if (aVDev.GetGlyphBoundRects(
+ if (pVDev->GetGlyphBoundRects(
Point(0,0),
maText.Text,
::canvas::tools::numeric_cast<sal_uInt16>(maText.StartPosition),
@@ -237,14 +237,14 @@ namespace vclcanvas
OutputDevice& rOutDev = mpOutDevProvider->getOutDev();
- VirtualDevice aVDev( rOutDev );
- aVDev.SetFont( mpFont->getVCLFont() );
+ ScopedVclPtrInstance< VirtualDevice > pVDev( rOutDev );
+ pVDev->SetFont( mpFont->getVCLFont() );
// need metrics for Y offset, the XCanvas always renders
// relative to baseline
- const ::FontMetric& aMetric( aVDev.GetFontMetric() );
+ const ::FontMetric& aMetric( pVDev->GetFontMetric() );
- setupLayoutMode( aVDev, mnTextDirection );
+ setupLayoutMode( *pVDev.get(), mnTextDirection );
const sal_Int32 nAboveBaseline( /*-aMetric.GetIntLeading()*/ - aMetric.GetAscent() );
const sal_Int32 nBelowBaseline( aMetric.GetDescent() );
@@ -258,7 +258,7 @@ namespace vclcanvas
else
{
return geometry::RealRectangle2D( 0, nAboveBaseline,
- aVDev.GetTextWidth(
+ pVDev->GetTextWidth(
maText.Text,
::canvas::tools::numeric_cast<sal_uInt16>(maText.StartPosition),
::canvas::tools::numeric_cast<sal_uInt16>(maText.Length) ),