diff options
author | Caolán McNamara <caolanm@redhat.com> | 2015-11-17 13:03:23 +0000 |
---|---|---|
committer | Caolán McNamara <caolanm@redhat.com> | 2015-11-23 14:25:59 +0000 |
commit | c43a3a58677b467274ce6c21d7db1a6c0cc65cb4 (patch) | |
tree | 3bb61dc498bd5ff72df4be4e0003ab284b0cc655 /canvas | |
parent | b0f5416d7ee7c988d316df7ffa0318fa6514e4de (diff) |
establish that Virtual Devices either match Physical Device depth or ...
are 1 or (rarely) 8 bit and lock that down.
Change-Id: I3d946ebef34ffb71c5adea7aa420af50e9584e05
Diffstat (limited to 'canvas')
-rw-r--r-- | canvas/source/directx/dx_textlayout_drawhelper.cxx | 28 | ||||
-rw-r--r-- | canvas/source/vcl/backbuffer.cxx | 2 | ||||
-rw-r--r-- | canvas/source/vcl/bitmapbackbuffer.cxx | 2 |
3 files changed, 16 insertions, 16 deletions
diff --git a/canvas/source/directx/dx_textlayout_drawhelper.cxx b/canvas/source/directx/dx_textlayout_drawhelper.cxx index 3db3996b9013..574a9693c021 100644 --- a/canvas/source/directx/dx_textlayout_drawhelper.cxx +++ b/canvas/source/directx/dx_textlayout_drawhelper.cxx @@ -84,12 +84,12 @@ namespace dxcanvas SystemGraphicsData aSystemGraphicsData; aSystemGraphicsData.nSize = sizeof(SystemGraphicsData); aSystemGraphicsData.hDC = reinterpret_cast< ::HDC >(hdc); - VirtualDevice aVirtualDevice(&aSystemGraphicsData, Size(1, 1), 0); + ScopedVclPtrInstance<VirtualDevice> xVirtualDevice(&aSystemGraphicsData, Size(1, 1), DeviceFormat::FULLCOLOR); // disable font antialiasing - GDI does not handle alpha // surfaces properly. if( bAlphaSurface ) - aVirtualDevice.SetAntialiasing(AntialiasingFlags::DisableText); + xVirtualDevice->SetAntialiasing(AntialiasingFlags::DisableText); if(rText.Length) { @@ -105,7 +105,7 @@ namespace dxcanvas rRenderState.DeviceColor, mxGraphicDevice->getDeviceColorSpace()); aColor.SetTransparency(0); - aVirtualDevice.SetTextColor(aColor); + xVirtualDevice->SetTextColor(aColor); // create the font const css::rendering::FontRequest& rFontRequest = rCanvasFont->getFontRequest(); @@ -132,7 +132,7 @@ namespace dxcanvas // adjust to stretched font if(!::rtl::math::approxEqual(rFontMatrix.m00, rFontMatrix.m11)) { - const Size aSize = aVirtualDevice.GetFontMetric( aFont ).GetSize(); + const Size aSize = xVirtualDevice->GetFontMetric( aFont ).GetSize(); const double fDividend( rFontMatrix.m10 + rFontMatrix.m11 ); double fStretch = (rFontMatrix.m00 + rFontMatrix.m01); @@ -145,7 +145,7 @@ namespace dxcanvas } // set font - aVirtualDevice.SetFont(aFont); + xVirtualDevice->SetFont(aFont); // create world transformation matrix ::basegfx::B2DHomMatrix aWorldTransform; @@ -170,7 +170,7 @@ namespace dxcanvas aClipPoly.transform(aMatrix); const vcl::Region& rClipRegion = vcl::Region(::tools::PolyPolygon(aClipPoly)); - aVirtualDevice.IntersectClipRegion(rClipRegion); + xVirtualDevice->IntersectClipRegion(rClipRegion); } if(rRenderState.Clip.is()) @@ -178,7 +178,7 @@ namespace dxcanvas ::basegfx::B2DPolyPolygon aClipPoly(dxcanvas::tools::polyPolygonFromXPolyPolygon2D(rRenderState.Clip)); aClipPoly.transform(aWorldTransform); const vcl::Region& rClipRegion = vcl::Region(::tools::PolyPolygon(aClipPoly)); - aVirtualDevice.IntersectClipRegion(rClipRegion); + xVirtualDevice->IntersectClipRegion(rClipRegion); } // set world transform @@ -210,7 +210,7 @@ namespace dxcanvas pDXArray[i] = basegfx::fround( rLogicalAdvancements[i] ); // draw the String - aVirtualDevice.DrawTextArray( aEmptyPoint, + xVirtualDevice->DrawTextArray( aEmptyPoint, aText, pDXArray.get(), rText.StartPosition, @@ -219,7 +219,7 @@ namespace dxcanvas else { // draw the String - aVirtualDevice.DrawText( aEmptyPoint, + xVirtualDevice->DrawText( aEmptyPoint, aText, rText.StartPosition, rText.Length ); @@ -240,7 +240,7 @@ namespace dxcanvas SystemGraphicsData aSystemGraphicsData; aSystemGraphicsData.nSize = sizeof(SystemGraphicsData); aSystemGraphicsData.hDC = reinterpret_cast< ::HDC >(GetDC( NULL )); - VirtualDevice aVirtualDevice(&aSystemGraphicsData, Size(1, 1), 0); + ScopedVclPtrInstance<VirtualDevice> xVirtualDevice(&aSystemGraphicsData, Size(1, 1), DeviceFormat::FULLCOLOR); // create the font const css::rendering::FontRequest& rFontRequest = rCanvasFont->getFontRequest(); @@ -261,7 +261,7 @@ namespace dxcanvas // adjust to stretched font if(!::rtl::math::approxEqual(rFontMatrix.m00, rFontMatrix.m11)) { - const Size aSize = aVirtualDevice.GetFontMetric( aFont ).GetSize(); + const Size aSize = xVirtualDevice->GetFontMetric( aFont ).GetSize(); const double fDividend( rFontMatrix.m10 + rFontMatrix.m11 ); double fStretch = (rFontMatrix.m00 + rFontMatrix.m01); @@ -274,11 +274,11 @@ namespace dxcanvas } // set font - aVirtualDevice.SetFont(aFont); + xVirtualDevice->SetFont(aFont); // need metrics for Y offset, the XCanvas always renders // relative to baseline - const ::FontMetric& aMetric( aVirtualDevice.GetFontMetric() ); + const ::FontMetric& aMetric( xVirtualDevice->GetFontMetric() ); const sal_Int32 nAboveBaseline( -aMetric.GetIntLeading() - aMetric.GetAscent() ); const sal_Int32 nBelowBaseline( aMetric.GetDescent() ); @@ -292,7 +292,7 @@ namespace dxcanvas else { return geometry::RealRectangle2D( 0, nAboveBaseline, - aVirtualDevice.GetTextWidth( + xVirtualDevice->GetTextWidth( rText.Text, ::canvas::tools::numeric_cast<sal_uInt16>(rText.StartPosition), ::canvas::tools::numeric_cast<sal_uInt16>(rText.Length) ), diff --git a/canvas/source/vcl/backbuffer.cxx b/canvas/source/vcl/backbuffer.cxx index 64ddc4442d3f..39a1b67af240 100644 --- a/canvas/source/vcl/backbuffer.cxx +++ b/canvas/source/vcl/backbuffer.cxx @@ -27,7 +27,7 @@ namespace vclcanvas BackBuffer::BackBuffer( const OutputDevice& rRefDevice, bool bMonochromeBuffer ) : maVDev( VclPtr<VirtualDevice>::Create( rRefDevice, - sal_uInt16(bMonochromeBuffer) ) ) + bMonochromeBuffer ? DeviceFormat::BITMASK : DeviceFormat::FULLCOLOR ) ) { if( !bMonochromeBuffer ) { diff --git a/canvas/source/vcl/bitmapbackbuffer.cxx b/canvas/source/vcl/bitmapbackbuffer.cxx index 3f7fdd0b27c3..1fb22b04cb85 100644 --- a/canvas/source/vcl/bitmapbackbuffer.cxx +++ b/canvas/source/vcl/bitmapbackbuffer.cxx @@ -112,7 +112,7 @@ namespace vclcanvas // VDev not yet created, do it now. Create an alpha-VDev, // if bitmap has transparency. mpVDev = maBitmap->IsTransparent() ? - VclPtr<VirtualDevice>::Create( mrRefDevice, 0, 0 ) : + VclPtr<VirtualDevice>::Create( mrRefDevice, DeviceFormat::FULLCOLOR, DeviceFormat::FULLCOLOR ) : VclPtr<VirtualDevice>::Create( mrRefDevice ); OSL_ENSURE( mpVDev, |