Ensure we have a CGContext in a couple of more places

Change-Id: I1d0963f51472328a1a5b212ab277c6e72fafd7b9
This commit is contained in:
Tor Lillqvist 2013-04-03 23:33:25 +03:00
parent 0ea4a01240
commit ce0c3c1eb1

View file

@ -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 );