summaryrefslogtreecommitdiff
path: root/canvas
diff options
context:
space:
mode:
authorMichael Meeks <michael.meeks@collabora.com>2015-03-19 14:45:20 +0000
committerMichael Meeks <michael.meeks@collabora.com>2015-04-10 12:15:05 +0100
commiteac22a0630bcf3780142f64a022fa432e13bb7e1 (patch)
tree303b3dd00dea373d12198ed3c07b02679e7b8718 /canvas
parent057347dad41f7df3222cc483fdff83fa631606bb (diff)
Fix OutputDevice members / stack allocation: chart, canvas, cui.
Change-Id: Ieb6f58222ffc3e03c1d599752a6f02600e1bee1f
Diffstat (limited to 'canvas')
-rw-r--r--canvas/source/cairo/cairo_textlayout.cxx10
-rw-r--r--canvas/source/opengl/ogl_canvashelper.cxx12
-rw-r--r--canvas/source/vcl/canvasfont.cxx6
-rw-r--r--canvas/source/vcl/canvashelper_texturefill.cxx14
-rw-r--r--canvas/source/vcl/textlayout.cxx26
5 files changed, 34 insertions, 34 deletions
diff --git a/canvas/source/cairo/cairo_textlayout.cxx b/canvas/source/cairo/cairo_textlayout.cxx
index f5a197846e72..dd428a17af09 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() );
+ ScopedVclPtr<VirtualDevice> pVDev( new VirtualDevice( *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/opengl/ogl_canvashelper.cxx b/canvas/source/opengl/ogl_canvashelper.cxx
index f6d641f8bb2b..6a75c8f9144c 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);
+ ScopedVclPtr<VirtualDevice> pVDev(new VirtualDevice());
+ 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/canvasfont.cxx b/canvas/source/vcl/canvasfont.cxx
index a7e6f48b9306..8930748af984 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() );
+ ScopedVclPtr<VirtualDevice> pVDev( new VirtualDevice( 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..ea7889042465 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() );
+ ScopedVclPtr<VirtualDevice> pVDev( new VirtualDevice( 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/textlayout.cxx b/canvas/source/vcl/textlayout.cxx
index d64f7dfa7fb7..c3efe7745053 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() );
+ ScopedVclPtr<VirtualDevice> pVDev( new VirtualDevice( 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() );
+ ScopedVclPtr<VirtualDevice> pVDev( new VirtualDevice( 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() );
+ ScopedVclPtr<VirtualDevice> pVDev( new VirtualDevice( 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) ),