summaryrefslogtreecommitdiff
path: root/vcl
diff options
context:
space:
mode:
authorPhilipp Lohmann [pl] <Philipp.Lohmann@Oracle.COM>2010-12-13 17:13:24 +0100
committerPhilipp Lohmann [pl] <Philipp.Lohmann@Oracle.COM>2010-12-13 17:13:24 +0100
commitde0e53f75f4b597d8566796ec5166b2d10c78ef4 (patch)
treea6c68915baf696be08e0054926920eb24f52fc34 /vcl
parentb2c580af0ea20e00e2bc8111c873836c3a4e0c9f (diff)
xlastovi: #i91990# virtual devices need to have a context to draw on
Diffstat (limited to 'vcl')
-rw-r--r--vcl/aqua/source/gdi/salvd.cxx19
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 );