Kaydet (Commit) 092f498f authored tarafından Tor Lillqvist's avatar Tor Lillqvist

More CoreGraphics tracing

Change-Id: Idfb615063ec8822dee468883c844bab7dba7cf4c
üst 6e0b9798
...@@ -86,6 +86,7 @@ bool QuartzSalBitmap::Create( CGLayerRef xLayer, int nBitmapBits, ...@@ -86,6 +86,7 @@ bool QuartzSalBitmap::Create( CGLayerRef xLayer, int nBitmapBits,
if( nY < 0 ) if( nY < 0 )
nHeight += nY, nY = 0; nHeight += nY, nY = 0;
const CGSize aLayerSize = CGLayerGetSize( xLayer ); const CGSize aLayerSize = CGLayerGetSize( xLayer );
CG_TRACE( "CGLayerGetSize(" << xLayer << ") = " << aLayerSize );
if( nWidth >= (int)aLayerSize.width - nX ) if( nWidth >= (int)aLayerSize.width - nX )
nWidth = (int)aLayerSize.width - nX; nWidth = (int)aLayerSize.width - nX;
if( nHeight >= (int)aLayerSize.height - nY ) if( nHeight >= (int)aLayerSize.height - nY )
...@@ -255,8 +256,9 @@ bool QuartzSalBitmap::CreateContext() ...@@ -255,8 +256,9 @@ bool QuartzSalBitmap::CreateContext()
if( maContextBuffer.get() ) if( maContextBuffer.get() )
{ {
mxGraphicContext = ::CGBitmapContextCreate( maContextBuffer.get(), mnWidth, mnHeight, mxGraphicContext = CGBitmapContextCreate( maContextBuffer.get(), mnWidth, mnHeight,
bitsPerComponent, nContextBytesPerRow, aCGColorSpace, aCGBmpInfo ); bitsPerComponent, nContextBytesPerRow, aCGColorSpace, aCGBmpInfo );
CG_TRACE( "CGBitmapContextCreate(" << mnWidth << "x" << mnHeight << "x" << bitsPerComponent << ") = " << mxGraphicContext );
} }
if( !mxGraphicContext ) if( !mxGraphicContext )
...@@ -868,6 +870,7 @@ CGImageRef QuartzSalBitmap::CreateColorMask( int nX, int nY, int nWidth, int nHe ...@@ -868,6 +870,7 @@ CGImageRef QuartzSalBitmap::CreateColorMask( int nX, int nY, int nWidth, int nHe
CGDataProviderRef xDataProvider( CGDataProviderCreateWithData(NULL, pMaskBuffer, nHeight * nDestBytesPerRow, &CFRTLFree) ); CGDataProviderRef xDataProvider( CGDataProviderCreateWithData(NULL, pMaskBuffer, nHeight * nDestBytesPerRow, &CFRTLFree) );
xMask = CGImageCreate(nWidth, nHeight, 8, 32, nDestBytesPerRow, GetSalData()->mxRGBSpace, kCGImageAlphaPremultipliedFirst, xDataProvider, NULL, true, kCGRenderingIntentDefault); xMask = CGImageCreate(nWidth, nHeight, 8, 32, nDestBytesPerRow, GetSalData()->mxRGBSpace, kCGImageAlphaPremultipliedFirst, xDataProvider, NULL, true, kCGRenderingIntentDefault);
CG_TRACE( "CGImageCreate(" << nWidth << "x" << nHeight << "x8) = " << xMask );
CFRelease(xDataProvider); CFRelease(xDataProvider);
} }
else else
...@@ -906,6 +909,7 @@ bool QuartzSalBitmap::GetSystemData( BitmapSystemData& rData ) ...@@ -906,6 +909,7 @@ bool QuartzSalBitmap::GetSystemData( BitmapSystemData& rData )
OSL_TRACE("QuartzSalBitmap::%s(): kCGBitmapByteOrder32Host not found => inserting it.",__func__); OSL_TRACE("QuartzSalBitmap::%s(): kCGBitmapByteOrder32Host not found => inserting it.",__func__);
CGImageRef xImage = CGBitmapContextCreateImage (mxGraphicContext); CGImageRef xImage = CGBitmapContextCreateImage (mxGraphicContext);
CG_TRACE( "CGBitmapContextCreateImage(" << mxGraphicContext << ") = " << xImage );
// re-create the context with single change: include kCGBitmapByteOrder32Host flag. // re-create the context with single change: include kCGBitmapByteOrder32Host flag.
CGContextRef mxGraphicContextNew = CGBitmapContextCreate( CGBitmapContextGetData(mxGraphicContext), CGContextRef mxGraphicContextNew = CGBitmapContextCreate( CGBitmapContextGetData(mxGraphicContext),
...@@ -915,18 +919,27 @@ bool QuartzSalBitmap::GetSystemData( BitmapSystemData& rData ) ...@@ -915,18 +919,27 @@ bool QuartzSalBitmap::GetSystemData( BitmapSystemData& rData )
CGBitmapContextGetBytesPerRow(mxGraphicContext), CGBitmapContextGetBytesPerRow(mxGraphicContext),
CGBitmapContextGetColorSpace(mxGraphicContext), CGBitmapContextGetColorSpace(mxGraphicContext),
CGBitmapContextGetBitmapInfo(mxGraphicContext) | kCGBitmapByteOrder32Host); CGBitmapContextGetBitmapInfo(mxGraphicContext) | kCGBitmapByteOrder32Host);
CG_TRACE( "CGBitmapContextCreate(" << CGBitmapContextGetWidth(mxGraphicContext) << "x" << CGBitmapContextGetHeight(mxGraphicContext) << "x" << CGBitmapContextGetBitsPerComponent(mxGraphicContext) << ") = " << mxGraphicContextNew );
CG_TRACE( "CFRelease(" << mxGraphicContext << ")" );
CFRelease(mxGraphicContext); CFRelease(mxGraphicContext);
// Needs to be flipped // Needs to be flipped
CG_TRACE( "CGContextSaveGState(" << mxGraphicContextNew << ")" );
CGContextSaveGState( mxGraphicContextNew ); CGContextSaveGState( mxGraphicContextNew );
CG_TRACE( "CGContextTranslateCTM(" << mxGraphicContextNew << ",0," << CGBitmapContextGetHeight(mxGraphicContextNew) << ")" );
CGContextTranslateCTM (mxGraphicContextNew, 0, CGBitmapContextGetHeight(mxGraphicContextNew)); CGContextTranslateCTM (mxGraphicContextNew, 0, CGBitmapContextGetHeight(mxGraphicContextNew));
CG_TRACE( "CGContextScaleCTM(" << mxGraphicContextNew << ",1,-1)" );
CGContextScaleCTM (mxGraphicContextNew, 1.0, -1.0); CGContextScaleCTM (mxGraphicContextNew, 1.0, -1.0);
CG_TRACE( "CGContextDrawImage(" << mxGraphicContextNew << "," << CGRectMake(0, 0, CGImageGetWidth(xImage), CGImageGetHeight(xImage)) << "," << xImage << ")" );
CGContextDrawImage(mxGraphicContextNew, CGRectMake( 0, 0, CGImageGetWidth(xImage), CGImageGetHeight(xImage)), xImage); CGContextDrawImage(mxGraphicContextNew, CGRectMake( 0, 0, CGImageGetWidth(xImage), CGImageGetHeight(xImage)), xImage);
// Flip back // Flip back
CG_TRACE( "CGContextRestoreGState(" << mxGraphicContextNew << ")" );
CGContextRestoreGState( mxGraphicContextNew ); CGContextRestoreGState( mxGraphicContextNew );
CG_TRACE( "CGImageRelease(" << xImage << ")" );
CGImageRelease( xImage ); CGImageRelease( xImage );
mxGraphicContext = mxGraphicContextNew; mxGraphicContext = mxGraphicContextNew;
} }
......
...@@ -179,6 +179,7 @@ bool AquaSalVirtualDevice::SetSize( long nDX, long nDY ) ...@@ -179,6 +179,7 @@ bool AquaSalVirtualDevice::SetSize( long nDX, long nDY )
if( mxLayer ) if( mxLayer )
{ {
const CGSize aSize = CGLayerGetSize( mxLayer ); const CGSize aSize = CGLayerGetSize( mxLayer );
CG_TRACE( "CGlayerGetSize(" << mxLayer << ") = " << aSize );
if( (nDX == aSize.width) && (nDY == aSize.height) ) if( (nDX == aSize.width) && (nDY == aSize.height) )
{ {
// Yay, we do not have to do anything :) // Yay, we do not have to do anything :)
......
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