Kaydet (Commit) 84587bdf authored tarafından Tor Lillqvist's avatar Tor Lillqvist

Use my improved understanding of what a subset BitmapDevice is

Need to pass the whole pixel buffer to CGBitmapContextCreate().

Change-Id: Iadac7dc3e63c29e5d0cc328b2e2a1f10824248a6
üst d520bd09
...@@ -283,23 +283,30 @@ void QuartzSalGraphics::SetTextColor( SalColor nSalColor ) ...@@ -283,23 +283,30 @@ void QuartzSalGraphics::SetTextColor( SalColor nSalColor )
bool SvpSalGraphics::CheckContext() bool SvpSalGraphics::CheckContext()
{ {
basegfx::B2IVector size = m_aDevice->getSize(); const basegfx::B2IVector size = m_aDevice->getSize();
const basegfx::B2IVector bufferSize = m_aDevice->getBufferSize();
const sal_Int32 scanlineStride = m_aDevice->getScanlineStride();
basebmp::RawMemorySharedArray pixelBuffer = m_aDevice->getBuffer(); basebmp::RawMemorySharedArray pixelBuffer = m_aDevice->getBuffer();
SAL_INFO( "vcl.ios", "CheckContext: device=" << m_aDevice.get() << " size=" << size.getX() << "x" << size.getY() << (m_aDevice->isTopDown() ? " top-down" : " bottom-up") << " stride=" << m_aDevice->getScanlineStride() ); SAL_INFO( "vcl.ios",
"CheckContext: device=" << m_aDevice.get() <<
" size=" << size.getX() << "x" << size.getY() <<
(m_aDevice->isTopDown() ? " top-down" : " bottom-up") <<
" stride=" << scanlineStride <<
" bufferSize=(" << bufferSize.getX() << "," << bufferSize.getY() << ")" );
switch( m_aDevice->getScanlineFormat() ) { switch( m_aDevice->getScanlineFormat() ) {
case basebmp::Format::EIGHT_BIT_PAL: case basebmp::Format::EIGHT_BIT_PAL:
mrContext = CGBitmapContextCreate(pixelBuffer.get(), mrContext = CGBitmapContextCreate(pixelBuffer.get(),
size.getX(), size.getY(), bufferSize.getX(), bufferSize.getY(),
8, m_aDevice->getScanlineStride(), 8, scanlineStride,
CGColorSpaceCreateDeviceGray(), CGColorSpaceCreateDeviceGray(),
kCGImageAlphaNone); kCGImageAlphaNone);
break; break;
case basebmp::Format::THIRTYTWO_BIT_TC_MASK_RGBA: case basebmp::Format::THIRTYTWO_BIT_TC_MASK_RGBA:
mrContext = CGBitmapContextCreate(pixelBuffer.get(), mrContext = CGBitmapContextCreate(pixelBuffer.get(),
size.getX(), size.getY(), bufferSize.getX(), bufferSize.getY(),
8, m_aDevice->getScanlineStride(), 8, scanlineStride,
CGColorSpaceCreateDeviceRGB(), CGColorSpaceCreateDeviceRGB(),
kCGImageAlphaNoneSkipLast); kCGImageAlphaNoneSkipLast);
break; break;
...@@ -309,12 +316,17 @@ bool SvpSalGraphics::CheckContext() ...@@ -309,12 +316,17 @@ bool SvpSalGraphics::CheckContext()
SAL_WARN_IF( mrContext == NULL, "vcl.ios", "CheckContext() failed" ); SAL_WARN_IF( mrContext == NULL, "vcl.ios", "CheckContext() failed" );
// Should we also clip the context? (Then we need to add a
// getBounds() function to BitmapDevice.)
if( mrContext != NULL && m_aDevice->isTopDown() ) if( mrContext != NULL && m_aDevice->isTopDown() )
{ {
CGContextTranslateCTM( mrContext, 0, size.getY() ); CGContextTranslateCTM( mrContext, 0, bufferSize.getY() );
CGContextScaleCTM( mrContext, 1, -1 ); CGContextScaleCTM( mrContext, 1, -1 );
} }
SAL_INFO( "vcl.ios", "CheckContext: context=" << mrContext );
return ( mrContext != NULL ); return ( mrContext != NULL );
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment