[Libreoffice-commits] core.git: vcl/quartz

Tor Lillqvist tml at collabora.com
Mon Mar 31 13:02:45 PDT 2014


 vcl/quartz/salbmp.cxx |   15 ++++++++++++++-
 vcl/quartz/salvd.cxx  |    1 +
 2 files changed, 15 insertions(+), 1 deletion(-)

New commits:
commit 092f498fb3dd4f89ab43c0c76930ecc42a2900d4
Author: Tor Lillqvist <tml at collabora.com>
Date:   Mon Mar 31 23:01:40 2014 +0300

    More CoreGraphics tracing
    
    Change-Id: Idfb615063ec8822dee468883c844bab7dba7cf4c

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


More information about the Libreoffice-commits mailing list