diff options
Diffstat (limited to 'vcl')
-rw-r--r-- | vcl/aqua/source/gdi/salvd.cxx | 19 |
1 files changed, 17 insertions, 2 deletions
diff --git a/vcl/aqua/source/gdi/salvd.cxx b/vcl/aqua/source/gdi/salvd.cxx index 1decdc34b720..7fe1ffc3a2b0 100644 --- a/vcl/aqua/source/gdi/salvd.cxx +++ b/vcl/aqua/source/gdi/salvd.cxx @@ -206,11 +206,26 @@ BOOL AquaSalVirtualDevice::SetSize( long nDX, long nDY ) if( pNSContext ) xCGContext = reinterpret_cast<CGContextRef>([pNSContext graphicsPort]); } + else + { + // fall back to a virtual device + if( mnBitmapDepth > 16 ) + mnBitmapDepth = 32; + else + mnBitmapDepth = 16; + const CGColorSpaceRef aCGColorSpace = GetSalData()->mxRGBSpace; + const CGBitmapInfo aCGBmpInfo = kCGImageAlphaNone; + const int nBytesPerRow = (mnBitmapDepth * nDX) / 8; + + void* pRawData = rtl_allocateMemory( nBytesPerRow * nDY ); + mxBitmapContext = ::CGBitmapContextCreate( pRawData, nDX, nDY, + mnBitmapDepth, nBytesPerRow, aCGColorSpace, aCGBmpInfo ); + xCGContext = mxBitmapContext; + } } } - if ( !Application::IsHeadlessModeEnabled() ) - DBG_ASSERT( xCGContext, "no context" ); + DBG_ASSERT( xCGContext, "no context" ); const CGSize aNewSize = { nDX, nDY }; mxLayer = CGLayerCreateWithContext( xCGContext, aNewSize, NULL ); |