From f466b08d9349719cf003c65c2f124e06048896ac Mon Sep 17 00:00:00 2001 From: Kurt Zenker Date: Tue, 24 Jun 2008 09:56:59 +0000 Subject: INTEGRATION: CWS canvas05 (1.8.68); FILE MERGED 2008/04/21 07:28:37 thb 1.8.68.2: RESYNC: (1.8-1.9); FILE MERGED 2007/12/20 22:18:59 thb 1.8.68.1: #i81092# #i78888# #i78925# #i79258# #i79437# #i84784# Large canvas rework, completing various areas such as color spaces, bitmap data access, true sprite and non-sprite implementations, and upstreaming the canvas parts of rodos emf+ rendering --- canvas/source/vcl/canvasfont.cxx | 37 +++++++++++++++++++------------------ 1 file changed, 19 insertions(+), 18 deletions(-) (limited to 'canvas') diff --git a/canvas/source/vcl/canvasfont.cxx b/canvas/source/vcl/canvasfont.cxx index 51fd4da72b6e..9fb69875ecde 100644 --- a/canvas/source/vcl/canvasfont.cxx +++ b/canvas/source/vcl/canvasfont.cxx @@ -7,7 +7,7 @@ * OpenOffice.org - a multi-platform office productivity suite * * $RCSfile: canvasfont.cxx,v $ - * $Revision: 1.9 $ + * $Revision: 1.10 $ * * This file is part of OpenOffice.org. * @@ -49,13 +49,15 @@ namespace vclcanvas CanvasFont::CanvasFont( const rendering::FontRequest& rFontRequest, const uno::Sequence< beans::PropertyValue >& , const geometry::Matrix2D& rFontMatrix, - const DeviceRef& rDevice ) : + rendering::XGraphicDevice& rDevice, + const OutDevProviderSharedPtr& rOutDevProvider ) : CanvasFont_Base( m_aMutex ), maFont( Font( rFontRequest.FontDescription.FamilyName, rFontRequest.FontDescription.StyleName, Size( 0, ::basegfx::fround(rFontRequest.CellSize) ) ) ), maFontRequest( rFontRequest ), - mpRefDevice( rDevice ) + mpRefDevice( &rDevice ), + mpOutDevProvider( rOutDevProvider ) { maFont->SetAlign( ALIGN_BASELINE ); maFont->SetCharSet( (rFontRequest.FontDescription.IsSymbolFont==com::sun::star::util::TriState_YES) ? RTL_TEXTENCODING_SYMBOL : RTL_TEXTENCODING_UNICODE ); @@ -68,27 +70,24 @@ namespace vclcanvas // adjust to stretched/shrinked font if( !::rtl::math::approxEqual( rFontMatrix.m00, rFontMatrix.m11) ) { - OutputDevice* pOutDev( mpRefDevice->getOutDev() ); + OutputDevice& rOutDev( rOutDevProvider->getOutDev() ); - if( pOutDev ) - { - const bool bOldMapState( pOutDev->IsMapModeEnabled() ); - pOutDev->EnableMapMode(FALSE); + const bool bOldMapState( rOutDev.IsMapModeEnabled() ); + rOutDev.EnableMapMode(FALSE); - const Size aSize = pOutDev->GetFontMetric( *maFont ).GetSize(); + const Size aSize = rOutDev.GetFontMetric( *maFont ).GetSize(); - const double fDividend( rFontMatrix.m10 + rFontMatrix.m11 ); - double fStretch = (rFontMatrix.m00 + rFontMatrix.m01); + const double fDividend( rFontMatrix.m10 + rFontMatrix.m11 ); + double fStretch = (rFontMatrix.m00 + rFontMatrix.m01); - if( !::basegfx::fTools::equalZero( fDividend) ) - fStretch /= fDividend; + if( !::basegfx::fTools::equalZero( fDividend) ) + fStretch /= fDividend; - const long nNewWidth = ::basegfx::fround( aSize.Width() * fStretch ); + const long nNewWidth = ::basegfx::fround( aSize.Width() * fStretch ); - maFont->SetWidth( nNewWidth ); + maFont->SetWidth( nNewWidth ); - pOutDev->EnableMapMode(bOldMapState); - } + rOutDev.EnableMapMode(bOldMapState); } } @@ -96,6 +95,7 @@ namespace vclcanvas { tools::LocalGuard aGuard; + mpOutDevProvider.reset(); mpRefDevice.clear(); } @@ -110,7 +110,8 @@ namespace vclcanvas nDirection, nRandomSeed, Reference( this ), - mpRefDevice ); + mpRefDevice, + mpOutDevProvider); } rendering::FontRequest SAL_CALL CanvasFont::getFontRequest( ) throw (uno::RuntimeException) -- cgit