[Libreoffice-commits] core.git: vcl/quartz
Tor Lillqvist
tml at collabora.com
Mon Mar 31 12:13:40 PDT 2014
vcl/quartz/salbmp.cxx | 23 +++++++++++++++++++++--
vcl/quartz/salgdicommon.cxx | 1 +
vcl/quartz/salvd.cxx | 11 +++++++++--
3 files changed, 31 insertions(+), 4 deletions(-)
New commits:
commit 8bc28541fa9d686a7eeee53a034a42c652451734
Author: Tor Lillqvist <tml at collabora.com>
Date: Mon Mar 31 22:12:37 2014 +0300
More CoreGraphics tracing
Change-Id: I2fbdb95637ee77b444e1947405d64cdd2e0338af
diff --git a/vcl/quartz/salbmp.cxx b/vcl/quartz/salbmp.cxx
index aaeccaa..cea1b6c 100644
--- a/vcl/quartz/salbmp.cxx
+++ b/vcl/quartz/salbmp.cxx
@@ -29,6 +29,7 @@
#include "vcl/salbtype.hxx"
#include "quartz/salbmp.h"
+#include "quartz/utils.h"
#ifdef MACOSX
#include "osx/saldata.hxx"
@@ -103,7 +104,10 @@ bool QuartzSalBitmap::Create( CGLayerRef xLayer, int nBitmapBits,
// copy layer content into the bitmap buffer
const CGPoint aSrcPoint = { static_cast<CGFloat>(-nX), static_cast<CGFloat>(-nY) };
if(mxGraphicContext) // remove warning
+ {
+ CG_TRACE( "CGContextDrawLayerAtPoint(" << mxGraphicContext << "," << aSrcPoint << "," << xLayer << ")" );
CGContextDrawLayerAtPoint( mxGraphicContext, aSrcPoint, xLayer );
+ }
return true;
}
@@ -173,11 +177,16 @@ void QuartzSalBitmap::Destroy()
void QuartzSalBitmap::DestroyContext()
{
- CGImageRelease( mxCachedImage );
- mxCachedImage = NULL;
+ if( mxCachedImage )
+ {
+ CG_TRACE( "CGImageRelease(" << mxCachedImage << ")" );
+ CGImageRelease( mxCachedImage );
+ mxCachedImage = NULL;
+ }
if( mxGraphicContext )
{
+ CG_TRACE( "CGContextRelease(" << mxGraphicContext << ")" );
CGContextRelease( mxGraphicContext );
mxGraphicContext = NULL;
maContextBuffer.reset();
@@ -739,6 +748,7 @@ CGImageRef QuartzSalBitmap::CreateCroppedImage( int nX, int nY, int nNewWidth, i
return NULL;
mxCachedImage = CGBitmapContextCreateImage( mxGraphicContext );
+ CG_TRACE( "CGBitmapContextCreateImage(" << mxGraphicContext << ") = " << mxCachedImage );
}
CGImageRef xCroppedImage = NULL;
@@ -753,6 +763,7 @@ CGImageRef QuartzSalBitmap::CreateCroppedImage( int nX, int nY, int nNewWidth, i
nY = mnHeight - (nY + nNewHeight); // adjust for y-mirrored context
const CGRect aCropRect = { { static_cast<CGFloat>(nX), static_cast<CGFloat>(nY) }, { static_cast<CGFloat>(nNewWidth), static_cast<CGFloat>(nNewHeight) } };
xCroppedImage = CGImageCreateWithImageInRect( mxCachedImage, aCropRect );
+ CG_TRACE( "CGImageCreateWithImageInRect(" << mxCachedImage << "," << aCropRect << ") = " << xCroppedImage );
}
return xCroppedImage;
@@ -788,13 +799,18 @@ CGImageRef QuartzSalBitmap::CreateWithMask( const QuartzSalBitmap& rMask,
void* pMaskMem = rtl_allocateMemory( nMaskBytesPerRow * nHeight );
CGContextRef xMaskContext = CGBitmapContextCreate( pMaskMem,
nWidth, nHeight, 8, nMaskBytesPerRow, GetSalData()->mxGraySpace, kCGImageAlphaNone );
+ CG_TRACE( "CGBitmapContextCreate(" << nWidth << "x" << nHeight << "x8) = " << xMaskContext );
+ CG_TRACE( "CGContextDrawImage(" << xMaskContext << "," << xImageRect << "," << xMask << ")" );
CGContextDrawImage( xMaskContext, xImageRect, xMask );
+ CG_TRACE( "CFRelease(" << xMask << ")" );
CFRelease( xMask );
CGDataProviderRef xDataProvider( CGDataProviderCreateWithData( NULL,
pMaskMem, nHeight * nMaskBytesPerRow, &CFRTLFree ) );
static const CGFloat* pDecode = NULL;
xMask = CGImageMaskCreate( nWidth, nHeight, 8, 8, nMaskBytesPerRow, xDataProvider, pDecode, false );
+ CG_TRACE( "CGImageMaskCreate(" << nWidth << "," << nHeight << ",8,8) = " << xMask );
CFRelease( xDataProvider );
+ CG_TRACE( "CFRelease(" << xMaskContext << ")" );
CFRelease( xMaskContext );
}
@@ -803,7 +819,10 @@ CGImageRef QuartzSalBitmap::CreateWithMask( const QuartzSalBitmap& rMask,
// combine image and alpha mask
CGImageRef xMaskedImage = CGImageCreateWithMask( xImage, xMask );
+ CG_TRACE( "CGImageCreateWithMask(" << xImage << "," << xMask << ") = " << xMaskedImage );
+ CG_TRACE( "CFRelease(" << xMask << ")" );
CFRelease( xMask );
+ CG_TRACE( "CFRelease(" << xImage << ")" );
CFRelease( xImage );
return xMaskedImage;
}
diff --git a/vcl/quartz/salgdicommon.cxx b/vcl/quartz/salgdicommon.cxx
index c2e9931..f0b9979 100644
--- a/vcl/quartz/salgdicommon.cxx
+++ b/vcl/quartz/salgdicommon.cxx
@@ -484,6 +484,7 @@ void AquaSalGraphics::copyArea( long nDstX, long nDstY,long nSrcX, long nSrcY,
xSrcLayer = CGLayerCreateWithContext( xCopyContext, aSrcSize, NULL );
CG_TRACE( "CGLayerCreateWithContext(" << xCopyContext << "," << aSrcSize << ",NULL) = " << xSrcLayer );
const CGContextRef xSrcContext = CGLayerGetContext( xSrcLayer );
+ CG_TRACE( "CGLayerGetContext(" << xSrcLayer << ") = " << xSrcContext );
CGPoint aSrcPoint = CGPointMake(-nSrcX, -nSrcY);
if( IsFlipped() )
{
diff --git a/vcl/quartz/salvd.cxx b/vcl/quartz/salvd.cxx
index fb3e9a7..0d8cc28 100644
--- a/vcl/quartz/salvd.cxx
+++ b/vcl/quartz/salvd.cxx
@@ -32,8 +32,7 @@
#include "headless/svpvd.hxx"
#endif
#include "quartz/salgdi.h"
-
-
+#include "quartz/utils.h"
SalVirtualDevice* AquaSalInstance::CreateVirtualDevice( SalGraphics* pGraphics,
long nDX, long nDY, sal_uInt16 nBitCount, const SystemGraphicsData *pData )
@@ -74,6 +73,7 @@ AquaSalVirtualDevice::AquaSalVirtualDevice( AquaSalGraphics* pGraphic, long nDX,
if (nDY == 0)
nDY = 1;
mxLayer = CGLayerCreateWithContext( pData->rCGContext, CGSizeMake( nDX, nDY), NULL );
+ CG_TRACE( "CGLayerCreateWithContext(" << pData->rCGContext << "," << CGSizeMake( nDX, nDY) << ",NULL) = " << mxLayer );
mpGraphics->SetVirDevGraphics( mxLayer, pData->rCGContext );
}
else
@@ -131,6 +131,7 @@ void AquaSalVirtualDevice::Destroy()
{
if( mpGraphics )
mpGraphics->SetVirDevGraphics( NULL, NULL );
+ CG_TRACE( "CGLayerRelease(" << mxLayer << ")" );
CGLayerRelease( mxLayer );
mxLayer = NULL;
}
@@ -139,6 +140,7 @@ void AquaSalVirtualDevice::Destroy()
{
void* pRawData = CGBitmapContextGetData( mxBitmapContext );
rtl_freeMemory( pRawData );
+ CG_TRACE( "CGContextRelease(" << mxBitmapContext << ")" );
CGContextRelease( mxBitmapContext );
mxBitmapContext = NULL;
}
@@ -198,6 +200,7 @@ bool AquaSalVirtualDevice::SetSize( long nDX, long nDY )
void* pRawData = rtl_allocateMemory( nBytesPerRow * nDY );
mxBitmapContext = CGBitmapContextCreate( pRawData, nDX, nDY,
mnBitmapDepth, nBytesPerRow, aCGColorSpace, aCGBmpInfo );
+ CG_TRACE( "CGBitmapContextCreate(" << nDX << "x" << nDY << "x" << mnBitmapDepth << ") = " << mxBitmapContext );
xCGContext = mxBitmapContext;
}
else
@@ -254,6 +257,7 @@ bool AquaSalVirtualDevice::SetSize( long nDX, long nDY )
void* pRawData = rtl_allocateMemory( nBytesPerRow * nDY );
mxBitmapContext = CGBitmapContextCreate( pRawData, nDX, nDY,
8, nBytesPerRow, aCGColorSpace, aCGBmpInfo );
+ CG_TRACE( "CGBitmapContextCreate(" << nDX << "x" << nDY << "x8) = " << mxBitmapContext );
xCGContext = mxBitmapContext;
#endif
}
@@ -262,11 +266,13 @@ bool AquaSalVirtualDevice::SetSize( long nDX, long nDY )
const CGSize aNewSize = { static_cast<CGFloat>(nDX), static_cast<CGFloat>(nDY) };
mxLayer = CGLayerCreateWithContext( xCGContext, aNewSize, NULL );
+ CG_TRACE( "CGLayerCreateWithContext(" << xCGContext << "," << aNewSize << ",NULL) = " << mxLayer );
if( mxLayer && mpGraphics )
{
// get the matching Quartz context
CGContextRef xDrawContext = CGLayerGetContext( mxLayer );
+ CG_TRACE( "CGLayerGetContext(" << mxLayer << ") = " << xDrawContext );
mpGraphics->SetVirDevGraphics( mxLayer, xDrawContext, mnBitmapDepth );
}
@@ -282,6 +288,7 @@ void AquaSalVirtualDevice::GetSize( long& rWidth, long& rHeight )
const CGSize aSize = CGLayerGetSize( mxLayer );
rWidth = static_cast<long>(aSize.width);
rHeight = static_cast<long>(aSize.height);
+ CG_TRACE( "CGLayerGetSize(" << mxLayer << ") = " << aSize << "(" << rWidth << "x" << rHeight << ")" );
}
else
{
More information about the Libreoffice-commits
mailing list