diff options
author | Tor Lillqvist <tml@iki.fi> | 2013-04-03 23:33:25 +0300 |
---|---|---|
committer | Tor Lillqvist <tml@iki.fi> | 2013-04-03 23:38:14 +0300 |
commit | ce0c3c1eb1405912f36a3ad7e850a5b4e17a3f2c (patch) | |
tree | 3a0e884342e97298535f3ebcd159f4cbd9b55ddd /vcl | |
parent | 0ea4a012400343b7105f108b47bb6e3df38d2558 (diff) |
Ensure we have a CGContext in a couple of more places
Change-Id: I1d0963f51472328a1a5b212ab277c6e72fafd7b9
Diffstat (limited to 'vcl')
-rw-r--r-- | vcl/coretext/salcoretextlayout.cxx | 14 |
1 files changed, 11 insertions, 3 deletions
diff --git a/vcl/coretext/salcoretextlayout.cxx b/vcl/coretext/salcoretextlayout.cxx index 7cadbe70e6a8..98e2ae48d9a4 100644 --- a/vcl/coretext/salcoretextlayout.cxx +++ b/vcl/coretext/salcoretextlayout.cxx @@ -301,11 +301,14 @@ long CoreTextLayout::FillDXArray( sal_Int32* pDXArray ) const bool CoreTextLayout::GetBoundRect( SalGraphics& rGraphics, Rectangle& rVCLRect ) const { - SAL_INFO( "vcl.coretext.layout", "GetBoundRect(" << this << ")" ); + QuartzSalGraphics& gr = static_cast<QuartzSalGraphics&>(rGraphics); + + if( !gr.CheckContext() ) + return false; + if ( !mbHasBoundRectangle ) { - QuartzSalGraphics& gr = static_cast<QuartzSalGraphics&>(rGraphics); CGRect bound_rect = CTLineGetImageBounds( mpLine, gr.mrContext ); if ( !CGRectIsNull( bound_rect ) ) { maBoundRectangle = Rectangle( @@ -464,7 +467,12 @@ int CoreTextLayout::GetTextBreak( long nMaxWidth, long nCharExtra, int nFactor ) long CoreTextLayout::GetTextWidth() const { - CGRect bound_rect = CTLineGetImageBounds(mpLine, mpGraphics->GetContext()); + CGContextRef context = mpGraphics->GetContext(); + if (!context) { + SAL_INFO( "vcl.coretext.layout", "GetTextWidth(): no context!?"); + return 0; + } + CGRect bound_rect = CTLineGetImageBounds(mpLine, context); long w = round_to_long(bound_rect.size.width * mpStyle->GetFontStretchFactor()); SAL_INFO( "vcl.coretext.layout", "GetTextWidth(" << this << ") returning " << w ); |