summaryrefslogtreecommitdiff
path: root/vcl/quartz
diff options
context:
space:
mode:
authorNorbert Thiebaud <nthiebaud@gmail.com>2015-08-11 20:19:37 -0500
committerNorbert Thiebaud <nthiebaud@gmail.com>2015-08-12 09:54:56 +0000
commitb20becf9e3934914b3291ca73962fbaddf616b74 (patch)
tree18fc8e47886b87f2d0c1bfb789dade99da20c40c /vcl/quartz
parente008aebbcf366a64d5870ad3a5df39cac429b81c (diff)
cosmetic: clean-up vcl/quartz
Change-Id: I6f15e7ce90598eb4f8e7bb59c7c65d1aa333b972 Reviewed-on: https://gerrit.libreoffice.org/17661 Tested-by: Jenkins <ci@libreoffice.org> Reviewed-by: Norbert Thiebaud <nthiebaud@gmail.com>
Diffstat (limited to 'vcl/quartz')
-rw-r--r--vcl/quartz/CTRunData.cxx5
-rw-r--r--vcl/quartz/ctfonts.cxx150
-rw-r--r--vcl/quartz/ctlayout.cxx18
-rw-r--r--vcl/quartz/salbmp.cxx296
-rw-r--r--vcl/quartz/salgdi.cxx275
-rw-r--r--vcl/quartz/salgdicommon.cxx488
-rw-r--r--vcl/quartz/salgdiutils.cxx74
-rw-r--r--vcl/quartz/salvd.cxx88
-rw-r--r--vcl/quartz/utils.cxx33
9 files changed, 854 insertions, 573 deletions
diff --git a/vcl/quartz/CTRunData.cxx b/vcl/quartz/CTRunData.cxx
index 7ef38918976f..8f58d478646d 100644
--- a/vcl/quartz/CTRunData.cxx
+++ b/vcl/quartz/CTRunData.cxx
@@ -7,11 +7,14 @@
* file, You can obtain one at http://mozilla.org/MPL/2.0/.
*/
+#include <sal/config.h>
#include <sal/types.h>
+
#include <cassert>
-#include "quartz/utils.h"
#include "CTRunData.hxx"
+#include "quartz/utils.h"
+
CTRunData::CTRunData( CTRunRef pRun, int start)
: ownership_flags(0)
diff --git a/vcl/quartz/ctfonts.cxx b/vcl/quartz/ctfonts.cxx
index 274da6bfdc2e..321f371f179a 100644
--- a/vcl/quartz/ctfonts.cxx
+++ b/vcl/quartz/ctfonts.cxx
@@ -17,27 +17,26 @@
* the License at http://www.apache.org/licenses/LICENSE-2.0 .
*/
-#include "impfont.hxx"
-#include "outfont.hxx"
-#include "PhysicalFontCollection.hxx"
-#include "sallayout.hxx"
+#include <sal/config.h>
+
+#include <basegfx/polygon/b2dpolygon.hxx>
+#include <basegfx/matrix/b2dhommatrix.hxx>
+
+#include <vcl/settings.hxx>
+
+#include "ctfonts.hxx"
+#include "impfont.hxx"
#ifdef MACOSX
-#include "osx/salinst.h"
#include "osx/saldata.hxx"
-// kCTForegroundColorFromContextAttributeName is available on 10.5, but it is "hidden"
-#ifndef kCTForegroundColorFromContextAttributeName
-extern const CFStringRef kCTForegroundColorFromContextAttributeName;
-#endif
+#include "osx/salinst.h"
#endif
+#include "outfont.hxx"
+#include "PhysicalFontCollection.hxx"
#include "quartz/salgdi.h"
#include "quartz/utils.h"
-#include "ctfonts.hxx"
-
-#include <vcl/settings.hxx>
+#include "sallayout.hxx"
-#include "basegfx/polygon/b2dpolygon.hxx"
-#include "basegfx/matrix/b2dhommatrix.hxx"
inline double toRadian(int nDegree)
{
@@ -45,10 +44,10 @@ inline double toRadian(int nDegree)
}
CoreTextStyle::CoreTextStyle( const FontSelectPattern& rFSD )
-: mpFontData( static_cast<CoreTextFontData const *>(rFSD.mpFontData) )
-, mfFontStretch( 1.0 )
-, mfFontRotation( 0.0 )
-, mpStyleDict( NULL )
+ : mpFontData( static_cast<CoreTextFontData const *>(rFSD.mpFontData) )
+ , mfFontStretch( 1.0 )
+ , mfFontRotation( 0.0 )
+ , mpStyleDict( NULL )
{
const FontSelectPattern* const pReqFont = &rFSD;
@@ -70,7 +69,8 @@ CoreTextStyle::CoreTextStyle( const FontSelectPattern& rFSD )
// create the style object for CoreText font attributes
static const CFIndex nMaxDictSize = 16; // TODO: does this really suffice?
mpStyleDict = CFDictionaryCreateMutable( NULL, nMaxDictSize,
- &kCFTypeDictionaryKeyCallBacks, &kCFTypeDictionaryValueCallBacks );
+ &kCFTypeDictionaryKeyCallBacks,
+ &kCFTypeDictionaryValueCallBacks );
CFBooleanRef pCFVertBool = pReqFont->mbVertical ? kCFBooleanTrue : kCFBooleanFalse;
CFDictionarySetValue( mpStyleDict, kCTVerticalFormsAttributeName, pCFVertBool );
@@ -86,8 +86,9 @@ CoreTextStyle::CoreTextStyle( const FontSelectPattern& rFSD )
}
// fake italic
- if (((pReqFont->GetSlant() == ITALIC_NORMAL) || (pReqFont->GetSlant() == ITALIC_OBLIQUE))
- && (mpFontData->GetSlant() == ITALIC_NONE))
+ if (((pReqFont->GetSlant() == ITALIC_NORMAL) ||
+ (pReqFont->GetSlant() == ITALIC_OBLIQUE)) &&
+ (mpFontData->GetSlant() == ITALIC_NONE))
{
aMatrix = CGAffineTransformConcat(aMatrix, CGAffineTransformMake(1, 0, toRadian(120), 1, 0, 0));
}
@@ -166,31 +167,42 @@ static void MyCGPathApplierFunc( void* pData, const CGPathElement* pElement )
{
case kCGPathElementCloseSubpath:
case kCGPathElementMoveToPoint:
- if( nPointCount > 0 ) {
+ if( nPointCount > 0 )
+ {
static_cast<GgoData*>(pData)->mpPolyPoly->append( rPolygon );
rPolygon.clear();
}
// fall through for kCGPathElementMoveToPoint:
if( pElement->type != kCGPathElementMoveToPoint )
+ {
break;
+ }
case kCGPathElementAddLineToPoint:
rPolygon.append( basegfx::B2DPoint( +pElement->points[0].x, -pElement->points[0].y ) );
break;
+
case kCGPathElementAddCurveToPoint:
rPolygon.append( basegfx::B2DPoint( +pElement->points[2].x, -pElement->points[2].y ) );
- rPolygon.setNextControlPoint( nPointCount-1, basegfx::B2DPoint( pElement->points[0].x, -pElement->points[0].y ) );
- rPolygon.setPrevControlPoint( nPointCount+0, basegfx::B2DPoint( pElement->points[1].x, -pElement->points[1].y ) );
+ rPolygon.setNextControlPoint( nPointCount - 1,
+ basegfx::B2DPoint( pElement->points[0].x,
+ -pElement->points[0].y ) );
+ rPolygon.setPrevControlPoint( nPointCount + 0,
+ basegfx::B2DPoint( pElement->points[1].x,
+ -pElement->points[1].y ) );
+ break;
+
+ case kCGPathElementAddQuadCurveToPoint:
+ {
+ const basegfx::B2DPoint aStartPt = rPolygon.getB2DPoint( nPointCount-1 );
+ const basegfx::B2DPoint aCtrPt1( (aStartPt.getX() + 2 * pElement->points[0].x) / 3.0,
+ (aStartPt.getY() - 2 * pElement->points[0].y) / 3.0 );
+ const basegfx::B2DPoint aCtrPt2( (+2 * pElement->points[0].x + pElement->points[1].x) / 3.0,
+ (-2 * pElement->points[0].y - pElement->points[1].y) / 3.0 );
+ rPolygon.append( basegfx::B2DPoint( +pElement->points[1].x, -pElement->points[1].y ) );
+ rPolygon.setNextControlPoint( nPointCount-1, aCtrPt1 );
+ rPolygon.setPrevControlPoint( nPointCount+0, aCtrPt2 );
+ }
break;
- case kCGPathElementAddQuadCurveToPoint: {
- const basegfx::B2DPoint aStartPt = rPolygon.getB2DPoint( nPointCount-1 );
- const basegfx::B2DPoint aCtrPt1( (aStartPt.getX() + 2* pElement->points[0].x) / 3.0,
- (aStartPt.getY() - 2 * pElement->points[0].y) / 3.0 );
- const basegfx::B2DPoint aCtrPt2( (+2 * +pElement->points[0].x + pElement->points[1].x) / 3.0,
- (-2 * pElement->points[0].y - pElement->points[1].y) / 3.0 );
- rPolygon.append( basegfx::B2DPoint( +pElement->points[1].x, -pElement->points[1].y ) );
- rPolygon.setNextControlPoint( nPointCount-1, aCtrPt1 );
- rPolygon.setPrevControlPoint( nPointCount+0, aCtrPt2 );
- } break;
}
}
@@ -202,7 +214,8 @@ bool CoreTextStyle::GetGlyphOutline( sal_GlyphId aGlyphId, basegfx::B2DPolyPolyg
// XXX: this is broken if the glyph came from fallback font
CTFontRef pCTFont = static_cast<CTFontRef>(CFDictionaryGetValue( mpStyleDict, kCTFontAttributeName ));
CGPathRef xPath = CTFontCreatePathForGlyph( pCTFont, nCGGlyph, NULL );
- if (!xPath) {
+ if (!xPath)
+ {
return false;
}
@@ -262,8 +275,8 @@ ImplDevFontAttributes DevFontFromCTFontDescriptor( CTFontDescriptorRef pFD, bool
// all CoreText fonts are device fonts that can rotate just fine
ImplDevFontAttributes rDFA;
rDFA.mbOrientation = true;
- rDFA.mbDevice = true;
- rDFA.mnQuality = 0;
+ rDFA.mbDevice = true;
+ rDFA.mnQuality = 0;
// reset the font attributes
rDFA.SetFamilyType( FAMILY_DONTKNOW );
@@ -280,9 +293,12 @@ ImplDevFontAttributes DevFontFromCTFontDescriptor( CTFontDescriptorRef pFD, bool
// get font name
#ifdef MACOSX
const OUString aUILang = Application::GetSettings().GetUILanguageTag().getLanguage();
- CFStringRef pUILang = CFStringCreateWithCharacters( kCFAllocatorDefault, aUILang.getStr(), aUILang.getLength() );
+ CFStringRef pUILang = CFStringCreateWithCharacters( kCFAllocatorDefault,
+ aUILang.getStr(), aUILang.getLength() );
CFStringRef pLang = NULL;
- CFStringRef pFamilyName = static_cast<CFStringRef>(CTFontDescriptorCopyLocalizedAttribute( pFD, kCTFontFamilyNameAttribute, &pLang ));
+ CFStringRef pFamilyName = static_cast<CFStringRef>(
+ CTFontDescriptorCopyLocalizedAttribute( pFD, kCTFontFamilyNameAttribute, &pLang ));
+
if ( !pLang || ( CFStringCompare( pUILang, pLang, 0 ) != kCFCompareEqualTo ))
{
if(pFamilyName)
@@ -305,7 +321,8 @@ ImplDevFontAttributes DevFontFromCTFontDescriptor( CTFontDescriptorRef pFD, bool
rDFA.SetStyleName( GetOUString( pStyleName ) );
// get font-enabled status
- if( bFontEnabled ) {
+ if( bFontEnabled )
+ {
int bEnabled = TRUE; // by default (and when we're on OS X < 10.6) it's "enabled"
CFNumberRef pEnabled = static_cast<CFNumberRef>(CTFontDescriptorCopyAttribute( pFD, kCTFontEnabledAttribute ));
CFNumberGetValue( pEnabled, kCFNumberIntType, &bEnabled );
@@ -319,7 +336,8 @@ ImplDevFontAttributes DevFontFromCTFontDescriptor( CTFontDescriptorRef pFD, bool
// TODO: use other traits such as MonoSpace/Condensed/Expanded or Vertical too
SInt64 nSymbolTrait = 0;
CFNumberRef pSymbolNum = NULL;
- if( CFDictionaryGetValueIfPresent( pAttrDict, kCTFontSymbolicTrait, reinterpret_cast<const void**>(&pSymbolNum) ) ) {
+ if( CFDictionaryGetValueIfPresent( pAttrDict, kCTFontSymbolicTrait, reinterpret_cast<const void**>(&pSymbolNum) ) )
+ {
CFNumberGetValue( pSymbolNum, kCFNumberSInt64Type, &nSymbolTrait );
rDFA.SetSymbolFlag( ((nSymbolTrait & kCTFontClassMaskTrait) == kCTFontSymbolicClass) );
}
@@ -329,14 +347,21 @@ ImplDevFontAttributes DevFontFromCTFontDescriptor( CTFontDescriptorRef pFD, bool
CFNumberRef pWeightNum = static_cast<CFNumberRef>(CFDictionaryGetValue( pAttrDict, kCTFontWeightTrait ));
CFNumberGetValue( pWeightNum, kCFNumberDoubleType, &fWeight );
int nInt = WEIGHT_NORMAL;
- if( fWeight > 0 ) {
+ if( fWeight > 0 )
+ {
nInt = rint(WEIGHT_NORMAL + fWeight * ((WEIGHT_BLACK - WEIGHT_NORMAL)/0.68));
if( nInt > WEIGHT_BLACK )
+ {
nInt = WEIGHT_BLACK;
- } else if( fWeight < 0 ) {
+ }
+ }
+ else if( fWeight < 0 )
+ {
nInt = rint(WEIGHT_NORMAL + fWeight * ((WEIGHT_NORMAL - WEIGHT_THIN)/0.9));
if( nInt < WEIGHT_THIN )
+ {
nInt = WEIGHT_THIN;
+ }
}
rDFA.SetWeight( (FontWeight)nInt );
@@ -345,21 +370,30 @@ ImplDevFontAttributes DevFontFromCTFontDescriptor( CTFontDescriptorRef pFD, bool
CFNumberRef pSlantNum = static_cast<CFNumberRef>(CFDictionaryGetValue( pAttrDict, kCTFontSlantTrait ));
CFNumberGetValue( pSlantNum, kCFNumberDoubleType, &fSlant );
if( fSlant >= 0.035 )
+ {
rDFA.SetItalic( ITALIC_NORMAL );
-
+ }
// get width trait
double fWidth = 0;
CFNumberRef pWidthNum = static_cast<CFNumberRef>(CFDictionaryGetValue( pAttrDict, kCTFontWidthTrait ));
CFNumberGetValue( pWidthNum, kCFNumberDoubleType, &fWidth );
nInt = WIDTH_NORMAL;
- if( fWidth > 0 ) {
+
+ if( fWidth > 0 )
+ {
nInt = rint( WIDTH_NORMAL + fWidth * ((WIDTH_ULTRA_EXPANDED - WIDTH_NORMAL)/0.4));
if( nInt > WIDTH_ULTRA_EXPANDED )
+ {
nInt = WIDTH_ULTRA_EXPANDED;
- } else if( fWidth < 0 ) {
+ }
+ }
+ else if( fWidth < 0 )
+ {
nInt = rint( WIDTH_NORMAL + fWidth * ((WIDTH_NORMAL - WIDTH_ULTRA_CONDENSED)/0.5));
if( nInt < WIDTH_ULTRA_CONDENSED )
+ {
nInt = WIDTH_ULTRA_CONDENSED;
+ }
}
rDFA.SetWidthType( (FontWidth)nInt );
@@ -389,21 +423,27 @@ static void CTFontEnumCallBack( const void* pValue, void* pContext )
}
SystemFontList::SystemFontList()
-: mpCTFontCollection( NULL )
-, mpCTFontArray( NULL )
+ : mpCTFontCollection( NULL )
+ , mpCTFontArray( NULL )
{}
SystemFontList::~SystemFontList()
{
CTFontContainer::const_iterator it = maFontContainer.begin();
for(; it != maFontContainer.end(); ++it )
+ {
delete (*it).second;
+ }
maFontContainer.clear();
if( mpCTFontArray )
+ {
CFRelease( mpCTFontArray );
+ }
if( mpCTFontCollection )
+ {
CFRelease( mpCTFontCollection );
+ }
}
void SystemFontList::AddFont( CoreTextFontData* pFontData )
@@ -416,14 +456,18 @@ void SystemFontList::AnnounceFonts( PhysicalFontCollection& rFontCollection ) co
{
CTFontContainer::const_iterator it = maFontContainer.begin();
for(; it != maFontContainer.end(); ++it )
+ {
rFontCollection.Add( (*it).second->Clone() );
+ }
}
CoreTextFontData* SystemFontList::GetFontDataFromId( sal_IntPtr nFontId ) const
{
CTFontContainer::const_iterator it = maFontContainer.find( nFontId );
if( it == maFontContainer.end() )
+ {
return NULL;
+ }
return (*it).second;
}
@@ -432,12 +476,15 @@ bool SystemFontList::Init()
// enumerate available system fonts
static const int nMaxDictEntries = 8;
CFMutableDictionaryRef pCFDict = CFDictionaryCreateMutable( NULL,
- nMaxDictEntries, &kCFTypeDictionaryKeyCallBacks, &kCFTypeDictionaryValueCallBacks );
+ nMaxDictEntries,
+ &kCFTypeDictionaryKeyCallBacks,
+ &kCFTypeDictionaryValueCallBacks );
+
CFDictionaryAddValue( pCFDict, kCTFontCollectionRemoveDuplicatesOption, kCFBooleanTrue );
mpCTFontCollection = CTFontCollectionCreateFromAvailableFonts( pCFDict );
CFRelease( pCFDict );
-
mpCTFontArray = CTFontCollectionCreateMatchingFontDescriptors( mpCTFontCollection );
+
const int nFontCount = CFArrayGetCount( mpCTFontArray );
const CFRange aFullRange = CFRangeMake( 0, nFontCount );
CFArrayApplyFunction( mpCTFontArray, aFullRange, CTFontEnumCallBack, this );
@@ -448,7 +495,8 @@ bool SystemFontList::Init()
SystemFontList* GetCoretextFontList()
{
SystemFontList* pList = new SystemFontList();
- if( !pList->Init() ) {
+ if( !pList->Init() )
+ {
delete pList;
return NULL;
}
diff --git a/vcl/quartz/ctlayout.cxx b/vcl/quartz/ctlayout.cxx
index 20dca01ddc6b..f1acd1727191 100644
--- a/vcl/quartz/ctlayout.cxx
+++ b/vcl/quartz/ctlayout.cxx
@@ -17,14 +17,16 @@
* the License at http://www.apache.org/licenses/LICENSE-2.0 .
*/
-#include <sal/types.h>
+#include <sal/config.h>
+
#include <boost/ptr_container/ptr_vector.hpp>
-#include "tools/debug.hxx"
-#include "quartz/utils.h"
+#include <sal/types.h>
+#include <tools/debug.hxx>
#include "ctfonts.hxx"
#include "CTRunData.hxx"
+#include "quartz/utils.h"
class CTLayout : public SalLayout
@@ -625,7 +627,9 @@ DeviceCoordinate CTLayout::FillDXArray( DeviceCoordinate* pDXArray ) const
for( int i = 0; i != nGlyphCount; ++i )
{
const int nRelIndex = aIndexVector[i];
- SAL_INFO( "vcl.ct", "aWidthVector[ g:" << i << "-> c:" << nRelIndex << " ] = " << aWidthVector[nRelIndex] << " + " << aSizeVector[i].width << " = " << aWidthVector[nRelIndex] + aSizeVector[i].width);
+ SAL_INFO( "vcl.ct", "aWidthVector[ g:" << i << "-> c:" << nRelIndex << " ] = " <<
+ aWidthVector[nRelIndex] << " + " << aSizeVector[i].width << " = " <<
+ aWidthVector[nRelIndex] + aSizeVector[i].width);
aWidthVector[nRelIndex] += aSizeVector[i].width;
}
}
@@ -666,19 +670,25 @@ sal_Int32 CTLayout::GetTextBreak( DeviceCoordinate nMaxWidth, DeviceCoordinate n
// check if the original extra-width guess was good
if( !nCharExtra )
nBestGuess = nNewIndex;
+
if( nBestGuess == nNewIndex )
break;
+
// prepare another round for a different number of characters
CFIndex nNewGuess = (nNewIndex + nBestGuess + 1) / 2;
if( nNewGuess == nBestGuess )
+ {
nNewGuess += (nNewIndex > nBestGuess) ? +1 : -1;
+ }
nBestGuess = nNewGuess;
}
// suggest the best fitting cluster break as breaking position
CFRelease( aCTTypeSetter );
+
const int nIndex = nBestGuess + mnMinCharPos;
SAL_INFO("vcl.ct", "GetTextBreak nIndex:" << nIndex);
+
return nIndex;
}
diff --git a/vcl/quartz/salbmp.cxx b/vcl/quartz/salbmp.cxx
index 7dbbfb0b64b4..8463d06b0bf5 100644
--- a/vcl/quartz/salbmp.cxx
+++ b/vcl/quartz/salbmp.cxx
@@ -22,16 +22,14 @@
#include <cstddef>
#include <limits>
-#include "basebmp/scanlineformats.hxx"
-#include "basebmp/color.hxx"
-
-#include "basegfx/vector/b2ivector.hxx"
-
-#include "tools/color.hxx"
-
-#include "vcl/bitmap.hxx"
-#include "vcl/salbtype.hxx"
+#include <basebmp/scanlineformats.hxx>
+#include <basebmp/color.hxx>
+#include <basegfx/vector/b2ivector.hxx>
+#include <tools/color.hxx>
+#include <vcl/bitmap.hxx>
+#include <vcl/salbtype.hxx>
+#include "bmpfast.hxx"
#include "quartz/salbmp.h"
#include "quartz/utils.h"
@@ -41,8 +39,6 @@
#include "saldatabasic.hxx"
#endif
-#include "bmpfast.hxx"
-
static const unsigned long k16BitRedColorMask = 0x00007c00;
static const unsigned long k16BitGreenColorMask = 0x000003e0;
static const unsigned long k16BitBlueColorMask = 0x0000001f;
@@ -61,6 +57,7 @@ static void writeImageToFile(CGImageRef image, const char *baseName)
static bool bDoIt = getenv("DBG_WRITE_CGIMAGES");
if (!bDoIt)
return;
+
static int counter = 0;
NSArray *paths = NSSearchPathForDirectoriesInDomains(NSDocumentDirectory, NSUserDomainMask, YES);
NSString *documentsDirectory = [paths objectAtIndex:0];
@@ -69,9 +66,12 @@ static void writeImageToFile(CGImageRef image, const char *baseName)
CGImageDestinationRef destination = CGImageDestinationCreateWithURL(url, kUTTypePNG, 1, NULL);
CGImageDestinationAddImage(destination, image, nil);
- if (!CGImageDestinationFinalize(destination)) {
+ if (!CGImageDestinationFinalize(destination))
+ {
NSLog(@"Failed to write image to %@", path);
- } else {
+ }
+ else
+ {
SAL_DEBUG("--- saved image " << baseName << " to " << [path UTF8String]);
}
@@ -88,16 +88,17 @@ static void writeImageToFile(CGImageRef image, const char *baseName)
static bool isValidBitCount( sal_uInt16 nBitCount )
{
- return (nBitCount == 1) || (nBitCount == 4) || (nBitCount == 8) || (nBitCount == 16) || (nBitCount == 24) || (nBitCount == 32);
+ return (nBitCount == 1) || (nBitCount == 4) || (nBitCount == 8) ||
+ (nBitCount == 16) || (nBitCount == 24) || (nBitCount == 32);
}
QuartzSalBitmap::QuartzSalBitmap()
-: mxGraphicContext( NULL )
-, mxCachedImage( NULL )
-, mnBits(0)
-, mnWidth(0)
-, mnHeight(0)
-, mnBytesPerRow(0)
+ : mxGraphicContext( NULL )
+ , mxCachedImage( NULL )
+ , mnBits(0)
+ , mnWidth(0)
+ , mnHeight(0)
+ , mnBytesPerRow(0)
{
}
@@ -114,14 +115,18 @@ bool QuartzSalBitmap::Create( CGLayerRef xLayer, int nBitmapBits,
// sanitize input parameters
if( nX < 0 )
nWidth += nX, nX = 0;
+
if( nY < 0 )
nHeight += nY, nY = 0;
+
const CGSize aLayerSize = CGLayerGetSize( xLayer );
- CG_TRACE( "CGLayerGetSize(" << xLayer << ") = " << aLayerSize );
+ SAL_INFO("vcl.cg", "CGLayerGetSize(" << xLayer << ") = " << aLayerSize );
if( nWidth >= (int)aLayerSize.width - nX )
nWidth = (int)aLayerSize.width - nX;
+
if( nHeight >= (int)aLayerSize.height - nY )
nHeight = (int)aLayerSize.height - nY;
+
if( (nWidth < 0) || (nHeight < 0) )
nWidth = nHeight = 0;
@@ -137,7 +142,7 @@ bool QuartzSalBitmap::Create( CGLayerRef xLayer, int nBitmapBits,
const CGPoint aSrcPoint = { static_cast<CGFloat>(-nX), static_cast<CGFloat>(-nY) };
if(mxGraphicContext) // remove warning
{
- CG_TRACE( "CGContextDrawLayerAtPoint(" << mxGraphicContext << "," << aSrcPoint << "," << xLayer << ")" );
+ SAL_INFO("vcl.cg", "CGContextDrawLayerAtPoint(" << mxGraphicContext << "," << aSrcPoint << "," << xLayer << ")" );
CGContextDrawLayerAtPoint( mxGraphicContext, aSrcPoint, xLayer );
}
return true;
@@ -147,6 +152,7 @@ bool QuartzSalBitmap::Create( const Size& rSize, sal_uInt16 nBits, const BitmapP
{
if( !isValidBitCount( nBits ) )
return false;
+
maPalette = rBitmapPalette;
mnBits = nBits;
mnWidth = rSize.Width();
@@ -177,14 +183,18 @@ bool QuartzSalBitmap::Create( const SalBitmap& rSalBmp, sal_uInt16 nNewBitCount
if( AllocateUserData() )
{
- ConvertBitmapData( mnWidth, mnHeight, mnBits, mnBytesPerRow, maPalette, maUserBuffer.get(), rSourceBitmap.mnBits, rSourceBitmap.mnBytesPerRow, rSourceBitmap.maPalette, rSourceBitmap.maUserBuffer.get() );
+ ConvertBitmapData( mnWidth, mnHeight, mnBits, mnBytesPerRow, maPalette,
+ maUserBuffer.get(), rSourceBitmap.mnBits,
+ rSourceBitmap.mnBytesPerRow, rSourceBitmap.maPalette,
+ rSourceBitmap.maUserBuffer.get() );
return true;
}
}
return false;
}
-bool QuartzSalBitmap::Create( const ::com::sun::star::uno::Reference< ::com::sun::star::rendering::XBitmapCanvas >& /*xBitmapCanvas*/, Size& /*rSize*/, bool /*bMask*/ )
+bool QuartzSalBitmap::Create( const css::uno::Reference< css::rendering::XBitmapCanvas >& /*xBitmapCanvas*/,
+ Size& /*rSize*/, bool /*bMask*/ )
{
return false;
}
@@ -199,14 +209,14 @@ void QuartzSalBitmap::DestroyContext()
{
if( mxCachedImage )
{
- CG_TRACE( "CGImageRelease(" << mxCachedImage << ")" );
+ SAL_INFO("vcl.cg", "CGImageRelease(" << mxCachedImage << ")" );
CGImageRelease( mxCachedImage );
mxCachedImage = NULL;
}
if( mxGraphicContext )
{
- CG_TRACE( "CGContextRelease(" << mxGraphicContext << ")" );
+ SAL_INFO("vcl.cg", "CGContextRelease(" << mxGraphicContext << ")" );
CGContextRelease( mxGraphicContext );
mxGraphicContext = NULL;
maContextBuffer.reset();
@@ -257,9 +267,11 @@ bool QuartzSalBitmap::CreateContext()
#endif
if( !bSkipConversion )
+ {
ConvertBitmapData( mnWidth, mnHeight,
- 32, nContextBytesPerRow, maPalette, maContextBuffer.get(),
- mnBits, mnBytesPerRow, maPalette, maUserBuffer.get() );
+ 32, nContextBytesPerRow, maPalette, maContextBuffer.get(),
+ mnBits, mnBytesPerRow, maPalette, maUserBuffer.get() );
+ }
}
catch( const std::bad_alloc& )
{
@@ -270,8 +282,9 @@ bool QuartzSalBitmap::CreateContext()
if( maContextBuffer.get() )
{
mxGraphicContext = CGBitmapContextCreate( maContextBuffer.get(), mnWidth, mnHeight,
- bitsPerComponent, nContextBytesPerRow, aCGColorSpace, aCGBmpInfo );
- CG_TRACE( "CGBitmapContextCreate(" << mnWidth << "x" << mnHeight << "x" << bitsPerComponent << ") = " << mxGraphicContext );
+ bitsPerComponent, nContextBytesPerRow,
+ aCGColorSpace, aCGBmpInfo );
+ SAL_INFO("vcl.cg", "CGBitmapContextCreate(" << mnWidth << "x" << mnHeight << "x" << bitsPerComponent << ") = " << mxGraphicContext );
}
if( !mxGraphicContext )
@@ -302,8 +315,8 @@ bool QuartzSalBitmap::AllocateUserData()
}
bool alloc = false;
- if (mnBytesPerRow != 0
- && mnBytesPerRow <= std::numeric_limits<sal_uInt32>::max() / mnHeight)
+ if (mnBytesPerRow != 0 &&
+ mnBytesPerRow <= std::numeric_limits<sal_uInt32>::max() / mnHeight)
{
try
{
@@ -314,8 +327,7 @@ bool QuartzSalBitmap::AllocateUserData()
}
if (!alloc)
{
- SAL_WARN(
- "vcl.quartz", "bad alloc " << mnBytesPerRow << "x" << mnHeight);
+ SAL_WARN( "vcl.quartz", "bad alloc " << mnBytesPerRow << "x" << mnHeight);
maUserBuffer.reset( static_cast<sal_uInt8*>(NULL) );
mnBytesPerRow = 0;
}
@@ -323,7 +335,9 @@ bool QuartzSalBitmap::AllocateUserData()
else
{
for (size_t i = 0; i < mnBytesPerRow * mnHeight; i++)
+ {
maUserBuffer.get()[i] = (i & 0xFF);
+ }
}
#endif
@@ -429,23 +443,25 @@ private:
public:
explicit ImplPixelFormat8( const BitmapPalette& rPalette )
- : mrPalette( rPalette )
- {
- }
+ : mrPalette( rPalette )
+ {
+ }
virtual void StartLine( sal_uInt8* pLine ) SAL_OVERRIDE { pData = pLine; }
virtual void SkipPixel( sal_uInt32 nPixel ) SAL_OVERRIDE
- {
- pData += nPixel;
- }
+ {
+ pData += nPixel;
+ }
virtual ColorData ReadPixel() SAL_OVERRIDE
- {
- return mrPalette[ *pData++ ].operator Color().GetColor();
- }
+ {
+ return mrPalette[ *pData++ ].operator Color().GetColor();
+ }
virtual void WritePixel( ColorData nColor ) SAL_OVERRIDE
- {
- const BitmapColor aColor( COLORDATA_RED( nColor ), COLORDATA_GREEN( nColor ), COLORDATA_BLUE( nColor ) );
- *pData++ = static_cast< sal_uInt8 >( mrPalette.GetBestIndex( aColor ) );
- }
+ {
+ const BitmapColor aColor( COLORDATA_RED( nColor ),
+ COLORDATA_GREEN( nColor ),
+ COLORDATA_BLUE( nColor ) );
+ *pData++ = static_cast< sal_uInt8 >( mrPalette.GetBestIndex( aColor ) );
+ }
};
class ImplPixelFormat4 : public ImplPixelFormat
@@ -458,36 +474,40 @@ private:
public:
explicit ImplPixelFormat4( const BitmapPalette& rPalette )
- : mrPalette( rPalette )
- {
- }
+ : mrPalette( rPalette )
+ {
+ }
virtual void SkipPixel( sal_uInt32 nPixel ) SAL_OVERRIDE
- {
- mnX += nPixel;
- if( (nPixel & 1) )
- mnShift ^= 4;
- }
+ {
+ mnX += nPixel;
+ if( (nPixel & 1) )
+ {
+ mnShift ^= 4;
+ }
+ }
virtual void StartLine( sal_uInt8* pLine ) SAL_OVERRIDE
- {
- pData = pLine;
- mnX = 0;
- mnShift = 4;
- }
+ {
+ pData = pLine;
+ mnX = 0;
+ mnShift = 4;
+ }
virtual ColorData ReadPixel() SAL_OVERRIDE
- {
- const BitmapColor& rColor = mrPalette[( pData[mnX >> 1] >> mnShift) & 0x0f];
- mnX++;
- mnShift ^= 4;
- return rColor.operator Color().GetColor();
- }
+ {
+ const BitmapColor& rColor = mrPalette[( pData[mnX >> 1] >> mnShift) & 0x0f];
+ mnX++;
+ mnShift ^= 4;
+ return rColor.operator Color().GetColor();
+ }
virtual void WritePixel( ColorData nColor ) SAL_OVERRIDE
- {
- const BitmapColor aColor( COLORDATA_RED( nColor ), COLORDATA_GREEN( nColor ), COLORDATA_BLUE( nColor ) );
- pData[mnX>>1] &= (0xf0 >> mnShift);
- pData[mnX>>1] |= (static_cast< sal_uInt8 >( mrPalette.GetBestIndex( aColor ) ) & 0x0f);
- mnX++;
- mnShift ^= 4;
- }
+ {
+ const BitmapColor aColor( COLORDATA_RED( nColor ),
+ COLORDATA_GREEN( nColor ),
+ COLORDATA_BLUE( nColor ) );
+ pData[mnX>>1] &= (0xf0 >> mnShift);
+ pData[mnX>>1] |= (static_cast< sal_uInt8 >( mrPalette.GetBestIndex( aColor ) ) & 0x0f);
+ mnX++;
+ mnShift ^= 4;
+ }
};
class ImplPixelFormat1 : public ImplPixelFormat
@@ -499,33 +519,39 @@ private:
public:
explicit ImplPixelFormat1( const BitmapPalette& rPalette )
- : mrPalette( rPalette )
- {
- }
+ : mrPalette( rPalette )
+ {
+ }
virtual void SkipPixel( sal_uInt32 nPixel ) SAL_OVERRIDE
- {
- mnX += nPixel;
- }
+ {
+ mnX += nPixel;
+ }
virtual void StartLine( sal_uInt8* pLine ) SAL_OVERRIDE
- {
- pData = pLine;
- mnX = 0;
- }
+ {
+ pData = pLine;
+ mnX = 0;
+ }
virtual ColorData ReadPixel() SAL_OVERRIDE
- {
- const BitmapColor& rColor = mrPalette[ (pData[mnX >> 3 ] >> ( 7 - ( mnX & 7 ) )) & 1];
- mnX++;
- return rColor.operator Color().GetColor();
- }
+ {
+ const BitmapColor& rColor = mrPalette[ (pData[mnX >> 3 ] >> ( 7 - ( mnX & 7 ) )) & 1];
+ mnX++;
+ return rColor.operator Color().GetColor();
+ }
virtual void WritePixel( ColorData nColor ) SAL_OVERRIDE
- {
- const BitmapColor aColor( COLORDATA_RED( nColor ), COLORDATA_GREEN( nColor ), COLORDATA_BLUE( nColor ) );
- if( mrPalette.GetBestIndex( aColor ) & 1 )
- pData[ mnX >> 3 ] |= 1 << ( 7 - ( mnX & 7 ) );
- else
- pData[ mnX >> 3 ] &= ~( 1 << ( 7 - ( mnX & 7 ) ) );
- mnX++;
- }
+ {
+ const BitmapColor aColor( COLORDATA_RED( nColor ),
+ COLORDATA_GREEN( nColor ),
+ COLORDATA_BLUE( nColor ) );
+ if( mrPalette.GetBestIndex( aColor ) & 1 )
+ {
+ pData[ mnX >> 3 ] |= 1 << ( 7 - ( mnX & 7 ) );
+ }
+ else
+ {
+ pData[ mnX >> 3 ] &= ~( 1 << ( 7 - ( mnX & 7 ) ) );
+ }
+ mnX++;
+ }
};
ImplPixelFormat* ImplPixelFormat::GetFormat( sal_uInt16 nBits, const BitmapPalette& rPalette )
@@ -538,19 +564,25 @@ ImplPixelFormat* ImplPixelFormat::GetFormat( sal_uInt16 nBits, const BitmapPalet
case 16: return new ImplPixelFormat16;
case 24: return new ImplPixelFormat24;
case 32: return new ImplPixelFormat32;
+ default:
+ assert(false);
+ return nullptr;
}
return 0;
}
-}
+} // namespace
void QuartzSalBitmap::ConvertBitmapData( sal_uInt32 nWidth, sal_uInt32 nHeight,
- sal_uInt16 nDestBits, sal_uInt32 nDestBytesPerRow, const BitmapPalette& rDestPalette, sal_uInt8* pDestData,
- sal_uInt16 nSrcBits, sal_uInt32 nSrcBytesPerRow, const BitmapPalette& rSrcPalette, sal_uInt8* pSrcData )
+ sal_uInt16 nDestBits, sal_uInt32 nDestBytesPerRow,
+ const BitmapPalette& rDestPalette, sal_uInt8* pDestData,
+ sal_uInt16 nSrcBits, sal_uInt32 nSrcBytesPerRow,
+ const BitmapPalette& rSrcPalette, sal_uInt8* pSrcData )
{
- if( (nDestBytesPerRow == nSrcBytesPerRow) && (nDestBits == nSrcBits) && ((nSrcBits != 8) || (rDestPalette.operator==( rSrcPalette ))) )
+ if( (nDestBytesPerRow == nSrcBytesPerRow) &&
+ (nDestBits == nSrcBits) && ((nSrcBits != 8) || (rDestPalette.operator==( rSrcPalette ))) )
{
// simple case, same format, so just copy
memcpy( pDestData, pSrcData, nHeight * nDestBytesPerRow );
@@ -598,8 +630,9 @@ void QuartzSalBitmap::ConvertBitmapData( sal_uInt32 nWidth, sal_uInt32 nHeight,
sal_uInt32 nX = nWidth;
while( nX-- )
+ {
pD->WritePixel( pS->ReadPixel() );
-
+ }
pSrcData += nSrcBytesPerRow;
pDestData += nDestBytesPerRow;
}
@@ -671,7 +704,7 @@ const BitmapPalette& GetDefaultPalette( int mnBits, bool bMonochrome )
aDefPalette256[i] = BitmapColor( aImplSalSysPalEntryAry[i].mnRed,
aImplSalSysPalEntryAry[i].mnGreen,
aImplSalSysPalEntryAry[i].mnBlue );
- }
+ }
aDefPalette2[0] = BitmapColor( 0, 0, 0 );
aDefPalette2[1] = BitmapColor( 0xff, 0xff, 0xff );
@@ -753,7 +786,9 @@ void QuartzSalBitmap::ReleaseBuffer( BitmapBuffer* pBuffer, BitmapAccessMode nMo
{
maPalette = pBuffer->maPalette;
if( mxGraphicContext )
+ {
DestroyContext();
+ }
}
delete pBuffer;
@@ -764,11 +799,14 @@ CGImageRef QuartzSalBitmap::CreateCroppedImage( int nX, int nY, int nNewWidth, i
if( !mxCachedImage )
{
if( !mxGraphicContext )
+ {
if( !const_cast<QuartzSalBitmap*>(this)->CreateContext() )
+ {
return NULL;
-
+ }
+ }
mxCachedImage = CGBitmapContextCreateImage( mxGraphicContext );
- CG_TRACE( "CGBitmapContextCreateImage(" << mxGraphicContext << ") = " << mxCachedImage );
+ SAL_INFO("vcl.cg", "CGBitmapContextCreateImage(" << mxGraphicContext << ") = " << mxCachedImage );
}
CGImageRef xCroppedImage = NULL;
@@ -776,7 +814,7 @@ CGImageRef QuartzSalBitmap::CreateCroppedImage( int nX, int nY, int nNewWidth, i
if( !nX && !nY && (mnWidth == nNewWidth) && (mnHeight == nNewHeight) )
{
xCroppedImage = mxCachedImage;
- CG_TRACE( "CFRetain(" << xCroppedImage << ")" );
+ SAL_INFO("vcl.cg", "CFRetain(" << xCroppedImage << ")" );
CFRetain( xCroppedImage );
}
else
@@ -784,7 +822,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 );
+ SAL_INFO("vcl.cg", "CGImageCreateWithImageInRect(" << mxCachedImage << "," << aCropRect << ") = " << xCroppedImage );
}
return xCroppedImage;
@@ -819,18 +857,19 @@ 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," << nMaskBytesPerRow << ") = " << xMaskContext );
- CG_TRACE( "CGContextDrawImage(" << xMaskContext << "," << xImageRect << "," << xMask << ")" );
+ SAL_INFO("vcl.cg", "CGBitmapContextCreate(" << nWidth << "x" << nHeight << "x8," << nMaskBytesPerRow << ") = " << xMaskContext );
+ SAL_INFO("vcl.cg", "CGContextDrawImage(" << xMaskContext << "," << xImageRect << "," << xMask << ")" );
CGContextDrawImage( xMaskContext, xImageRect, xMask );
- CG_TRACE( "CFRelease(" << xMask << ")" );
+ SAL_INFO("vcl.cg", "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 );
+ SAL_INFO("vcl.cg", "CGImageMaskCreate(" << nWidth << "," << nHeight << ",8,8) = " << xMask );
CFRelease( xDataProvider );
- CG_TRACE( "CFRelease(" << xMaskContext << ")" );
+ SAL_INFO("vcl.cg", "CFRelease(" << xMaskContext << ")" );
CFRelease( xMaskContext );
}
@@ -839,18 +878,20 @@ CGImageRef QuartzSalBitmap::CreateWithMask( const QuartzSalBitmap& rMask,
// combine image and alpha mask
CGImageRef xMaskedImage = CGImageCreateWithMask( xImage, xMask );
- CG_TRACE( "CGImageCreateWithMask(" << xImage << "," << xMask << ") = " << xMaskedImage );
+ SAL_INFO("vcl.cg", "CGImageCreateWithMask(" << xImage << "," << xMask << ") = " << xMaskedImage );
DBG_WRITE_IMAGE(xImage, "xImage");
DBG_WRITE_IMAGE(xMaskedImage, "xMaskedImage");
- CG_TRACE( "CFRelease(" << xMask << ")" );
+ SAL_INFO("vcl.cg", "CFRelease(" << xMask << ")" );
CFRelease( xMask );
- CG_TRACE( "CFRelease(" << xImage << ")" );
+ SAL_INFO("vcl.cg", "CFRelease(" << xImage << ")" );
CFRelease( xImage );
return xMaskedImage;
}
-/** creates an image from the given rectangle, replacing all black pixels with nMaskColor and make all other full transparent */
-CGImageRef QuartzSalBitmap::CreateColorMask( int nX, int nY, int nWidth, int nHeight, SalColor nMaskColor ) const
+/** creates an image from the given rectangle, replacing all black pixels
+ with nMaskColor and make all other full transparent */
+CGImageRef QuartzSalBitmap::CreateColorMask( int nX, int nY, int nWidth,
+ int nHeight, SalColor nMaskColor ) const
{
CGImageRef xMask = 0;
if( maUserBuffer.get() && (nX + nWidth <= mnWidth) && (nY + nHeight <= mnHeight) )
@@ -888,7 +929,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 );
+ SAL_INFO("vcl.cg", "CGImageCreate(" << nWidth << "x" << nHeight << "x8) = " << xMask );
CFRelease(xDataProvider);
}
else
@@ -918,14 +959,15 @@ bool QuartzSalBitmap::GetSystemData( BitmapSystemData& rData )
bRet = true;
if ((CGBitmapContextGetBitsPerPixel(mxGraphicContext) == 32) &&
- (CGBitmapContextGetBitmapInfo(mxGraphicContext) & kCGBitmapByteOrderMask) != kCGBitmapByteOrder32Host) {
+ (CGBitmapContextGetBitmapInfo(mxGraphicContext) & kCGBitmapByteOrderMask) != kCGBitmapByteOrder32Host)
+ {
/**
* We need to hack things because VCL does not use kCGBitmapByteOrder32Host, while Cairo requires it.
*/
OSL_TRACE("QuartzSalBitmap::%s(): kCGBitmapByteOrder32Host not found => inserting it.",__func__);
CGImageRef xImage = CGBitmapContextCreateImage (mxGraphicContext);
- CG_TRACE( "CGBitmapContextCreateImage(" << mxGraphicContext << ") = " << xImage );
+ SAL_INFO("vcl.cg", "CGBitmapContextCreateImage(" << mxGraphicContext << ") = " << xImage );
// re-create the context with single change: include kCGBitmapByteOrder32Host flag.
CGContextRef mxGraphicContextNew = CGBitmapContextCreate( CGBitmapContextGetData(mxGraphicContext),
@@ -935,27 +977,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 );
+ SAL_INFO("vcl.cg", "CGBitmapContextCreate(" << CGBitmapContextGetWidth(mxGraphicContext) << "x" << CGBitmapContextGetHeight(mxGraphicContext) << "x" << CGBitmapContextGetBitsPerComponent(mxGraphicContext) << ") = " << mxGraphicContextNew );
- CG_TRACE( "CFRelease(" << mxGraphicContext << ")" );
+ SAL_INFO("vcl.cg", "CFRelease(" << mxGraphicContext << ")" );
CFRelease(mxGraphicContext);
// Needs to be flipped
- CG_TRACE( "CGContextSaveGState(" << mxGraphicContextNew << ")" );
+ SAL_INFO("vcl.cg", "CGContextSaveGState(" << mxGraphicContextNew << ")" );
CGContextSaveGState( mxGraphicContextNew );
- CG_TRACE( "CGContextTranslateCTM(" << mxGraphicContextNew << ",0," << CGBitmapContextGetHeight(mxGraphicContextNew) << ")" );
+ SAL_INFO("vcl.cg", "CGContextTranslateCTM(" << mxGraphicContextNew << ",0," << CGBitmapContextGetHeight(mxGraphicContextNew) << ")" );
CGContextTranslateCTM (mxGraphicContextNew, 0, CGBitmapContextGetHeight(mxGraphicContextNew));
- CG_TRACE( "CGContextScaleCTM(" << mxGraphicContextNew << ",1,-1)" );
+ SAL_INFO("vcl.cg", "CGContextScaleCTM(" << mxGraphicContextNew << ",1,-1)" );
CGContextScaleCTM (mxGraphicContextNew, 1.0, -1.0);
- CG_TRACE( "CGContextDrawImage(" << mxGraphicContextNew << "," << CGRectMake(0, 0, CGImageGetWidth(xImage), CGImageGetHeight(xImage)) << "," << xImage << ")" );
+ SAL_INFO("vcl.cg", "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 << ")" );
+ SAL_INFO("vcl.cg", "CGContextRestoreGState(" << mxGraphicContextNew << ")" );
CGContextRestoreGState( mxGraphicContextNew );
- CG_TRACE( "CGImageRelease(" << xImage << ")" );
+ SAL_INFO("vcl.cg", "CGImageRelease(" << xImage << ")" );
CGImageRelease( xImage );
mxGraphicContext = mxGraphicContextNew;
}
diff --git a/vcl/quartz/salgdi.cxx b/vcl/quartz/salgdi.cxx
index f900bfa949aa..ec7b0e006d09 100644
--- a/vcl/quartz/salgdi.cxx
+++ b/vcl/quartz/salgdi.cxx
@@ -17,75 +17,68 @@
* the License at http://www.apache.org/licenses/LICENSE-2.0 .
*/
+#include <sal/config.h>
#include <config_folders.h>
-#include "sal/config.h"
-
-#include "osl/file.hxx"
-#include "osl/process.h"
-
-#include "osl/mutex.hxx"
-
-#include "rtl/bootstrap.h"
-#include "rtl/strbuf.hxx"
-
-#include "basegfx/range/b2drectangle.hxx"
-#include "basegfx/polygon/b2dpolygon.hxx"
-#include "basegfx/polygon/b2dpolygontools.hxx"
-#include "basegfx/matrix/b2dhommatrix.hxx"
-#include "basegfx/matrix/b2dhommatrixtools.hxx"
-
-#include "vcl/sysdata.hxx"
-#include "vcl/svapp.hxx"
-#include "vcl/metric.hxx"
+#include <basebmp/scanlineformats.hxx>
+#include <basegfx/matrix/b2dhommatrix.hxx>
+#include <basegfx/matrix/b2dhommatrixtools.hxx>
+#include <basegfx/polygon/b2dpolygon.hxx>
+#include <basegfx/polygon/b2dpolygontools.hxx>
+#include <basegfx/range/b2drectangle.hxx>
+#include <osl/file.hxx>
+#include <osl/mutex.hxx>
+#include <osl/process.h>
+#include <rtl/bootstrap.h>
+#include <rtl/strbuf.hxx>
+
+#include <vcl/metric.hxx>
+#include <vcl/svapp.hxx>
+#include <vcl/sysdata.hxx>
+#include "ctfonts.hxx"
+#include "fontsubset.hxx"
#include "impfont.hxx"
-
-#include "quartz/salgdi.h"
-#include "quartz/utils.h"
-
#ifdef MACOSX
#include "osx/salframe.h"
#endif
-
+#include "quartz/salgdi.h"
+#include "quartz/utils.h"
#ifdef IOS
#include "saldatabasic.hxx"
-#include <basebmp/scanlineformats.hxx>
#endif
-
-#include "ctfonts.hxx"
-
-#include "fontsubset.hxx"
#include "sallayout.hxx"
#include "sft.hxx"
using namespace vcl;
CoreTextFontData::CoreTextFontData( const CoreTextFontData& rSrc )
-: PhysicalFontFace( rSrc )
-, mnFontId( rSrc.mnFontId )
-, mbOs2Read( rSrc.mbOs2Read )
-, mbHasOs2Table( rSrc.mbHasOs2Table )
-, mbCmapEncodingRead( rSrc.mbCmapEncodingRead )
+ : PhysicalFontFace( rSrc )
+ , mnFontId( rSrc.mnFontId )
+ , mbOs2Read( rSrc.mbOs2Read )
+ , mbHasOs2Table( rSrc.mbHasOs2Table )
+ , mbCmapEncodingRead( rSrc.mbCmapEncodingRead )
{
if( rSrc.mpCharMap )
mpCharMap = rSrc.mpCharMap;
}
CoreTextFontData::CoreTextFontData( const ImplDevFontAttributes& rDFA, sal_IntPtr nFontId )
-: PhysicalFontFace( rDFA, 0 )
-, mnFontId( nFontId )
-, mbOs2Read( false )
-, mbHasOs2Table( false )
-, mbCmapEncodingRead( false )
-, mbFontCapabilitiesRead( false )
+ : PhysicalFontFace( rDFA, 0 )
+ , mnFontId( nFontId )
+ , mbOs2Read( false )
+ , mbHasOs2Table( false )
+ , mbCmapEncodingRead( false )
+ , mbFontCapabilitiesRead( false )
{
}
CoreTextFontData::~CoreTextFontData()
{
if( mpCharMap )
+ {
mpCharMap = 0;
+ }
}
sal_IntPtr CoreTextFontData::GetFontId() const
@@ -118,6 +111,7 @@ const FontCharMapPtr CoreTextFontData::GetFontCharMap() const
DBG_ASSERT( (nRawLength > 0), "CoreTextFontData::GetFontCharMap : GetFontTable2 failed!\n");
if( nRawLength <= 0 )
return mpCharMap;
+
DBG_ASSERT( (nBufSize==nRawLength), "CoreTextFontData::GetFontCharMap : ByteCount mismatch!\n");
// parse the CMAP
@@ -167,10 +161,9 @@ bool CoreTextFontData::GetFontCapabilities(vcl::FontCapabilities &rFontCapabilit
if( nRawLength > 0 )
{
const unsigned char* pOS2Table = &aBuffer[0];
- vcl::getTTCoverage(
- maFontCapabilities.maUnicodeRange,
- maFontCapabilities.maCodePageRange,
- pOS2Table, nRawLength);
+ vcl::getTTCoverage( maFontCapabilities.maUnicodeRange,
+ maFontCapabilities.maCodePageRange,
+ pOS2Table, nRawLength);
}
}
rFontCapabilities = maFontCapabilities;
@@ -182,6 +175,7 @@ void CoreTextFontData::ReadOs2Table() const
// read this only once per font
if( mbOs2Read )
return;
+
mbOs2Read = true;
mbHasOs2Table = false;
@@ -197,6 +191,7 @@ void CoreTextFontData::ReadOs2Table() const
DBG_ASSERT( (nRawLength > 0), "CoreTextFontData::ReadOs2Table : GetFontTable2 failed!\n");
if( nRawLength <= 0 )
return;
+
DBG_ASSERT( (nBufSize==nRawLength), "CoreTextFontData::ReadOs2Table : ByteCount mismatch!\n");
mbHasOs2Table = true;
@@ -209,6 +204,7 @@ void CoreTextFontData::ReadMacCmapEncoding() const
// read this only once per font
if( mbCmapEncodingRead )
return;
+
mbCmapEncodingRead = true;
const int nBufSize = GetFontTable( "cmap", NULL );
@@ -227,12 +223,12 @@ void CoreTextFontData::ReadMacCmapEncoding() const
return;
}
-AquaSalGraphics::AquaSalGraphics():
+AquaSalGraphics::AquaSalGraphics()
+ : mxLayer( NULL )
+ , mrContext( NULL )
#ifdef MACOSX
- mpFrame( NULL ),
+ , mpFrame( NULL )
#endif
- mxLayer( NULL )
- , mrContext( NULL )
#if OSL_DEBUG_LEVEL > 0
, mnContextStackDepth( 0 )
#endif
@@ -267,7 +263,7 @@ AquaSalGraphics::~AquaSalGraphics()
if( mxClipPath )
{
- CG_TRACE( "CGPathRelease(" << mxClipPath << ")" );
+ SAL_INFO("vcl.cg", "CGPathRelease(" << mxClipPath << ")" );
CGPathRelease( mxClipPath );
}
@@ -282,7 +278,7 @@ AquaSalGraphics::~AquaSalGraphics()
#endif
if( mxLayer )
{
- CG_TRACE( "CGLayerRelease(" << mxLayer << ")" );
+ SAL_INFO("vcl.cg", "CGLayerRelease(" << mxLayer << ")" );
CGLayerRelease( mxLayer );
}
else if( mrContext
@@ -292,7 +288,7 @@ AquaSalGraphics::~AquaSalGraphics()
)
{
// destroy backbuffer bitmap context that we created ourself
- CG_TRACE( "CGContextRelease(" << mrContext << ")" );
+ SAL_INFO("vcl.cg", "CGContextRelease(" << mrContext << ")" );
CGContextRelease( mrContext );
mrContext = NULL;
}
@@ -346,7 +342,9 @@ static void AddTempFontDir( const OUString &rFontDirUrl )
osl::FileStatus aFileStatus( osl_FileStatus_Mask_FileURL );
rcOSL = aDirItem.getFileStatus( aFileStatus );
if ( rcOSL == osl::FileBase::E_None )
+ {
AddTempDevFont(aFileStatus.getFileURL());
+ }
}
}
}
@@ -356,6 +354,7 @@ static void AddLocalTempFontDirs()
static bool bFirst = true;
if( !bFirst )
return;
+
bFirst = false;
// add private font files
@@ -477,7 +476,7 @@ bool AquaSalGraphics::GetFontCapabilities(vcl::FontCapabilities &rFontCapabiliti
// fake a SFNT font directory entry for a font table
// see http://developer.apple.com/fonts/TTRefMan/RM06/Chap6.html#Directory
static void FakeDirEntry( const char aTag[5], ByteCount nOfs, ByteCount nLen,
- const unsigned char* /*pData*/, unsigned char*& rpDest )
+ const unsigned char* /*pData*/, unsigned char*& rpDest )
{
// write entry tag
rpDest[ 0] = aTag[0];
@@ -518,7 +517,9 @@ bool AquaSalGraphics::GetRawFontData( const PhysicalFontFace* pFontData,
rBuffer.resize( nCffSize);
const int nCffRead = pMacFont->GetFontTable( "CFF ", &rBuffer[0]);
if( nCffRead != nCffSize)
+ {
return false;
+ }
return true;
}
}
@@ -527,18 +528,23 @@ bool AquaSalGraphics::GetRawFontData( const PhysicalFontFace* pFontData,
const int nHeadSize = pMacFont->GetFontTable( "head", NULL);
if( nHeadSize <= 0)
return false;
+
const int nMaxpSize = pMacFont->GetFontTable( "maxp", NULL);
if( nMaxpSize <= 0)
return false;
+
const int nCmapSize = pMacFont->GetFontTable( "cmap", NULL);
if( nCmapSize <= 0)
return false;
+
const int nNameSize = pMacFont->GetFontTable( "name", NULL);
if( nNameSize <= 0)
return false;
+
const int nHheaSize = pMacFont->GetFontTable( "hhea", NULL);
if( nHheaSize <= 0)
return false;
+
const int nHmtxSize = pMacFont->GetFontTable( "hmtx", NULL);
if( nHmtxSize <= 0)
return false;
@@ -551,6 +557,7 @@ bool AquaSalGraphics::GetRawFontData( const PhysicalFontFace* pFontData,
nLocaSize = pMacFont->GetFontTable( "loca", NULL);
if( nLocaSize <= 0)
return false;
+
nGlyfSize = pMacFont->GetFontTable( "glyf", NULL);
if( nGlyfSize <= 0)
return false;
@@ -570,10 +577,15 @@ bool AquaSalGraphics::GetRawFontData( const PhysicalFontFace* pFontData,
const ByteCount nFdirSize = 12 + 16*nTableCount;
ByteCount nTotalSize = nFdirSize;
nTotalSize += nHeadSize + nMaxpSize + nNameSize + nCmapSize;
+
if( nGlyfSize )
+ {
nTotalSize += nLocaSize + nGlyfSize;
+ }
else
+ {
nTotalSize += nCffSize;
+ }
nTotalSize += nHheaSize + nHmtxSize;
nTotalSize += nPrepSize + nCvtSize + nFpgmSize;
rBuffer.resize( nTotalSize );
@@ -595,58 +607,78 @@ bool AquaSalGraphics::GetRawFontData( const PhysicalFontFace* pFontData,
unsigned char* pFakeEntry = &rBuffer[12];
if( nCmapSize != pMacFont->GetFontTable( "cmap", &rBuffer[nOfs]))
return false;
+
FakeDirEntry( "cmap", nOfs, nCmapSize, &rBuffer[0], pFakeEntry );
nOfs += nCmapSize;
- if( nCvtSize ) {
+ if( nCvtSize )
+ {
if( nCvtSize != pMacFont->GetFontTable( "cvt ", &rBuffer[nOfs]))
return false;
+
FakeDirEntry( "cvt ", nOfs, nCvtSize, &rBuffer[0], pFakeEntry );
nOfs += nCvtSize;
}
- if( nFpgmSize ) {
+ if( nFpgmSize )
+ {
if( nFpgmSize != pMacFont->GetFontTable( "fpgm", &rBuffer[nOfs]))
return false;
+
FakeDirEntry( "fpgm", nOfs, nFpgmSize, &rBuffer[0], pFakeEntry );
nOfs += nFpgmSize;
}
- if( nCffSize ) {
+ if( nCffSize )
+ {
if( nCffSize != pMacFont->GetFontTable( "CFF ", &rBuffer[nOfs]))
return false;
+
FakeDirEntry( "CFF ", nOfs, nCffSize, &rBuffer[0], pFakeEntry );
nOfs += nGlyfSize;
- } else {
+ }
+ else
+ {
if( nGlyfSize != pMacFont->GetFontTable( "glyf", &rBuffer[nOfs]))
return false;
+
FakeDirEntry( "glyf", nOfs, nGlyfSize, &rBuffer[0], pFakeEntry );
nOfs += nGlyfSize;
+
if( nLocaSize != pMacFont->GetFontTable( "loca", &rBuffer[nOfs]))
return false;
+
FakeDirEntry( "loca", nOfs, nLocaSize, &rBuffer[0], pFakeEntry );
nOfs += nLocaSize;
}
if( nHeadSize != pMacFont->GetFontTable( "head", &rBuffer[nOfs]))
return false;
+
FakeDirEntry( "head", nOfs, nHeadSize, &rBuffer[0], pFakeEntry );
nOfs += nHeadSize;
+
if( nHheaSize != pMacFont->GetFontTable( "hhea", &rBuffer[nOfs]))
return false;
+
FakeDirEntry( "hhea", nOfs, nHheaSize, &rBuffer[0], pFakeEntry );
nOfs += nHheaSize;
if( nHmtxSize != pMacFont->GetFontTable( "hmtx", &rBuffer[nOfs]))
return false;
+
FakeDirEntry( "hmtx", nOfs, nHmtxSize, &rBuffer[0], pFakeEntry );
nOfs += nHmtxSize;
if( nMaxpSize != pMacFont->GetFontTable( "maxp", &rBuffer[nOfs]))
return false;
+
FakeDirEntry( "maxp", nOfs, nMaxpSize, &rBuffer[0], pFakeEntry );
nOfs += nMaxpSize;
if( nNameSize != pMacFont->GetFontTable( "name", &rBuffer[nOfs]))
return false;
+
FakeDirEntry( "name", nOfs, nNameSize, &rBuffer[0], pFakeEntry );
nOfs += nNameSize;
- if( nPrepSize ) {
+ if( nPrepSize )
+ {
if( nPrepSize != pMacFont->GetFontTable( "prep", &rBuffer[nOfs]))
return false;
+
FakeDirEntry( "prep", nOfs, nPrepSize, &rBuffer[0], pFakeEntry );
nOfs += nPrepSize;
}
@@ -662,80 +694,91 @@ void AquaSalGraphics::GetGlyphWidths( const PhysicalFontFace* pFontData, bool bV
rGlyphWidths.clear();
rUnicodeEnc.clear();
- if( pFontData->IsSubsettable() )
+ if( !pFontData->IsSubsettable() )
{
- ByteVector aBuffer;
- if( !GetRawFontData( pFontData, aBuffer, NULL ) )
- return;
-
- // TODO: modernize psprint's horrible fontsubset C-API
- // this probably only makes sense after the switch to another SCM
- // that can preserve change history after file renames
-
- // use the font subsetter to get the widths
- TrueTypeFont* pSftFont = NULL;
- int nRC = ::OpenTTFontBuffer( static_cast<void*>(&aBuffer[0]), aBuffer.size(), 0, &pSftFont);
- if( nRC != SF_OK )
- return;
-
- const int nGlyphCount = ::GetTTGlyphCount( pSftFont );
- if( nGlyphCount > 0 )
+ if( pFontData->IsEmbeddable() )
{
- // get glyph metrics
- rGlyphWidths.resize(nGlyphCount);
- std::vector<sal_uInt16> aGlyphIds(nGlyphCount);
- for( int i = 0; i < nGlyphCount; i++ )
- aGlyphIds[i] = static_cast<sal_uInt16>(i);
- const TTSimpleGlyphMetrics* pGlyphMetrics = ::GetTTSimpleGlyphMetrics(
- pSftFont, &aGlyphIds[0], nGlyphCount, bVertical );
- if( pGlyphMetrics )
+ // get individual character widths
+ OSL_FAIL("not implemented for non-subsettable fonts!\n");
+ }
+ return;
+ }
+
+ ByteVector aBuffer;
+ if( !GetRawFontData( pFontData, aBuffer, NULL ) )
+ return;
+
+ // TODO: modernize psprint's horrible fontsubset C-API
+ // this probably only makes sense after the switch to another SCM
+ // that can preserve change history after file renames
+
+ // use the font subsetter to get the widths
+ TrueTypeFont* pSftFont = NULL;
+ int nRC = ::OpenTTFontBuffer( static_cast<void*>(&aBuffer[0]), aBuffer.size(), 0, &pSftFont);
+ if( nRC != SF_OK )
+ return;
+
+ const int nGlyphCount = ::GetTTGlyphCount( pSftFont );
+ if( nGlyphCount > 0 )
+ {
+ // get glyph metrics
+ rGlyphWidths.resize(nGlyphCount);
+ std::vector<sal_uInt16> aGlyphIds(nGlyphCount);
+ for( int i = 0; i < nGlyphCount; i++ )
+ {
+ aGlyphIds[i] = static_cast<sal_uInt16>(i);
+ }
+
+ const TTSimpleGlyphMetrics* pGlyphMetrics = ::GetTTSimpleGlyphMetrics( pSftFont, &aGlyphIds[0],
+ nGlyphCount, bVertical );
+ if( pGlyphMetrics )
+ {
+ for( int i = 0; i < nGlyphCount; ++i )
{
- for( int i = 0; i < nGlyphCount; ++i )
- rGlyphWidths[i] = pGlyphMetrics[i].adv;
- free( const_cast<TTSimpleGlyphMetrics *>(pGlyphMetrics) );
+ rGlyphWidths[i] = pGlyphMetrics[i].adv;
}
+ free( const_cast<TTSimpleGlyphMetrics *>(pGlyphMetrics) );
+ }
+
+ FontCharMapPtr pMap = mpFontData->GetFontCharMap();
+ DBG_ASSERT( pMap && pMap->GetCharCount(), "no charmap" );
- FontCharMapPtr pMap = mpFontData->GetFontCharMap();
- DBG_ASSERT( pMap && pMap->GetCharCount(), "no charmap" );
+ // get unicode<->glyph encoding
+ // TODO? avoid sft mapping by using the pMap itself
+ int nCharCount = pMap->GetCharCount();
+ sal_uInt32 nChar = pMap->GetFirstChar();
+ for( ; --nCharCount >= 0; nChar = pMap->GetNextChar( nChar ) )
+ {
+ if( nChar > 0xFFFF ) // TODO: allow UTF-32 chars
+ break;
- // get unicode<->glyph encoding
- // TODO? avoid sft mapping by using the pMap itself
- int nCharCount = pMap->GetCharCount();
- sal_uInt32 nChar = pMap->GetFirstChar();
- for(; --nCharCount >= 0; nChar = pMap->GetNextChar( nChar ) )
+ sal_Ucs nUcsChar = static_cast<sal_Ucs>(nChar);
+ sal_uInt32 nGlyph = ::MapChar( pSftFont, nUcsChar, bVertical );
+ if( nGlyph > 0 )
{
- if( nChar > 0xFFFF ) // TODO: allow UTF-32 chars
- break;
- sal_Ucs nUcsChar = static_cast<sal_Ucs>(nChar);
- sal_uInt32 nGlyph = ::MapChar( pSftFont, nUcsChar, bVertical );
- if( nGlyph > 0 )
- rUnicodeEnc[ nUcsChar ] = nGlyph;
+ rUnicodeEnc[ nUcsChar ] = nGlyph;
}
-
- pMap = 0;
}
- ::CloseTTFont( pSftFont );
- }
- else if( pFontData->IsEmbeddable() )
- {
- // get individual character widths
- OSL_FAIL("not implemented for non-subsettable fonts!\n");
+ pMap = 0;
}
+
+ ::CloseTTFont( pSftFont );
}
-const Ucs2SIntMap* AquaSalGraphics::GetFontEncodingVector(
- const PhysicalFontFace*, const Ucs2OStrMap** /*ppNonEncoded*/, std::set<sal_Unicode> const** )
+const Ucs2SIntMap* AquaSalGraphics::GetFontEncodingVector( const PhysicalFontFace*,
+ const Ucs2OStrMap** /*ppNonEncoded*/,
+ std::set<sal_Unicode> const** )
{
return NULL;
}
const void* AquaSalGraphics::GetEmbedFontData( const PhysicalFontFace*,
- const sal_Ucs* /*pUnicodes*/,
- sal_Int32* /*pWidths*/,
- size_t /*nLen*/,
- FontSubsetInfo&,
- long* /*pDataLen*/ )
+ const sal_Ucs* /*pUnicodes*/,
+ sal_Int32* /*pWidths*/,
+ size_t /*nLen*/,
+ FontSubsetInfo&,
+ long* /*pDataLen*/ )
{
return NULL;
}
@@ -771,9 +814,9 @@ void AquaSalGraphics::RefreshRect(float lX, float lY, float lWidth, float lHeigh
// The decrementing of x, the rounding error and the antialiasing border
// require that the width and the height need to be increased by four
const Rectangle aVclRect(Point(static_cast<long int>(lX-1),
- static_cast<long int>(lY-1) ),
- Size( static_cast<long int>(lWidth+4),
- static_cast<long int>(lHeight+4) ) );
+ static_cast<long int>(lY-1) ),
+ Size( static_cast<long int>(lWidth+4),
+ static_cast<long int>(lHeight+4) ) );
mpFrame->maInvalidRect.Union( aVclRect );
}
#else
diff --git a/vcl/quartz/salgdicommon.cxx b/vcl/quartz/salgdicommon.cxx
index 01fac7fc087b..6a6efb52097a 100644
--- a/vcl/quartz/salgdicommon.cxx
+++ b/vcl/quartz/salgdicommon.cxx
@@ -17,27 +17,29 @@
* the License at http://www.apache.org/licenses/LICENSE-2.0 .
*/
-#include "sal/config.h"
+#include <sal/config.h>
+#include <cassert>
#include <cstring>
-#include <sal/types.h>
+#include <basegfx/polygon/b2dpolygon.hxx>
#include <osl/endian.h>
#include <osl/file.hxx>
+#include <sal/types.h>
-#include <basegfx/polygon/b2dpolygon.hxx>
+#include <vcl/sysdata.hxx>
+#include "fontsubset.hxx"
#include "quartz/salbmp.h"
+#ifdef MACOSX
#include "quartz/salgdi.h"
+#endif
#include "quartz/utils.h"
-
-#include "fontsubset.hxx"
-#include "sft.hxx"
-
#ifdef IOS
#include "saldatabasic.hxx"
-#include <vcl/sysdata.hxx>
#endif
+#include "sft.hxx"
+
#if defined(IOS) && defined(DBG_UTIL)
@@ -120,7 +122,7 @@ static void AddPolygonToPath( CGMutablePathRef xPath,
if( !nPointIdx )
{
// first point => just move there
- CG_TRACE("CGPathMoveToPoint(" << xPath << ",NULL," << aPoint.getX() << "," << aPoint.getY() << ")");
+ SAL_INFO( "vcl.cg", "CGPathMoveToPoint(" << xPath << ",NULL," << aPoint.getX() << "," << aPoint.getY() << ")");
CGPathMoveToPoint( xPath, NULL, aPoint.getX(), aPoint.getY() );
continue;
}
@@ -134,7 +136,7 @@ static void AddPolygonToPath( CGMutablePathRef xPath,
if( !bPendingCurve ) // line segment
{
- CG_TRACE("CGPathAddLineToPoint(" << xPath << ",NULL," << aPoint.getX() << "," << aPoint.getY() << ")");
+ SAL_INFO( "vcl.cg", "CGPathAddLineToPoint(" << xPath << ",NULL," << aPoint.getX() << "," << aPoint.getY() << ")");
CGPathAddLineToPoint( xPath, NULL, aPoint.getX(), aPoint.getY() );
}
else // cubic bezier segment
@@ -146,7 +148,7 @@ static void AddPolygonToPath( CGMutablePathRef xPath,
aCP1 += aHalfPointOfs;
aCP2 += aHalfPointOfs;
}
- CG_TRACE( "CGPathAddCurveToPoint(" << xPath << ",NULL," << aCP1.getX() << "," << aCP1.getY() << "," <<
+ SAL_INFO( "vcl.cg", "CGPathAddCurveToPoint(" << xPath << ",NULL," << aCP1.getX() << "," << aCP1.getY() << "," <<
aCP2.getX() << "," << aCP2.getY() << "," << aPoint.getX() << "," << aPoint.getY() << ")" );
CGPathAddCurveToPoint( xPath, NULL, aCP1.getX(), aCP1.getY(),
aCP2.getX(), aCP2.getY(), aPoint.getX(), aPoint.getY() );
@@ -155,7 +157,7 @@ static void AddPolygonToPath( CGMutablePathRef xPath,
if( bClosePath )
{
- CG_TRACE( "CGPathCloseSubpath(" << xPath << ")" );
+ SAL_INFO( "vcl.cg", "CGPathCloseSubpath(" << xPath << ")" );
CGPathCloseSubpath( xPath );
}
}
@@ -188,15 +190,19 @@ bool AquaSalGraphics::CreateFontSubset( const OUString& rToFile,
// prepare the requested file name for writing the font-subset file
OUString aSysPath;
if( osl_File_E_None != osl_getSystemPathFromFileURL( rToFile.pData, &aSysPath.pData ) )
+ {
return false;
- const rtl_TextEncoding aThreadEncoding = osl_getThreadTextEncoding();
- const OString aToFile( OUStringToOString( aSysPath, aThreadEncoding ) );
+ }
// get the raw-bytes from the font to be subset
ByteVector aBuffer;
bool bCffOnly = false;
if( !GetRawFontData( pFontData, aBuffer, &bCffOnly ) )
+ {
return false;
+ }
+ const OString aToFile( OUStringToOString( aSysPath,
+ osl_getThreadTextEncoding()));
// handle CFF-subsetting
if( bCffOnly )
@@ -210,7 +216,7 @@ bool AquaSalGraphics::CreateFontSubset( const OUString& rToFile,
// make the subsetter provide the requested subset
FILE* pOutFile = fopen( aToFile.getStr(), "wb" );
bool bRC = rInfo.CreateFontSubset( FontSubsetInfo::TYPE1_PFB, pOutFile, NULL,
- pGlyphIds, pEncoding, nGlyphCount, pGlyphWidths );
+ pGlyphIds, pEncoding, nGlyphCount, pGlyphWidths );
fclose( pOutFile );
return bRC;
}
@@ -223,40 +229,52 @@ bool AquaSalGraphics::CreateFontSubset( const OUString& rToFile,
TrueTypeFont* pSftFont = NULL;
int nRC = ::OpenTTFontBuffer( static_cast<void*>(&aBuffer[0]), aBuffer.size(), 0, &pSftFont);
if( nRC != SF_OK )
+ {
return false;
-
+ }
// get details about the subsetted font
TTGlobalFontInfo aTTInfo;
::GetTTGlobalFontInfo( pSftFont, &aTTInfo );
- rInfo.m_nFontType = FontSubsetInfo::SFNT_TTF;
- rInfo.m_aPSName = OUString(
- aTTInfo.psname, std::strlen(aTTInfo.psname), RTL_TEXTENCODING_UTF8 );
- rInfo.m_aFontBBox = Rectangle( Point( aTTInfo.xMin, aTTInfo.yMin ),
- Point( aTTInfo.xMax, aTTInfo.yMax ) );
- rInfo.m_nCapHeight = aTTInfo.yMax; // Well ...
- rInfo.m_nAscent = aTTInfo.winAscent;
- rInfo.m_nDescent = aTTInfo.winDescent;
+ rInfo.m_nFontType = FontSubsetInfo::SFNT_TTF;
+ rInfo.m_aPSName = OUString( aTTInfo.psname, std::strlen(aTTInfo.psname),
+ RTL_TEXTENCODING_UTF8 );
+ rInfo.m_aFontBBox = Rectangle( Point( aTTInfo.xMin, aTTInfo.yMin ),
+ Point( aTTInfo.xMax, aTTInfo.yMax ) );
+ rInfo.m_nCapHeight = aTTInfo.yMax; // Well ...
+ rInfo.m_nAscent = aTTInfo.winAscent;
+ rInfo.m_nDescent = aTTInfo.winDescent;
// mac fonts usually do not have an OS2-table
// => get valid ascent/descent values from other tables
if( !rInfo.m_nAscent )
+ {
rInfo.m_nAscent = +aTTInfo.typoAscender;
+ }
if( !rInfo.m_nAscent )
+ {
rInfo.m_nAscent = +aTTInfo.ascender;
+ }
if( !rInfo.m_nDescent )
+ {
rInfo.m_nDescent = +aTTInfo.typoDescender;
+ }
if( !rInfo.m_nDescent )
+ {
rInfo.m_nDescent = -aTTInfo.descender;
+ }
// subset glyphs and get their properties
// take care that subset fonts require the NotDef glyph in pos 0
int nOrigCount = nGlyphCount;
- sal_uInt16 aShortIDs[ 256 ];
- sal_uInt8 aTempEncs[ 256 ];
-
+ sal_uInt16 aShortIDs[ 257 ];
+ sal_uInt8 aTempEncs[ 257 ];
int nNotDef = -1;
+
+ assert( (nGlyphCount <= 256 && "too many glyphs for subsetting" ));
+
for( int i = 0; i < nGlyphCount; ++i )
{
aTempEncs[i] = pEncoding[i];
+
sal_GlyphId aGlyphId(pGlyphIds[i] & GF_IDXMASK);
if( pGlyphIds[i] & GF_ISCHAR )
{
@@ -271,44 +289,50 @@ bool AquaSalGraphics::CreateFontSubset( const OUString& rToFile,
}
}
aShortIDs[i] = static_cast<sal_uInt16>( aGlyphId );
- if( !aGlyphId )
- if( nNotDef < 0 )
- nNotDef = i; // first NotDef glyph found
+ if( !aGlyphId && nNotDef < 0 )
+ {
+ nNotDef = i; // first NotDef glyph found
+ }
}
if( nNotDef != 0 )
{
// add fake NotDef glyph if needed
if( nNotDef < 0 )
+ {
nNotDef = nGlyphCount++;
-
+ }
// NotDef glyph must be in pos 0 => swap glyphids
aShortIDs[ nNotDef ] = aShortIDs[0];
aTempEncs[ nNotDef ] = aTempEncs[0];
aShortIDs[0] = 0;
aTempEncs[0] = 0;
}
- DBG_ASSERT( nGlyphCount < 257, "too many glyphs for subsetting" );
// TODO: where to get bVertical?
const bool bVertical = false;
// fill the pGlyphWidths array
// while making sure that the NotDef glyph is at index==0
- TTSimpleGlyphMetrics* pGlyphMetrics =
- ::GetTTSimpleGlyphMetrics( pSftFont, aShortIDs, nGlyphCount, bVertical );
+ TTSimpleGlyphMetrics* pGlyphMetrics = ::GetTTSimpleGlyphMetrics( pSftFont, aShortIDs,
+ nGlyphCount, bVertical );
if( !pGlyphMetrics )
+ {
return false;
- sal_uInt16 nNotDefAdv = pGlyphMetrics[0].adv;
- pGlyphMetrics[0].adv = pGlyphMetrics[nNotDef].adv;
+ }
+
+ sal_uInt16 nNotDefAdv = pGlyphMetrics[0].adv;
+ pGlyphMetrics[0].adv = pGlyphMetrics[nNotDef].adv;
pGlyphMetrics[nNotDef].adv = nNotDefAdv;
for( int i = 0; i < nOrigCount; ++i )
+ {
pGlyphWidths[i] = pGlyphMetrics[i].adv;
+ }
free( pGlyphMetrics );
// write subset into destination file
nRC = ::CreateTTFromTTGlyphs( pSftFont, aToFile.getStr(), aShortIDs,
- aTempEncs, nGlyphCount, 0, NULL, 0 );
+ aTempEncs, nGlyphCount, 0, NULL, 0 );
::CloseTTFont(pSftFont);
return (nRC == SF_OK);
}
@@ -328,10 +352,10 @@ void AquaSalGraphics::copyBits( const SalTwoRect& rPosAry, SalGraphics *pSrcGrap
}
//from unix salgdi2.cxx
//[FIXME] find a better way to prevent calc from crashing when width and height are negative
- if( rPosAry.mnSrcWidth <= 0
- || rPosAry.mnSrcHeight <= 0
- || rPosAry.mnDestWidth <= 0
- || rPosAry.mnDestHeight <= 0 )
+ if( rPosAry.mnSrcWidth <= 0 ||
+ rPosAry.mnSrcHeight <= 0 ||
+ rPosAry.mnDestWidth <= 0 ||
+ rPosAry.mnDestHeight <= 0 )
{
return;
}
@@ -349,24 +373,28 @@ void AquaSalGraphics::copyBits( const SalTwoRect& rPosAry, SalGraphics *pSrcGrap
|| (mbWindow && mpFrame && pSrc->mbWindow && (mpFrame == pSrc->mpFrame))
#endif
;
- if( bSameGraphics
- && (rPosAry.mnSrcWidth == rPosAry.mnDestWidth)
- && (rPosAry.mnSrcHeight == rPosAry.mnDestHeight))
+
+ if( bSameGraphics &&
+ (rPosAry.mnSrcWidth == rPosAry.mnDestWidth) &&
+ (rPosAry.mnSrcHeight == rPosAry.mnDestHeight))
{
// short circuit if there is nothing to do
- if( (rPosAry.mnSrcX == rPosAry.mnDestX)
- && (rPosAry.mnSrcY == rPosAry.mnDestY))
+ if( (rPosAry.mnSrcX == rPosAry.mnDestX) &&
+ (rPosAry.mnSrcY == rPosAry.mnDestY))
+ {
return;
+ }
// use copyArea() if source and destination context are identical
copyArea( rPosAry.mnDestX, rPosAry.mnDestY, rPosAry.mnSrcX, rPosAry.mnSrcY,
- rPosAry.mnSrcWidth, rPosAry.mnSrcHeight, 0 );
+ rPosAry.mnSrcWidth, rPosAry.mnSrcHeight, 0 );
return;
}
ApplyXorContext();
pSrc->ApplyXorContext();
- SAL_WARN_IF( !pSrc->mxLayer, "vcl.quartz", "AquaSalGraphics::copyBits() from non-layered graphics this=" << this );
+ SAL_WARN_IF( !pSrc->mxLayer, "vcl.quartz",
+ "AquaSalGraphics::copyBits() from non-layered graphics this=" << this );
const CGPoint aDstPoint = CGPointMake(+rPosAry.mnDestX - rPosAry.mnSrcX, rPosAry.mnDestY - rPosAry.mnSrcY);
if( (rPosAry.mnSrcWidth == rPosAry.mnDestWidth &&
@@ -384,25 +412,28 @@ void AquaSalGraphics::copyBits( const SalTwoRect& rPosAry, SalGraphics *pSrcGrap
xCopyContext = mpXorEmulation->GetTargetContext();
}
}
- CG_TRACE( "CGContextSaveGState(" << xCopyContext << ")" );
+ SAL_INFO( "vcl.cg", "CGContextSaveGState(" << xCopyContext << ")" );
CGContextSaveGState( xCopyContext );
+
const CGRect aDstRect = CGRectMake(rPosAry.mnDestX, rPosAry.mnDestY, rPosAry.mnDestWidth, rPosAry.mnDestHeight);
- CG_TRACE( "CGContextClipToRect(" << xCopyContext << "," << aDstRect << ")" );
+ SAL_INFO( "vcl.cg", "CGContextClipToRect(" << xCopyContext << "," << aDstRect << ")" );
CGContextClipToRect( xCopyContext, aDstRect );
// draw at new destination
// NOTE: flipped drawing gets disabled for this, else the subimage would be drawn upside down
if( pSrc->IsFlipped() )
{
- CG_TRACE( "CGContextTranslateCTM(" << xCopyContext << ",0," << mnHeight << ")" );
+ SAL_INFO( "vcl.cg", "CGContextTranslateCTM(" << xCopyContext << ",0," << mnHeight << ")" );
CGContextTranslateCTM( xCopyContext, 0, +mnHeight );
- CG_TRACE( "CGContextScaleCTM(" << xCopyContext << ",+1,-1)" );
+ SAL_INFO( "vcl.cg", "CGContextScaleCTM(" << xCopyContext << ",+1,-1)" );
CGContextScaleCTM( xCopyContext, +1, -1 );
}
+
// TODO: pSrc->size() != this->size()
- CG_TRACE( "CGContextDrawLayerAtPoint(" << xCopyContext << "," << aDstPoint << "," << pSrc->mxLayer << ")" );
+ SAL_INFO( "vcl.cg", "CGContextDrawLayerAtPoint(" << xCopyContext << "," << aDstPoint << "," << pSrc->mxLayer << ")" );
CGContextDrawLayerAtPoint( xCopyContext, aDstPoint, pSrc->mxLayer );
- CG_TRACE( "CGContextRestoreGState(" << xCopyContext << ")" );
+
+ SAL_INFO( "vcl.cg", "CGContextRestoreGState(" << xCopyContext << ")" );
CGContextRestoreGState( xCopyContext );
// mark the destination rectangle as updated
RefreshRect( aDstRect );
@@ -411,7 +442,6 @@ void AquaSalGraphics::copyBits( const SalTwoRect& rPosAry, SalGraphics *pSrcGrap
{
SalBitmap* pBitmap = pSrc->getBitmap( rPosAry.mnSrcX, rPosAry.mnSrcY,
rPosAry.mnSrcWidth, rPosAry.mnSrcHeight );
-
if( pBitmap )
{
SalTwoRect aPosAry( rPosAry );
@@ -426,18 +456,20 @@ void AquaSalGraphics::copyBits( const SalTwoRect& rPosAry, SalGraphics *pSrcGrap
static void DrawPattern50( void*, CGContextRef rContext )
{
static const CGRect aRects[2] = { { {0,0}, { 2, 2 } }, { { 2, 2 }, { 2, 2 } } };
- CG_TRACE( "CGContextAddRects(" << rContext << ",aRects,2 )" );
+ SAL_INFO( "vcl.cg", "CGContextAddRects(" << rContext << ",aRects,2 )" );
CGContextAddRects( rContext, aRects, 2 );
- CG_TRACE( "CGContextFillPath(" << rContext << ")" );
+ SAL_INFO( "vcl.cg", "CGContextFillPath(" << rContext << ")" );
CGContextFillPath( rContext );
}
-static void getBoundRect( sal_uInt32 nPoints, const SalPoint *pPtAry, long &rX, long& rY, long& rWidth, long& rHeight )
+static void getBoundRect( sal_uInt32 nPoints, const SalPoint *pPtAry,
+ long &rX, long& rY, long& rWidth, long& rHeight )
{
long nX1 = pPtAry->mnX;
long nX2 = nX1;
long nY1 = pPtAry->mnY;
long nY2 = nY1;
+
for( sal_uInt32 n = 1; n < nPoints; n++ )
{
if( pPtAry[n].mnX < nX1 )
@@ -493,7 +525,8 @@ void AquaSalGraphics::ApplyXorContext()
void AquaSalGraphics::copyArea( long nDstX, long nDstY,long nSrcX, long nSrcY,
long nSrcWidth, long nSrcHeight, sal_uInt16 /*nFlags*/ )
{
- SAL_WARN_IF( !mxLayer, "vcl.quartz", "AquaSalGraphics::copyArea() for non-layered graphics this=" << this );
+ SAL_WARN_IF( !mxLayer, "vcl.quartz",
+ "AquaSalGraphics::copyArea() for non-layered graphics this=" << this );
#ifdef IOS
if( !mxLayer )
@@ -513,36 +546,39 @@ void AquaSalGraphics::copyArea( long nDstX, long nDstY,long nSrcX, long nSrcY,
// TODO: is it possible to get rid of this unneeded copy more often?
// e.g. on OSX>=10.5 only this situation causes problems:
// mnBitmapDepth && (aDstPoint.x + pSrc->mnWidth) > mnWidth
+
CGLayerRef xSrcLayer = mxLayer;
// TODO: if( mnBitmapDepth > 0 )
{
const CGSize aSrcSize = CGSizeMake(nSrcWidth, nSrcHeight);
xSrcLayer = CGLayerCreateWithContext( xCopyContext, aSrcSize, NULL );
- CG_TRACE( "CGLayerCreateWithContext(" << xCopyContext << "," << aSrcSize << ",NULL) = " << xSrcLayer );
+ SAL_INFO( "vcl.cg", "CGLayerCreateWithContext(" << xCopyContext << "," << aSrcSize << ",NULL) = " << xSrcLayer );
+
const CGContextRef xSrcContext = CGLayerGetContext( xSrcLayer );
- CG_TRACE( "CGLayerGetContext(" << xSrcLayer << ") = " << xSrcContext );
+ SAL_INFO( "vcl.cg", "CGLayerGetContext(" << xSrcLayer << ") = " << xSrcContext );
+
CGPoint aSrcPoint = CGPointMake(-nSrcX, -nSrcY);
if( IsFlipped() )
{
- CG_TRACE( "CGContextTranslateCTM(" << xSrcContext << ",0," << nSrcHeight << ")" );
+ SAL_INFO( "vcl.cg", "CGContextTranslateCTM(" << xSrcContext << ",0," << nSrcHeight << ")" );
CGContextTranslateCTM( xSrcContext, 0, +nSrcHeight );
- CG_TRACE( "CGContextScaleCTM(" << xSrcContext << ",+1,-1)" );
+ SAL_INFO( "vcl.cg", "CGContextScaleCTM(" << xSrcContext << ",+1,-1)" );
CGContextScaleCTM( xSrcContext, +1, -1 );
aSrcPoint.y = (nSrcY + nSrcHeight) - mnHeight;
}
- CG_TRACE( "CGContextDrawLayerAtPoint(" << xSrcContext << "," << aSrcPoint << "," << mxLayer << ")" );
+ SAL_INFO( "vcl.cg", "CGContextDrawLayerAtPoint(" << xSrcContext << "," << aSrcPoint << "," << mxLayer << ")" );
CGContextDrawLayerAtPoint( xSrcContext, aSrcPoint, mxLayer );
}
// draw at new destination
const CGPoint aDstPoint = CGPointMake(+nDstX, +nDstY);
- CG_TRACE( "CGContextDrawLayerAtPoint(" << xCopyContext << "," << aDstPoint << "," << xSrcLayer << ")" );
+ SAL_INFO( "vcl.cg", "CGContextDrawLayerAtPoint(" << xCopyContext << "," << aDstPoint << "," << xSrcLayer << ")" );
CGContextDrawLayerAtPoint( xCopyContext, aDstPoint, xSrcLayer );
// cleanup
if( xSrcLayer != mxLayer )
{
- CG_TRACE( "CGLayerRelease(" << xSrcLayer << ")" );
+ SAL_INFO( "vcl.cg", "CGLayerRelease(" << xSrcLayer << ")" );
CGLayerRelease( xSrcLayer );
}
// mark the destination rectangle as updated
@@ -618,12 +654,12 @@ bool AquaSalGraphics::drawAlphaBitmap( const SalTwoRect& rTR,
if ( CheckContext() )
{
const CGRect aDstRect = CGRectMake( rTR.mnDestX, rTR.mnDestY, rTR.mnDestWidth, rTR.mnDestHeight);
- CG_TRACE( "CGContextDrawImage(" << mrContext << "," << aDstRect << "," << xMaskedImage << ")" );
+ SAL_INFO( "vcl.cg", "CGContextDrawImage(" << mrContext << "," << aDstRect << "," << xMaskedImage << ")" );
CGContextDrawImage( mrContext, aDstRect, xMaskedImage );
RefreshRect( aDstRect );
}
- CG_TRACE("CGImageRelease(" << xMaskedImage << ")");
+ SAL_INFO( "vcl.cg", "CGImageRelease(" << xMaskedImage << ")");
CGImageRelease(xMaskedImage);
DBG_DRAW_OPERATION_EXIT("drawAlphaBitmap");
@@ -647,6 +683,7 @@ bool AquaSalGraphics::drawTransformedBitmap(
const Size aSize = rSrcBitmap.GetSize();
const QuartzSalBitmap& rSrcSalBmp = static_cast<const QuartzSalBitmap&>(rSrcBitmap);
const QuartzSalBitmap* pMaskSalBmp = static_cast<const QuartzSalBitmap*>(pAlphaBmp);
+
if( !pMaskSalBmp)
xImage = rSrcSalBmp.CreateCroppedImage( 0, 0, (int)aSize.Width(), (int)aSize.Height() );
else
@@ -659,7 +696,7 @@ bool AquaSalGraphics::drawTransformedBitmap(
// setup the image transformation
// using the rNull,rX,rY points as destinations for the (0,0),(0,Width),(Height,0) source points
- CG_TRACE( "CGContextSaveGState(" << mrContext << ") " << ++mnContextStackDepth );
+ SAL_INFO( "vcl.cg", "CGContextSaveGState(" << mrContext << ") " << ++mnContextStackDepth );
CGContextSaveGState( mrContext );
const basegfx::B2DVector aXRel = rX - rNull;
const basegfx::B2DVector aYRel = rY - rNull;
@@ -667,17 +704,19 @@ bool AquaSalGraphics::drawTransformedBitmap(
aXRel.getX()/aSize.Width(), aXRel.getY()/aSize.Width(),
aYRel.getX()/aSize.Height(), aYRel.getY()/aSize.Height(),
rNull.getX(), rNull.getY());
- CG_TRACE( "CGContextConcatCTM(" << mrContext << "," << aCGMat << ")" );
+
+ SAL_INFO( "vcl.cg", "CGContextConcatCTM(" << mrContext << "," << aCGMat << ")" );
CGContextConcatCTM( mrContext, aCGMat );
// draw the transformed image
const CGRect aSrcRect = CGRectMake(0, 0, aSize.Width(), aSize.Height());
- CG_TRACE( "CGContextDrawImage(" << mrContext << "," << aSrcRect << "," << xImage << ")" );
+ SAL_INFO( "vcl.cg", "CGContextDrawImage(" << mrContext << "," << aSrcRect << "," << xImage << ")" );
CGContextDrawImage( mrContext, aSrcRect, xImage );
- CG_TRACE( "CGImageRelease(" << xImage << ")" );
+
+ SAL_INFO( "vcl.cg", "CGImageRelease(" << xImage << ")" );
CGImageRelease( xImage );
// restore the Quartz graphics state
- CG_TRACE("CGContextRestoreGState(" << mrContext << ") " << mnContextStackDepth--);
+ SAL_INFO( "vcl.cg", "CGContextRestoreGState(" << mrContext << ") " << mnContextStackDepth--);
CGContextRestoreGState(mrContext);
// mark the destination as painted
@@ -700,9 +739,9 @@ bool AquaSalGraphics::drawAlphaRect( long nX, long nY, long nWidth,
}
// save the current state
- CG_TRACE( "CGContextSaveGState(" << mrContext << ") " << ++mnContextStackDepth );
+ SAL_INFO( "vcl.cg", "CGContextSaveGState(" << mrContext << ") " << ++mnContextStackDepth );
CGContextSaveGState( mrContext );
- CG_TRACE( "CGContextSetAlpha(" << mrContext << "," << (100-nTransparency) * (1.0/100) << ")" );
+ SAL_INFO( "vcl.cg", "CGContextSetAlpha(" << mrContext << "," << (100-nTransparency) * (1.0/100) << ")" );
CGContextSetAlpha( mrContext, (100-nTransparency) * (1.0/100) );
CGRect aRect = CGRectMake(nX, nY, nWidth-1, nHeight-1);
@@ -712,15 +751,15 @@ bool AquaSalGraphics::drawAlphaRect( long nX, long nY, long nWidth,
aRect.origin.y += 0.5;
}
- CG_TRACE( "CGContextBeginPath(" << mrContext << ")" );
+ SAL_INFO( "vcl.cg", "CGContextBeginPath(" << mrContext << ")" );
CGContextBeginPath( mrContext );
- CG_TRACE( "CGContextAddRect(" << mrContext << "," << aRect << ")" );
+ SAL_INFO( "vcl.cg", "CGContextAddRect(" << mrContext << "," << aRect << ")" );
CGContextAddRect( mrContext, aRect );
- CG_TRACE( "CGContextDrawPath(" << mrContext << ",kCGPathFill)" );
+ SAL_INFO( "vcl.cg", "CGContextDrawPath(" << mrContext << ",kCGPathFill)" );
CGContextDrawPath( mrContext, kCGPathFill );
// restore state
- CG_TRACE("CGContextRestoreGState(" << mrContext << ") " << mnContextStackDepth--);
+ SAL_INFO( "vcl.cg", "CGContextRestoreGState(" << mrContext << ") " << mnContextStackDepth--);
CGContextRestoreGState(mrContext);
RefreshRect( aRect );
@@ -748,9 +787,10 @@ void AquaSalGraphics::drawBitmap( const SalTwoRect& rPosAry, const SalBitmap& rS
}
const CGRect aDstRect = CGRectMake(rPosAry.mnDestX, rPosAry.mnDestY, rPosAry.mnDestWidth, rPosAry.mnDestHeight);
- CG_TRACE( "CGContextDrawImage(" << mrContext << "," << aDstRect << "," << xImage << ")" );
+ SAL_INFO( "vcl.cg", "CGContextDrawImage(" << mrContext << "," << aDstRect << "," << xImage << ")" );
CGContextDrawImage( mrContext, aDstRect, xImage );
- CG_TRACE( "CGImageRelease(" << xImage << ")" );
+
+ SAL_INFO( "vcl.cg", "CGImageRelease(" << xImage << ")" );
CGImageRelease( xImage );
RefreshRect( aDstRect );
@@ -779,9 +819,9 @@ void AquaSalGraphics::drawBitmap( const SalTwoRect& rPosAry, const SalBitmap& rS
}
const CGRect aDstRect = CGRectMake(rPosAry.mnDestX, rPosAry.mnDestY, rPosAry.mnDestWidth, rPosAry.mnDestHeight);
- CG_TRACE( "CGContextDrawImage(" << mrContext << "," << aDstRect << "," << xMaskedImage << ")" );
+ SAL_INFO( "vcl.cg", "CGContextDrawImage(" << mrContext << "," << aDstRect << "," << xMaskedImage << ")" );
CGContextDrawImage( mrContext, aDstRect, xMaskedImage );
- CG_TRACE( "CGImageRelease(" << xMaskedImage << ")" );
+ SAL_INFO( "vcl.cg", "CGImageRelease(" << xMaskedImage << ")" );
CGImageRelease( xMaskedImage );
RefreshRect( aDstRect );
@@ -806,10 +846,10 @@ bool AquaSalGraphics::drawEPS( long nX, long nY, long nWidth, long nHeight,
return false;
}
// NOTE: flip drawing, else the nsimage would be drawn upside down
- CG_TRACE( "CGContextSaveGState(" << mrContext << ") " << ++mnContextStackDepth );
+ SAL_INFO( "vcl.cg", "CGContextSaveGState(" << mrContext << ") " << ++mnContextStackDepth );
CGContextSaveGState( mrContext );
// CGContextTranslateCTM( mrContext, 0, +mnHeight );
- CG_TRACE( "CGContextScaleCTM(" << mrContext << ",+1,-1)" );
+ SAL_INFO( "vcl.cg", "CGContextScaleCTM(" << mrContext << ",+1,-1)" );
CGContextScaleCTM( mrContext, +1, -1 );
nY = /*mnHeight*/ - (nY + nHeight);
@@ -830,7 +870,7 @@ bool AquaSalGraphics::drawEPS( long nX, long nY, long nWidth, long nHeight,
[NSGraphicsContext setCurrentContext: pOrigNSCtx];
[pOrigNSCtx release]; // restore the original retain count
- CG_TRACE("CGContextRestoreGState(" << mrContext << ") " << mnContextStackDepth--);
+ SAL_INFO( "vcl.cg", "CGContextRestoreGState(" << mrContext << ") " << mnContextStackDepth--);
CGContextRestoreGState( mrContext );
// mark the destination rectangle as updated
RefreshRect( aDstRect );
@@ -859,13 +899,13 @@ void AquaSalGraphics::drawLine( long nX1, long nY1, long nX2, long nY2 )
return;
}
- CG_TRACE( "CGContextBeginPath(" << mrContext << ")" );
+ SAL_INFO( "vcl.cg", "CGContextBeginPath(" << mrContext << ")" );
CGContextBeginPath( mrContext );
- CG_TRACE( "CGContextMoveToPoint(" << mrContext << "," << static_cast<float>(nX1)+0.5 << "," << static_cast<float>(nY1)+0.5 << ")" );
+ SAL_INFO( "vcl.cg", "CGContextMoveToPoint(" << mrContext << "," << static_cast<float>(nX1)+0.5 << "," << static_cast<float>(nY1)+0.5 << ")" );
CGContextMoveToPoint( mrContext, static_cast<float>(nX1)+0.5, static_cast<float>(nY1)+0.5 );
- CG_TRACE( "CGContextAddLineToPoint(" << mrContext << "," << static_cast<float>(nX2)+0.5 << "," << static_cast<float>(nY2)+0.5 << ")" );
+ SAL_INFO( "vcl.cg", "CGContextAddLineToPoint(" << mrContext << "," << static_cast<float>(nX2)+0.5 << "," << static_cast<float>(nY2)+0.5 << ")" );
CGContextAddLineToPoint( mrContext, static_cast<float>(nX2)+0.5, static_cast<float>(nY2)+0.5 );
- CG_TRACE( "CGContextDrawPath(" << mrContext << ",kCGPathStroke)" );
+ SAL_INFO( "vcl.cg", "CGContextDrawPath(" << mrContext << ",kCGPathStroke)" );
CGContextDrawPath( mrContext, kCGPathStroke );
Rectangle aRefreshRect( nX1, nY1, nX2, nY2 );
@@ -896,9 +936,9 @@ void AquaSalGraphics::drawMask( const SalTwoRect& rPosAry, const SalBitmap& rSal
}
const CGRect aDstRect = CGRectMake(rPosAry.mnDestX, rPosAry.mnDestY, rPosAry.mnDestWidth, rPosAry.mnDestHeight);
- CG_TRACE( "CGContextDrawImage(" << mrContext << "," << aDstRect << "," << xImage << ")" );
+ SAL_INFO( "vcl.cg", "CGContextDrawImage(" << mrContext << "," << aDstRect << "," << xImage << ")" );
CGContextDrawImage( mrContext, aDstRect, xImage );
- CG_TRACE( "CGImageRelease(" << xImage << ")" );
+ SAL_INFO( "vcl.cg", "CGImageRelease(" << xImage << ")" );
CGImageRelease( xImage );
RefreshRect( aDstRect );
@@ -917,12 +957,11 @@ void AquaSalGraphics::drawPixel( long nX, long nY, SalColor nSalColor )
ImplDrawPixel( nX, nY, aPixelColor );
}
-bool AquaSalGraphics::drawPolyLine(
- const ::basegfx::B2DPolygon& rPolyLine,
- double fTransparency,
- const ::basegfx::B2DVector& rLineWidths,
- basegfx::B2DLineJoin eLineJoin,
- com::sun::star::drawing::LineCap eLineCap)
+bool AquaSalGraphics::drawPolyLine( const ::basegfx::B2DPolygon& rPolyLine,
+ double fTransparency,
+ const ::basegfx::B2DVector& rLineWidths,
+ basegfx::B2DLineJoin eLineJoin,
+ css::drawing::LineCap eLineCap)
{
DBG_DRAW_OPERATION("drawPolyLine", true);
@@ -963,11 +1002,11 @@ bool AquaSalGraphics::drawPolyLine(
CGLineJoin aCGLineJoin = kCGLineJoinMiter;
switch( eLineJoin )
{
- case ::basegfx::B2DLineJoin::NONE: aCGLineJoin = /*TODO?*/kCGLineJoinMiter; break;
- case ::basegfx::B2DLineJoin::Middle: aCGLineJoin = /*TODO?*/kCGLineJoinMiter; break;
- case ::basegfx::B2DLineJoin::Bevel: aCGLineJoin = kCGLineJoinBevel; break;
- case ::basegfx::B2DLineJoin::Miter: aCGLineJoin = kCGLineJoinMiter; break;
- case ::basegfx::B2DLineJoin::Round: aCGLineJoin = kCGLineJoinRound; break;
+ case basegfx::B2DLineJoin::NONE: aCGLineJoin = /*TODO?*/kCGLineJoinMiter; break;
+ case basegfx::B2DLineJoin::Middle: aCGLineJoin = /*TODO?*/kCGLineJoinMiter; break;
+ case basegfx::B2DLineJoin::Bevel: aCGLineJoin = kCGLineJoinBevel; break;
+ case basegfx::B2DLineJoin::Miter: aCGLineJoin = kCGLineJoinMiter; break;
+ case basegfx::B2DLineJoin::Round: aCGLineJoin = kCGLineJoinRound; break;
}
// setup cap attribute
@@ -980,12 +1019,12 @@ bool AquaSalGraphics::drawPolyLine(
aCGLineCap = kCGLineCapButt;
break;
}
- case com::sun::star::drawing::LineCap_ROUND:
+ case css::drawing::LineCap_ROUND:
{
aCGLineCap = kCGLineCapRound;
break;
}
- case com::sun::star::drawing::LineCap_SQUARE:
+ case css::drawing::LineCap_SQUARE:
{
aCGLineCap = kCGLineCapSquare;
break;
@@ -994,38 +1033,38 @@ bool AquaSalGraphics::drawPolyLine(
// setup poly-polygon path
CGMutablePathRef xPath = CGPathCreateMutable();
- CG_TRACE( "CGPathCreateMutable() = " << xPath );
+ SAL_INFO( "vcl.cg", "CGPathCreateMutable() = " << xPath );
AddPolygonToPath( xPath, rPolyLine, rPolyLine.isClosed(), !getAntiAliasB2DDraw(), true );
const CGRect aRefreshRect = CGPathGetBoundingBox( xPath );
- CG_TRACE( "CGPathGetBoundingBox(" << xPath << ") = " << aRefreshRect );
+ SAL_INFO( "vcl.cg", "CGPathGetBoundingBox(" << xPath << ") = " << aRefreshRect );
// #i97317# workaround for Quartz having problems with drawing small polygons
if( ! ((aRefreshRect.size.width <= 0.125) && (aRefreshRect.size.height <= 0.125)) )
{
// use the path to prepare the graphics context
- CG_TRACE( "CGContextSaveGState(" << mrContext << ") " << ++mnContextStackDepth );
+ SAL_INFO( "vcl.cg", "CGContextSaveGState(" << mrContext << ") " << ++mnContextStackDepth );
CGContextSaveGState( mrContext );
- CG_TRACE( "CGContextBeginPath(" << mrContext << ")" );
+ SAL_INFO( "vcl.cg", "CGContextBeginPath(" << mrContext << ")" );
CGContextBeginPath( mrContext );
- CG_TRACE( "CGContextAddPath(" << mrContext << "," << xPath << ")" );
+ SAL_INFO( "vcl.cg", "CGContextAddPath(" << mrContext << "," << xPath << ")" );
CGContextAddPath( mrContext, xPath );
// draw path with antialiased line
CGContextSetShouldAntialias( mrContext, true );
- CG_TRACE( "CGContextSetAlpha(" << mrContext << "," << 1.0 - fTransparency << ")" );
+ SAL_INFO( "vcl.cg", "CGContextSetAlpha(" << mrContext << "," << 1.0 - fTransparency << ")" );
CGContextSetAlpha( mrContext, 1.0 - fTransparency );
CGContextSetLineJoin( mrContext, aCGLineJoin );
CGContextSetLineCap( mrContext, aCGLineCap );
CGContextSetLineWidth( mrContext, rLineWidths.getX() );
- CG_TRACE( "CGContextDrawPath(" << mrContext << ",kCGPathStroke)" );
+ SAL_INFO( "vcl.cg", "CGContextDrawPath(" << mrContext << ",kCGPathStroke)" );
CGContextDrawPath( mrContext, kCGPathStroke );
- CG_TRACE( "CGContextRestoreGState(" << mrContext << ") " << mnContextStackDepth-- );
+ SAL_INFO( "vcl.cg", "CGContextRestoreGState(" << mrContext << ") " << mnContextStackDepth-- );
CGContextRestoreGState( mrContext );
// mark modified rectangle as updated
RefreshRect( aRefreshRect );
}
- CG_TRACE( "CGPathRelease(" << xPath << ")" );
+ SAL_INFO( "vcl.cg", "CGPathRelease(" << xPath << ")" );
CGPathRelease( xPath );
DBG_DRAW_OPERATION_EXIT("drawPolyLine");
@@ -1037,8 +1076,8 @@ bool AquaSalGraphics::drawPolyLineBezier( sal_uInt32, const SalPoint*, const sal
return false;
}
-bool AquaSalGraphics::drawPolyPolygon( const ::basegfx::B2DPolyPolygon& rPolyPoly,
- double fTransparency )
+bool AquaSalGraphics::drawPolyPolygon( const basegfx::B2DPolyPolygon& rPolyPoly,
+ double fTransparency )
{
DBG_DRAW_OPERATION("drawPolyPolygon", true);
@@ -1059,15 +1098,15 @@ bool AquaSalGraphics::drawPolyPolygon( const ::basegfx::B2DPolyPolygon& rPolyPol
// setup poly-polygon path
CGMutablePathRef xPath = CGPathCreateMutable();
- CG_TRACE( "CGPathCreateMutable() = " << xPath );
+ SAL_INFO( "vcl.cg", "CGPathCreateMutable() = " << xPath );
for( int nPolyIdx = 0; nPolyIdx < nPolyCount; ++nPolyIdx )
{
- const ::basegfx::B2DPolygon rPolygon = rPolyPoly.getB2DPolygon( nPolyIdx );
+ const basegfx::B2DPolygon rPolygon = rPolyPoly.getB2DPolygon( nPolyIdx );
AddPolygonToPath( xPath, rPolygon, true, !getAntiAliasB2DDraw(), IsPenVisible() );
}
const CGRect aRefreshRect = CGPathGetBoundingBox( xPath );
- CG_TRACE( "CGPathGetBoundingBox(" << xPath << ") = " << aRefreshRect );
+ SAL_INFO( "vcl.cg", "CGPathGetBoundingBox(" << xPath << ") = " << aRefreshRect );
// #i97317# workaround for Quartz having problems with drawing small polygons
if( ! ((aRefreshRect.size.width <= 0.125) && (aRefreshRect.size.height <= 0.125)) )
{
@@ -1088,34 +1127,34 @@ bool AquaSalGraphics::drawPolyPolygon( const ::basegfx::B2DPolyPolygon& rPolyPol
else
{
SAL_WARN( "vcl.quartz", "Neither pen nor brush visible" );
- CG_TRACE( "CGPathRelease(" << xPath << ")" );
+ SAL_INFO( "vcl.cg", "CGPathRelease(" << xPath << ")" );
CGPathRelease( xPath );
DBG_DRAW_OPERATION_EXIT_EARLY("drawPolyPolygon");
return true;
}
// use the path to prepare the graphics context
- CG_TRACE( "CGContextSaveGState(" << mrContext << ") " << ++mnContextStackDepth );
+ SAL_INFO( "vcl.cg", "CGContextSaveGState(" << mrContext << ") " << ++mnContextStackDepth );
CGContextSaveGState( mrContext );
- CG_TRACE( "CGContextBeginPath(" << mrContext << ")" );
+ SAL_INFO( "vcl.cg", "CGContextBeginPath(" << mrContext << ")" );
CGContextBeginPath( mrContext );
- CG_TRACE( "CGContextAddPath(" << mrContext << "," << xPath << ")" );
+ SAL_INFO( "vcl.cg", "CGContextAddPath(" << mrContext << "," << xPath << ")" );
CGContextAddPath( mrContext, xPath );
// draw path with antialiased polygon
CGContextSetShouldAntialias( mrContext, true );
- CG_TRACE( "CGContextSetAlpha(" << mrContext << "," << 1.0 - fTransparency << ")" );
+ SAL_INFO( "vcl.cg", "CGContextSetAlpha(" << mrContext << "," << 1.0 - fTransparency << ")" );
CGContextSetAlpha( mrContext, 1.0 - fTransparency );
- CG_TRACE( "CGContextDrawPath(" << mrContext << "," << eMode << ")" );
+ SAL_INFO( "vcl.cg", "CGContextDrawPath(" << mrContext << "," << eMode << ")" );
CGContextDrawPath( mrContext, eMode );
- CG_TRACE( "CGContextRestoreGState(" << mrContext << ") " << mnContextStackDepth-- );
+ SAL_INFO( "vcl.cg", "CGContextRestoreGState(" << mrContext << ") " << mnContextStackDepth-- );
CGContextRestoreGState( mrContext );
// mark modified rectangle as updated
RefreshRect( aRefreshRect );
}
- CG_TRACE( "CGPathRelease(" << xPath << ")" );
+ SAL_INFO( "vcl.cg", "CGPathRelease(" << xPath << ")" );
CGPathRelease( xPath );
DBG_DRAW_OPERATION_EXIT("drawPolyPolygon");
@@ -1141,6 +1180,7 @@ void AquaSalGraphics::drawPolyPolygon( sal_uInt32 nPolyCount, const sal_uInt32 *
// find bound rect
long leftX = 0, topY = 0, maxWidth = 0, maxHeight = 0;
getBoundRect( pPoints[0], ppPtAry[0], leftX, topY, maxWidth, maxHeight );
+
for( sal_uInt32 n = 1; n < nPolyCount; n++ )
{
long nX = leftX, nY = topY, nW = maxWidth, nH = maxHeight;
@@ -1187,7 +1227,7 @@ void AquaSalGraphics::drawPolyPolygon( sal_uInt32 nPolyCount, const sal_uInt32 *
}
// convert to CGPath
- CG_TRACE( "CGContextBeginPath(" << mrContext << ")" );
+ SAL_INFO( "vcl.cg", "CGContextBeginPath(" << mrContext << ")" );
CGContextBeginPath( mrContext );
if( IsPenVisible() )
{
@@ -1198,17 +1238,19 @@ void AquaSalGraphics::drawPolyPolygon( sal_uInt32 nPolyCount, const sal_uInt32 *
{
const SalPoint *pPtAry = ppPtAry[nPoly];
float fX, fY;
+
alignLinePoint( pPtAry, fX, fY );
- CG_TRACE( "CGContextMoveToPoint(" << mrContext << "," << fX << "," << fY << ")" );
+ SAL_INFO( "vcl.cg", "CGContextMoveToPoint(" << mrContext << "," << fX << "," << fY << ")" );
CGContextMoveToPoint( mrContext, fX, fY );
pPtAry++;
+
for( sal_uInt32 nPoint = 1; nPoint < nPoints; nPoint++, pPtAry++ )
{
alignLinePoint( pPtAry, fX, fY );
- CG_TRACE( "CGContextAddLineToPoint(" << mrContext << "," << fX << "," << fY << ")" );
+ SAL_INFO( "vcl.cg", "CGContextAddLineToPoint(" << mrContext << "," << fX << "," << fY << ")" );
CGContextAddLineToPoint( mrContext, fX, fY );
}
- CG_TRACE("CGContextClosePath(" << mrContext << ")");
+ SAL_INFO( "vcl.cg", "CGContextClosePath(" << mrContext << ")");
CGContextClosePath(mrContext);
}
}
@@ -1221,21 +1263,21 @@ void AquaSalGraphics::drawPolyPolygon( sal_uInt32 nPolyCount, const sal_uInt32 *
if( nPoints > 1 )
{
const SalPoint *pPtAry = ppPtAry[nPoly];
- CG_TRACE( "CGContextMoveToPoint(" << mrContext << "," << pPtAry->mnX << "," << pPtAry->mnY << ")" );
+ SAL_INFO( "vcl.cg", "CGContextMoveToPoint(" << mrContext << "," << pPtAry->mnX << "," << pPtAry->mnY << ")" );
CGContextMoveToPoint( mrContext, pPtAry->mnX, pPtAry->mnY );
pPtAry++;
for( sal_uInt32 nPoint = 1; nPoint < nPoints; nPoint++, pPtAry++ )
{
- CG_TRACE( "CGContextAddLineToPoint(" << mrContext << "," << pPtAry->mnX << "," << pPtAry->mnY << ")" );
+ SAL_INFO( "vcl.cg", "CGContextAddLineToPoint(" << mrContext << "," << pPtAry->mnX << "," << pPtAry->mnY << ")" );
CGContextAddLineToPoint( mrContext, pPtAry->mnX, pPtAry->mnY );
}
- CG_TRACE("CGContextClosePath(" << mrContext << ")");
+ SAL_INFO( "vcl.cg", "CGContextClosePath(" << mrContext << ")");
CGContextClosePath(mrContext);
}
}
}
- CG_TRACE( "CGContextDrawPath(" << mrContext << "," <<
+ SAL_INFO( "vcl.cg", "CGContextDrawPath(" << mrContext << "," <<
(eMode == kCGPathFill ? "kCGPathFill" :
(eMode == kCGPathEOFill ? "kCGPathEOFill" :
(eMode == kCGPathFillStroke ? "kCGPathFillStroke" :
@@ -1287,38 +1329,38 @@ void AquaSalGraphics::drawPolygon( sal_uInt32 nPoints, const SalPoint *pPtAry )
return;
}
- CG_TRACE( "CGContextBeginPath(" << mrContext << ")" );
+ SAL_INFO( "vcl.cg", "CGContextBeginPath(" << mrContext << ")" );
CGContextBeginPath( mrContext );
if( IsPenVisible() )
{
float fX, fY;
alignLinePoint( pPtAry, fX, fY );
- CG_TRACE( "CGContextMoveToPoint(" << mrContext << "," << fX << "," << fY << ")" );
+ SAL_INFO( "vcl.cg", "CGContextMoveToPoint(" << mrContext << "," << fX << "," << fY << ")" );
CGContextMoveToPoint( mrContext, fX, fY );
pPtAry++;
for( sal_uInt32 nPoint = 1; nPoint < nPoints; nPoint++, pPtAry++ )
{
alignLinePoint( pPtAry, fX, fY );
- CG_TRACE( "CGContextAddLineToPoint(" << mrContext << "," << fX << "," << fY << ")" );
+ SAL_INFO( "vcl.cg", "CGContextAddLineToPoint(" << mrContext << "," << fX << "," << fY << ")" );
CGContextAddLineToPoint( mrContext, fX, fY );
}
}
else
{
- CG_TRACE( "CGContextMoveToPoint(" << mrContext << "," << pPtAry->mnX << "," << pPtAry->mnY << ")" );
+ SAL_INFO( "vcl.cg", "CGContextMoveToPoint(" << mrContext << "," << pPtAry->mnX << "," << pPtAry->mnY << ")" );
CGContextMoveToPoint( mrContext, pPtAry->mnX, pPtAry->mnY );
pPtAry++;
for( sal_uInt32 nPoint = 1; nPoint < nPoints; nPoint++, pPtAry++ )
{
- CG_TRACE( "CGContextAddLineToPoint(" << mrContext << "," << pPtAry->mnX << "," << pPtAry->mnY << ")" );
+ SAL_INFO( "vcl.cg", "CGContextAddLineToPoint(" << mrContext << "," << pPtAry->mnX << "," << pPtAry->mnY << ")" );
CGContextAddLineToPoint( mrContext, pPtAry->mnX, pPtAry->mnY );
}
}
- CG_TRACE("CGContextClosePath(" << mrContext << ")");
+ SAL_INFO( "vcl.cg", "CGContextClosePath(" << mrContext << ")");
CGContextClosePath( mrContext );
- CG_TRACE( "CGContextDrawPath(" << mrContext << "," << eMode << ")" );
+ SAL_INFO( "vcl.cg", "CGContextDrawPath(" << mrContext << "," << eMode << ")" );
CGContextDrawPath( mrContext, eMode );
RefreshRect( nX, nY, nWidth, nHeight );
@@ -1331,7 +1373,7 @@ bool AquaSalGraphics::drawPolygonBezier( sal_uInt32, const SalPoint*, const sal_
}
bool AquaSalGraphics::drawPolyPolygonBezier( sal_uInt32, const sal_uInt32*,
- const SalPoint* const*, const sal_uInt8* const* )
+ const SalPoint* const*, const sal_uInt8* const* )
{
return false;
}
@@ -1357,12 +1399,12 @@ void AquaSalGraphics::drawRect( long nX, long nY, long nWidth, long nHeight )
if( IsBrushVisible() )
{
- CG_TRACE( "CGContextFillRect(" << mrContext << "," << aRect << ")" );
+ SAL_INFO( "vcl.cg", "CGContextFillRect(" << mrContext << "," << aRect << ")" );
CGContextFillRect( mrContext, aRect );
}
if( IsPenVisible() )
{
- CG_TRACE( "CGContextStrokeRect(" << mrContext << "," << aRect << ")" );
+ SAL_INFO( "vcl.cg", "CGContextStrokeRect(" << mrContext << "," << aRect << ")" );
CGContextStrokeRect( mrContext, aRect );
}
RefreshRect( nX, nY, nWidth, nHeight );
@@ -1390,19 +1432,20 @@ void AquaSalGraphics::drawPolyLine( sal_uInt32 nPoints, const SalPoint *pPtAry )
getBoundRect( nPoints, pPtAry, nX, nY, nWidth, nHeight );
float fX, fY;
- CG_TRACE( "CGContextBeginPath(" << mrContext << ")" );
+ SAL_INFO( "vcl.cg", "CGContextBeginPath(" << mrContext << ")" );
CGContextBeginPath( mrContext );
alignLinePoint( pPtAry, fX, fY );
- CG_TRACE( "CGContextMoveToPoint(" << mrContext << "," << fX << "," << fY << ")" );
+ SAL_INFO( "vcl.cg", "CGContextMoveToPoint(" << mrContext << "," << fX << "," << fY << ")" );
CGContextMoveToPoint( mrContext, fX, fY );
pPtAry++;
+
for( sal_uInt32 nPoint = 1; nPoint < nPoints; nPoint++, pPtAry++ )
{
alignLinePoint( pPtAry, fX, fY );
- CG_TRACE( "CGContextAddLineToPoint(" << mrContext << "," << fX << "," << fY << ")" );
+ SAL_INFO( "vcl.cg", "CGContextAddLineToPoint(" << mrContext << "," << fX << "," << fY << ")" );
CGContextAddLineToPoint( mrContext, fX, fY );
}
- CG_TRACE( "CGContextDrawPath(" << mrContext << ",kCGPathStroke)" );
+ SAL_INFO( "vcl.cg", "CGContextDrawPath(" << mrContext << ",kCGPathStroke)" );
CGContextDrawPath( mrContext, kCGPathStroke );
RefreshRect( nX, nY, nWidth, nHeight );
@@ -1482,9 +1525,10 @@ SalColor AquaSalGraphics::getPixel( long nX, long nY )
// TODO: is it worth to cache it?
CGContextRef xOnePixelContext =
CGBitmapContextCreate( &aPixel, 1, 1, 8, 32,
- GetSalData()->mxRGBSpace, kCGImageAlphaNoneSkipFirst | kCGBitmapByteOrder32Big );
+ GetSalData()->mxRGBSpace,
+ kCGImageAlphaNoneSkipFirst | kCGBitmapByteOrder32Big );
- CG_TRACE( "CGBitmapContextCreate(1x1x8) = " << xOnePixelContext );
+ SAL_INFO( "vcl.cg", "CGBitmapContextCreate(1x1x8) = " << xOnePixelContext );
// update this graphics layer
ApplyXorContext();
@@ -1495,9 +1539,11 @@ SalColor AquaSalGraphics::getPixel( long nX, long nY )
nY = mnHeight - nY;
}
const CGPoint aCGPoint = CGPointMake(-nX, -nY);
- CG_TRACE( "CGContextDrawLayerAtPoint(" << xOnePixelContext << "," << aCGPoint << "," << mxLayer << ")" );
+ SAL_INFO( "vcl.cg", "CGContextDrawLayerAtPoint(" <<
+ xOnePixelContext << "," << aCGPoint << "," << mxLayer << ")" );
CGContextDrawLayerAtPoint( xOnePixelContext, aCGPoint, mxLayer );
- CG_TRACE( "CGContextRelease(" << xOnePixelContext << ")" );
+
+ SAL_INFO( "vcl.cg", "CGContextRelease(" << xOnePixelContext << ")" );
CGContextRelease( xOnePixelContext );
SalColor nSalColor = MAKE_SALCOLOR( aPixel.r, aPixel.g, aPixel.b );
@@ -1526,15 +1572,15 @@ void AquaSalGraphics::ImplDrawPixel( long nX, long nY, const RGBAColor& rColor )
return;
}
// overwrite the fill color
- CG_TRACE( "CGContextSetFillColor(" << mrContext << "," << rColor << ")" );
+ SAL_INFO( "vcl.cg", "CGContextSetFillColor(" << mrContext << "," << rColor << ")" );
CGContextSetFillColor( mrContext, rColor.AsArray() );
// draw 1x1 rect, there is no pixel drawing in Quartz
const CGRect aDstRect = CGRectMake(nX, nY, 1, 1);
- CG_TRACE( "CGContextFillRect(" << mrContext << "," << aDstRect << ")" );
+ SAL_INFO( "vcl.cg", "CGContextFillRect(" << mrContext << "," << aDstRect << ")" );
CGContextFillRect( mrContext, aDstRect );
RefreshRect( aDstRect );
// reset the fill color
- CG_TRACE( "CGContextSetFillColor(" << mrContext << "," << maFillColor << ")" );
+ SAL_INFO( "vcl.cg", "CGContextSetFillColor(" << mrContext << "," << maFillColor << ")" );
CGContextSetFillColor( mrContext, maFillColor.AsArray() );
}
@@ -1570,7 +1616,9 @@ void AquaSalGraphics::initResolution( NSWindow* )
{
NSArray* pScreens = [NSScreen screens];
if( pScreens && [pScreens count] > 0)
+ {
pScreen = [pScreens objectAtIndex: 0];
+ }
}
mnRealDPIX = mnRealDPIY = 96;
@@ -1644,18 +1692,18 @@ void AquaSalGraphics::invert( long nX, long nY, long nWidth, long nHeight, SalIn
if ( CheckContext() )
{
CGRect aCGRect = CGRectMake( nX, nY, nWidth, nHeight);
- CG_TRACE("CGContextSaveGState(" << mrContext << ") " << ++mnContextStackDepth);
+ SAL_INFO( "vcl.cg", "CGContextSaveGState(" << mrContext << ") " << ++mnContextStackDepth);
CGContextSaveGState(mrContext);
if ( nFlags & SAL_INVERT_TRACKFRAME )
{
const CGFloat dashLengths[2] = { 4.0, 4.0 }; // for drawing dashed line
CGContextSetBlendMode( mrContext, kCGBlendModeDifference );
- CG_TRACE( "CGContextSetRGBStrokeColor(" << mrContext << ",{1,1,1,1})" );
+ SAL_INFO( "vcl.cg", "CGContextSetRGBStrokeColor(" << mrContext << ",{1,1,1,1})" );
CGContextSetRGBStrokeColor ( mrContext, 1.0, 1.0, 1.0, 1.0 );
CGContextSetLineDash ( mrContext, 0, dashLengths, 2 );
CGContextSetLineWidth( mrContext, 2.0);
- CG_TRACE("CGContextStrokeRect(" << mrContext << "," << aCGRect << ")" );
+ SAL_INFO( "vcl.cg", "CGContextStrokeRect(" << mrContext << "," << aCGRect << ")" );
CGContextStrokeRect ( mrContext, aCGRect );
}
else if ( nFlags & SAL_INVERT_50 )
@@ -1668,12 +1716,12 @@ void AquaSalGraphics::invert( long nX, long nY, long nWidth, long nHeight, SalIn
else // just invert
{
CGContextSetBlendMode(mrContext, kCGBlendModeDifference);
- CG_TRACE( "CGContextSetRGBFillColor(" << mrContext << ",{1,1,1,1})" );
+ SAL_INFO( "vcl.cg", "CGContextSetRGBFillColor(" << mrContext << ",{1,1,1,1})" );
CGContextSetRGBFillColor ( mrContext,1.0, 1.0, 1.0 , 1.0 );
- CG_TRACE("CGContextFillRect(" << mrContext << "," << aCGRect << ")" );
+ SAL_INFO( "vcl.cg", "CGContextFillRect(" << mrContext << "," << aCGRect << ")" );
CGContextFillRect ( mrContext, aCGRect );
}
- CG_TRACE( "CGContextRestoreGState(" << mrContext << ") " << mnContextStackDepth-- );
+ SAL_INFO( "vcl.cg", "CGContextRestoreGState(" << mrContext << ") " << mnContextStackDepth-- );
CGContextRestoreGState( mrContext);
RefreshRect( aCGRect );
}
@@ -1701,7 +1749,7 @@ void AquaSalGraphics::invert( sal_uInt32 nPoints, const SalPoint* pPtAry, SalIn
{
if ( CheckContext() )
{
- CG_TRACE("CGContextSaveGState(" << mrContext << ") " << ++mnContextStackDepth);
+ SAL_INFO( "vcl.cg", "CGContextSaveGState(" << mrContext << ") " << ++mnContextStackDepth);
CGContextSaveGState(mrContext);
CGPoint* CGpoints = makeCGptArray(nPoints,pPtAry);
CGContextAddLines ( mrContext, CGpoints, nPoints );
@@ -1709,11 +1757,11 @@ void AquaSalGraphics::invert( sal_uInt32 nPoints, const SalPoint* pPtAry, SalIn
{
const CGFloat dashLengths[2] = { 4.0, 4.0 }; // for drawing dashed line
CGContextSetBlendMode( mrContext, kCGBlendModeDifference );
- CG_TRACE( "CGContextSetRGBStrokeColor(" << mrContext << ",{1,1,1,1})" );
+ SAL_INFO( "vcl.cg", "CGContextSetRGBStrokeColor(" << mrContext << ",{1,1,1,1})" );
CGContextSetRGBStrokeColor ( mrContext, 1.0, 1.0, 1.0, 1.0 );
CGContextSetLineDash ( mrContext, 0, dashLengths, 2 );
CGContextSetLineWidth( mrContext, 2.0);
- CG_TRACE("CGContextStrokePath(" << mrContext << ")" );
+ SAL_INFO( "vcl.cg", "CGContextStrokePath(" << mrContext << ")" );
CGContextStrokePath ( mrContext );
}
else if ( nSalFlags & SAL_INVERT_50 )
@@ -1724,13 +1772,13 @@ void AquaSalGraphics::invert( sal_uInt32 nPoints, const SalPoint* pPtAry, SalIn
else // just invert
{
CGContextSetBlendMode( mrContext, kCGBlendModeDifference );
- CG_TRACE( "CGContextSetRGBFillColor(" << mrContext << ",{1,1,1,1})" );
+ SAL_INFO( "vcl.cg", "CGContextSetRGBFillColor(" << mrContext << ",{1,1,1,1})" );
CGContextSetRGBFillColor( mrContext, 1.0, 1.0, 1.0, 1.0 );
- CG_TRACE("CGContextFillPath(" << mrContext << ")" );
+ SAL_INFO( "vcl.cg", "CGContextFillPath(" << mrContext << ")" );
CGContextFillPath( mrContext );
}
const CGRect aRefreshRect = CGContextGetClipBoundingBox(mrContext);
- CG_TRACE( "CGContextRestoreGState(" << mrContext << ") " << mnContextStackDepth-- );
+ SAL_INFO( "vcl.cg", "CGContextRestoreGState(" << mrContext << ") " << mnContextStackDepth-- );
CGContextRestoreGState( mrContext);
delete [] CGpoints;
RefreshRect( aRefreshRect );
@@ -1747,11 +1795,11 @@ void AquaSalGraphics::Pattern50Fill()
kCGPatternTilingConstantSpacing,
false, &aCallback );
SAL_WARN_IF( !mrContext, "vcl.quartz", "mrContext is NULL" );
- CG_TRACE( "CGContextSetFillColorSpace(" << mrContext << "," << mxP50Space << ")" );
+ SAL_INFO( "vcl.cg", "CGContextSetFillColorSpace(" << mrContext << "," << mxP50Space << ")" );
CGContextSetFillColorSpace( mrContext, mxP50Space );
- CG_TRACE( "CGContextSetFillPattern(" << mrContext << "," << mxP50Pattern << ",{1,1,1,1})" );
+ SAL_INFO( "vcl.cg", "CGContextSetFillPattern(" << mrContext << "," << mxP50Pattern << ",{1,1,1,1})" );
CGContextSetFillPattern( mrContext, mxP50Pattern, aFillCol );
- CG_TRACE( "CGContextFillPath(" << mrContext << ")" );
+ SAL_INFO( "vcl.cg", "CGContextFillPath(" << mrContext << ")" );
CGContextFillPath( mrContext );
}
@@ -1760,7 +1808,7 @@ void AquaSalGraphics::ResetClipRegion()
// release old path and indicate no clipping
if( mxClipPath )
{
- CG_TRACE( "CGPathRelease(" << mxClipPath << ")" );
+ SAL_INFO( "vcl.cg", "CGPathRelease(" << mxClipPath << ")" );
CGPathRelease( mxClipPath );
mxClipPath = NULL;
}
@@ -1772,30 +1820,33 @@ void AquaSalGraphics::ResetClipRegion()
void AquaSalGraphics::SetState()
{
- CG_TRACE( "CGContextRestoreGState(" << mrContext << ") " << mnContextStackDepth--);
+ SAL_INFO( "vcl.cg", "CGContextRestoreGState(" << mrContext << ") " << mnContextStackDepth--);
CGContextRestoreGState( mrContext );
- CG_TRACE( "CGContextSaveGState(" << mrContext << ") " << ++mnContextStackDepth );
+ SAL_INFO( "vcl.cg", "CGContextSaveGState(" << mrContext << ") " << ++mnContextStackDepth );
CGContextSaveGState( mrContext );
// setup clipping
if( mxClipPath )
{
- CG_TRACE( "CGContextBeginPath(" << mrContext << ")" );
+ SAL_INFO( "vcl.cg", "CGContextBeginPath(" << mrContext << ")" );
CGContextBeginPath( mrContext ); // discard any existing path
- CG_TRACE( "CGContextAddPath(" << mrContext << "," << mxClipPath << ")" );
+ SAL_INFO( "vcl.cg", "CGContextAddPath(" << mrContext << "," << mxClipPath << ")" );
CGContextAddPath( mrContext, mxClipPath ); // set the current path to the clipping path
- CG_TRACE( "CGContextClip(" << mrContext << ")" );
+ SAL_INFO( "vcl.cg", "CGContextClip(" << mrContext << ")" );
CGContextClip( mrContext ); // use it for clipping
}
// set RGB colorspace and line and fill colors
- CG_TRACE( "CGContextSetFillColor(" << mrContext << "," << maFillColor << ")" );
+ SAL_INFO( "vcl.cg", "CGContextSetFillColor(" << mrContext << "," << maFillColor << ")" );
CGContextSetFillColor( mrContext, maFillColor.AsArray() );
- CG_TRACE( "CGContextSetStrokeColor(" << mrContext << "," << maLineColor << ")" );
+
+ SAL_INFO( "vcl.cg", "CGContextSetStrokeColor(" << mrContext << "," << maLineColor << ")" );
CGContextSetStrokeColor( mrContext, maLineColor.AsArray() );
CGContextSetShouldAntialias( mrContext, false );
if( mnXorMode == 2 )
+ {
CGContextSetBlendMode( mrContext, kCGBlendModeDifference );
+ }
}
void AquaSalGraphics::SetLineColor()
@@ -1803,7 +1854,7 @@ void AquaSalGraphics::SetLineColor()
maLineColor.SetAlpha( 0.0 ); // transparent
if( CheckContext() )
{
- CG_TRACE( "CGContextSetRGBStrokeColor(" << mrContext << "," << maLineColor << ")" );
+ SAL_INFO( "vcl.cg", "CGContextSetRGBStrokeColor(" << mrContext << "," << maLineColor << ")" );
CGContextSetRGBStrokeColor( mrContext, maLineColor.GetRed(), maLineColor.GetGreen(),
maLineColor.GetBlue(), maLineColor.GetAlpha() );
}
@@ -1814,7 +1865,7 @@ void AquaSalGraphics::SetLineColor( SalColor nSalColor )
maLineColor = RGBAColor( nSalColor );
if( CheckContext() )
{
- CG_TRACE( "CGContextSetRGBStrokeColor(" << mrContext << "," << maLineColor << ")" );
+ SAL_INFO( "vcl.cg", "CGContextSetRGBStrokeColor(" << mrContext << "," << maLineColor << ")" );
CGContextSetRGBStrokeColor( mrContext, maLineColor.GetRed(), maLineColor.GetGreen(),
maLineColor.GetBlue(), maLineColor.GetAlpha() );
}
@@ -1825,7 +1876,7 @@ void AquaSalGraphics::SetFillColor()
maFillColor.SetAlpha( 0.0 ); // transparent
if( CheckContext() )
{
- CG_TRACE( "CGContextSetRGBFillColor(" << mrContext << "," << maFillColor << ")" );
+ SAL_INFO( "vcl.cg", "CGContextSetRGBFillColor(" << mrContext << "," << maFillColor << ")" );
CGContextSetRGBFillColor( mrContext, maFillColor.GetRed(), maFillColor.GetGreen(),
maFillColor.GetBlue(), maFillColor.GetAlpha() );
}
@@ -1836,7 +1887,7 @@ void AquaSalGraphics::SetFillColor( SalColor nSalColor )
maFillColor = RGBAColor( nSalColor );
if( CheckContext() )
{
- CG_TRACE( "CGContextSetRGBFillColor(" << mrContext << "," << maFillColor << ")" );
+ SAL_INFO( "vcl.cg", "CGContextSetRGBFillColor(" << mrContext << "," << maFillColor << ")" );
CGContextSetRGBFillColor( mrContext, maFillColor.GetRed(), maFillColor.GetGreen(),
maFillColor.GetBlue(), maFillColor.GetAlpha() );
}
@@ -1852,7 +1903,8 @@ bool AquaSalGraphics::supportsOperation( OutDevSupportType eType ) const
case OutDevSupport_B2DDraw:
bRet = true;
break;
- default: break;
+ default:
+ break;
}
return bRet;
}
@@ -1862,12 +1914,12 @@ bool AquaSalGraphics::setClipRegion( const vcl::Region& i_rClip )
// release old clip path
if( mxClipPath )
{
- CG_TRACE( "CGPathRelease(" << mxClipPath << ")" );
+ SAL_INFO( "vcl.cg", "CGPathRelease(" << mxClipPath << ")" );
CGPathRelease( mxClipPath );
mxClipPath = NULL;
}
mxClipPath = CGPathCreateMutable();
- CG_TRACE( "CGPathCreateMutable() = " << mxClipPath );
+ SAL_INFO( "vcl.cg", "CGPathCreateMutable() = " << mxClipPath );
// set current path, either as polypolgon or sequence of rectangles
if(i_rClip.HasPolyPolygonOrB2DPolyPolygon())
@@ -1881,7 +1933,8 @@ bool AquaSalGraphics::setClipRegion( const vcl::Region& i_rClip )
RectangleVector aRectangles;
i_rClip.GetRegionRectangles(aRectangles);
- for(RectangleVector::const_iterator aRectIter(aRectangles.begin()); aRectIter != aRectangles.end(); ++aRectIter)
+ for(RectangleVector::const_iterator aRectIter(aRectangles.begin());
+ aRectIter != aRectangles.end(); ++aRectIter)
{
const long nW(aRectIter->Right() - aRectIter->Left() + 1); // uses +1 logic in original
@@ -1892,7 +1945,7 @@ bool AquaSalGraphics::setClipRegion( const vcl::Region& i_rClip )
if(nH)
{
const CGRect aRect = CGRectMake( aRectIter->Left(), aRectIter->Top(), nW, nH);
- CG_TRACE( "CGPathAddRect(" << mxClipPath << ",NULL," << aRect << ")" );
+ SAL_INFO( "vcl.cg", "CGPathAddRect(" << mxClipPath << ",NULL," << aRect << ")" );
CGPathAddRect( mxClipPath, NULL, aRect );
}
}
@@ -1909,13 +1962,17 @@ bool AquaSalGraphics::setClipRegion( const vcl::Region& i_rClip )
void AquaSalGraphics::SetROPFillColor( SalROPColor nROPColor )
{
if( ! mbPrinter )
+ {
SetFillColor( ImplGetROPSalColor( nROPColor ) );
+ }
}
void AquaSalGraphics::SetROPLineColor( SalROPColor nROPColor )
{
if( ! mbPrinter )
+ {
SetLineColor( ImplGetROPSalColor( nROPColor ) );
+ }
}
void AquaSalGraphics::SetXORMode( bool bSet, bool bInvertOnly )
@@ -1985,14 +2042,14 @@ void AquaSalGraphics::updateResolution()
#endif
XorEmulation::XorEmulation()
-: m_xTargetLayer( NULL )
-, m_xTargetContext( NULL )
-, m_xMaskContext( NULL )
-, m_xTempContext( NULL )
-, m_pMaskBuffer( NULL )
-, m_pTempBuffer( NULL )
-, m_nBufferLongs( 0 )
-, m_bIsEnabled( false )
+ : m_xTargetLayer( NULL )
+ , m_xTargetContext( NULL )
+ , m_xMaskContext( NULL )
+ , m_xTempContext( NULL )
+ , m_pMaskBuffer( NULL )
+ , m_pTempBuffer( NULL )
+ , m_nBufferLongs( 0 )
+ , m_bIsEnabled( false )
{
SAL_INFO( "vcl.quartz", "XorEmulation::XorEmulation() this=" << this );
}
@@ -2007,13 +2064,15 @@ XorEmulation::~XorEmulation()
void XorEmulation::SetTarget( int nWidth, int nHeight, int nTargetDepth,
CGContextRef xTargetContext, CGLayerRef xTargetLayer )
{
- SAL_INFO( "vcl.quartz", "XorEmulation::SetTarget() this=" << this << " (" << nWidth << "x" << nHeight << ") depth=" << nTargetDepth << " context=" << xTargetContext << " layer=" << xTargetLayer );
+ SAL_INFO( "vcl.quartz", "XorEmulation::SetTarget() this=" << this <<
+ " (" << nWidth << "x" << nHeight << ") depth=" << nTargetDepth <<
+ " context=" << xTargetContext << " layer=" << xTargetLayer );
// prepare to replace old mask+temp context
if( m_xMaskContext )
{
// cleanup the mask context
- CG_TRACE( "CGContextRelease(" << m_xMaskContext << ")" );
+ SAL_INFO( "vcl.cg", "CGContextRelease(" << m_xMaskContext << ")" );
CGContextRelease( m_xMaskContext );
delete[] m_pMaskBuffer;
m_xMaskContext = NULL;
@@ -2022,7 +2081,7 @@ void XorEmulation::SetTarget( int nWidth, int nHeight, int nTargetDepth,
// cleanup the temp context if needed
if( m_xTempContext )
{
- CG_TRACE( "CGContextRelease(" << m_xTempContext << ")" );
+ SAL_INFO( "vcl.cg", "CGContextRelease(" << m_xTempContext << ")" );
CGContextRelease( m_xTempContext );
delete[] m_pTempBuffer;
m_xTempContext = NULL;
@@ -2065,7 +2124,7 @@ void XorEmulation::SetTarget( int nWidth, int nHeight, int nTargetDepth,
nBitsPerComponent, nBytesPerRow,
aCGColorSpace, aCGBmpInfo );
SAL_WARN_IF( !m_xMaskContext, "vcl.quartz", "mask context creation failed" );
- CG_TRACE( "CGBitmapContextCreate(" << nWidth << "x" << nHeight << ") = " << m_xMaskContext );
+ SAL_INFO( "vcl.cg", "CGBitmapContextCreate(" << nWidth << "x" << nHeight << ") = " << m_xMaskContext );
// reset the XOR mask to black
memset( m_pMaskBuffer, 0, m_nBufferLongs * sizeof(sal_uLong) );
@@ -2073,7 +2132,9 @@ void XorEmulation::SetTarget( int nWidth, int nHeight, int nTargetDepth,
// a bitmap context will be needed for manual XORing
// create one unless the target context is a bitmap context
if( nTargetDepth )
+ {
m_pTempBuffer = static_cast<sal_uLong*>(CGBitmapContextGetData( m_xTargetContext ));
+ }
if( !m_pTempBuffer )
{
// create a bitmap context matching to the target context
@@ -2083,7 +2144,7 @@ void XorEmulation::SetTarget( int nWidth, int nHeight, int nTargetDepth,
nBitsPerComponent, nBytesPerRow,
aCGColorSpace, aCGBmpInfo );
SAL_WARN_IF( !m_xTempContext, "vcl.quartz", "temp context creation failed" );
- CG_TRACE( "CGBitmapContextCreate(" << nWidth << "x" << nHeight << ") = " << m_xTempContext );
+ SAL_INFO( "vcl.cg", "CGBitmapContextCreate(" << nWidth << "x" << nHeight << ") = " << m_xTempContext );
}
// initialize XOR mask context for drawing
@@ -2120,7 +2181,7 @@ bool XorEmulation::UpdateTarget()
if( m_xTempContext )
{
SAL_WARN_IF( m_xTargetContext == NULL, "vcl.quartz", "Target layer is NULL");
- CG_TRACE( "CGContextDrawLayerAtPoint(" << m_xTempContext << "," << CGPointZero << "," << m_xTargetLayer << ")" );
+ SAL_INFO( "vcl.cg", "CGContextDrawLayerAtPoint(" << m_xTempContext << "," << CGPointZero << "," << m_xTargetLayer << ")" );
CGContextDrawLayerAtPoint( m_xTempContext, CGPointZero, m_xTargetLayer );
}
// do a manual XOR with the XorMask
@@ -2136,14 +2197,14 @@ bool XorEmulation::UpdateTarget()
if( m_xTempContext )
{
CGImageRef xXorImage = CGBitmapContextCreateImage( m_xTempContext );
- CG_TRACE( "CGBitmapContextCreateImage(" << m_xTempContext << ") = " << xXorImage );
+ SAL_INFO( "vcl.cg", "CGBitmapContextCreateImage(" << m_xTempContext << ") = " << xXorImage );
const int nWidth = (int)CGImageGetWidth( xXorImage );
const int nHeight = (int)CGImageGetHeight( xXorImage );
// TODO: update minimal changerect
const CGRect aFullRect = CGRectMake(0, 0, nWidth, nHeight);
- CG_TRACE( "CGContextDrawImage(" << m_xTargetContext << "," << aFullRect << "," << xXorImage << ")" );
+ SAL_INFO( "vcl.cg", "CGContextDrawImage(" << m_xTargetContext << "," << aFullRect << "," << xXorImage << ")" );
CGContextDrawImage( m_xTargetContext, aFullRect, xXorImage );
- CG_TRACE( "CGImageRelease(" << xXorImage << ")" );
+ SAL_INFO( "vcl.cg", "CGImageRelease(" << xXorImage << ")" );
CGImageRelease( xXorImage );
}
@@ -2161,10 +2222,10 @@ void AquaSalGraphics::SetVirDevGraphics( CGLayerRef xLayer, CGContextRef xContex
SAL_INFO( "vcl.quartz", "SetVirDevGraphics() this=" << this << " layer=" << xLayer << " context=" << xContext );
#ifndef IOS
- mbWindow = false;
+ mbWindow = false;
#endif
- mbPrinter = false;
- mbVirDev = true;
+ mbPrinter = false;
+ mbVirDev = true;
#ifdef IOS
(void) nBitmapDepth;
@@ -2174,7 +2235,7 @@ void AquaSalGraphics::SetVirDevGraphics( CGLayerRef xLayer, CGContextRef xContex
// We will return early a few lines lower.
// Undo the "stack initialization" done at the initial call of
// this method, see end.
- CG_TRACE( "CGContextRestoreGState(" << mrContext << ") " << mnContextStackDepth--);
+ SAL_INFO( "vcl.cg", "CGContextRestoreGState(" << mrContext << ") " << mnContextStackDepth--);
CGContextRestoreGState( mrContext );
}
#endif
@@ -2200,14 +2261,15 @@ void AquaSalGraphics::SetVirDevGraphics( CGLayerRef xLayer, CGContextRef xContex
{
mnWidth = CGBitmapContextGetWidth( mrContext );
mnHeight = CGBitmapContextGetHeight( mrContext );
- CG_TRACE( "CGBitmapContextGetWidth&Height(" << mrContext << ") = " << mnWidth << "x" << mnHeight );
+ SAL_INFO( "vcl.cg", "CGBitmapContextGetWidth&Height(" << mrContext <<
+ ") = " << mnWidth << "x" << mnHeight );
}
else
{
const CGSize aSize = CGLayerGetSize( mxLayer );
mnWidth = static_cast<int>(aSize.width);
mnHeight = static_cast<int>(aSize.height);
- CG_TRACE( "CGLayerGetSize(" << mxLayer << ") = " << aSize );
+ SAL_INFO( "vcl.cg", "CGLayerGetSize(" << mxLayer << ") = " << aSize );
}
// prepare graphics for drawing
@@ -2220,11 +2282,13 @@ void AquaSalGraphics::SetVirDevGraphics( CGLayerRef xLayer, CGContextRef xContex
{
mpXorEmulation->SetTarget( mnWidth, mnHeight, mnBitmapDepth, mrContext, mxLayer );
if( mpXorEmulation->IsEnabled() )
+ {
mrContext = mpXorEmulation->GetMaskContext();
+ }
}
// initialize stack of CGContext states
- CG_TRACE( "CGContextSaveGState(" << mrContext << ") " << ++mnContextStackDepth );
+ SAL_INFO( "vcl.cg", "CGContextSaveGState(" << mrContext << ") " << ++mnContextStackDepth );
CGContextSaveGState( mrContext );
SetState();
}
diff --git a/vcl/quartz/salgdiutils.cxx b/vcl/quartz/salgdiutils.cxx
index 87bc282559e2..58d1d45f810b 100644
--- a/vcl/quartz/salgdiutils.cxx
+++ b/vcl/quartz/salgdiutils.cxx
@@ -17,16 +17,16 @@
* the License at http://www.apache.org/licenses/LICENSE-2.0 .
*/
-#include "basebmp/scanlineformats.hxx"
-#include "basebmp/color.hxx"
+#include <sal/config.h>
-#include "basegfx/range/b2drectangle.hxx"
-#include "basegfx/range/b2irange.hxx"
-#include "basegfx/vector/b2ivector.hxx"
-#include "basegfx/polygon/b2dpolygon.hxx"
-#include "basegfx/polygon/b2dpolygontools.hxx"
-
-#include "vcl/svapp.hxx"
+#include <basebmp/color.hxx>
+#include <basebmp/scanlineformats.hxx>
+#include <basegfx/polygon/b2dpolygon.hxx>
+#include <basegfx/polygon/b2dpolygontools.hxx>
+#include <basegfx/range/b2drectangle.hxx>
+#include <basegfx/range/b2irange.hxx>
+#include <basegfx/vector/b2ivector.hxx>
+#include <vcl/svapp.hxx>
#include "quartz/salgdi.h"
#include "quartz/utils.h"
@@ -35,22 +35,21 @@
void AquaSalGraphics::SetWindowGraphics( AquaSalFrame* pFrame )
{
- mpFrame = pFrame;
-
- mbWindow = true;
- mbPrinter = false;
- mbVirDev = false;
+ mpFrame = pFrame;
+ mbWindow = true;
+ mbPrinter = false;
+ mbVirDev = false;
}
void AquaSalGraphics::SetPrinterGraphics( CGContextRef xContext, long nDPIX, long nDPIY )
{
- mbWindow = false;
- mbPrinter = true;
- mbVirDev = false;
+ mbWindow = false;
+ mbPrinter = true;
+ mbVirDev = false;
- mrContext = xContext;
- mnRealDPIX = nDPIX;
- mnRealDPIY = nDPIY;
+ mrContext = xContext;
+ mnRealDPIX = nDPIX;
+ mnRealDPIY = nDPIY;
// a previously set clip path is now invalid
if( mxClipPath )
@@ -78,13 +77,13 @@ void AquaSalGraphics::UnsetState()
{
if( mrContext )
{
- CG_TRACE( "CGContextRestoreGState(" << mrContext << ")" );
+ SAL_INFO( "vcl.cg", "CGContextRestoreGState(" << mrContext << ")" );
CGContextRestoreGState( mrContext );
mrContext = 0;
}
if( mxClipPath )
{
- CG_TRACE( "CGPathRelease(" << mxClipPath << ")" );
+ SAL_INFO( "vcl.cg", "CGPathRelease(" << mxClipPath << ")" );
CGPathRelease( mxClipPath );
mxClipPath = NULL;
}
@@ -118,11 +117,11 @@ bool AquaSalGraphics::CheckContext()
NSGraphicsContext* pNSGContext = [NSGraphicsContext graphicsContextWithWindow: mpFrame->getNSWindow()];
CGContextRef xCGContext = static_cast<CGContextRef>([pNSGContext graphicsPort]);
mxLayer = CGLayerCreateWithContext( xCGContext, aLayerSize, NULL );
- CG_TRACE( "CGLayerCreateWithContext(" << xCGContext << "," << aLayerSize << ",NULL) = " << mxLayer );
+ SAL_INFO( "vcl.cg", "CGLayerCreateWithContext(" << xCGContext << "," << aLayerSize << ",NULL) = " << mxLayer );
if( mxLayer )
{
mrContext = CGLayerGetContext( mxLayer );
- CG_TRACE( "CGLayerGetContext(" << mxLayer << ") = " << mrContext );
+ SAL_INFO( "vcl.cg", "CGLayerGetContext(" << mxLayer << ") = " << mrContext );
}
if( mrContext )
@@ -130,7 +129,7 @@ bool AquaSalGraphics::CheckContext()
// copy original layer to resized layer
if( rReleaseLayer )
{
- CG_TRACE( "CGContextDrawLayerAtPoint(" << mrContext << "," << CGPointZero << "," << rReleaseLayer << ")" );
+ SAL_INFO( "vcl.cg", "CGContextDrawLayerAtPoint(" << mrContext << "," << CGPointZero << "," << rReleaseLayer << ")" );
CGContextDrawLayerAtPoint( mrContext, CGPointZero, rReleaseLayer );
}
@@ -138,24 +137,26 @@ bool AquaSalGraphics::CheckContext()
CGContextScaleCTM( mrContext, 1.0, -1.0 );
CGContextSetFillColorSpace( mrContext, GetSalData()->mxRGBSpace );
CGContextSetStrokeColorSpace( mrContext, GetSalData()->mxRGBSpace );
- CG_TRACE( "CGContextSaveGState(" << mrContext << ") " << ++mnContextStackDepth );
+ SAL_INFO( "vcl.cg", "CGContextSaveGState(" << mrContext << ") " << ++mnContextStackDepth );
CGContextSaveGState( mrContext );
SetState();
// re-enable XOR emulation for the new context
if( mpXorEmulation )
+ {
mpXorEmulation->SetTarget( mnWidth, mnHeight, mnBitmapDepth, mrContext, mxLayer );
+ }
}
}
if( rReleaseLayer )
{
- CG_TRACE( "CGLayerRelease(" << rReleaseLayer << ")" );
+ SAL_INFO( "vcl.cg", "CGLayerRelease(" << rReleaseLayer << ")" );
CGLayerRelease( rReleaseLayer );
}
else if( rReleaseContext )
{
- CG_TRACE( "CGContextRelease(" << rReleaseContext << ")" );
+ SAL_INFO( "vcl.cg", "CGContextRelease(" << rReleaseContext << ")" );
CGContextRelease( rReleaseContext );
}
}
@@ -176,33 +177,40 @@ CGContextRef AquaSalGraphics::GetContext()
void AquaSalGraphics::UpdateWindow( NSRect& )
{
if( !mpFrame )
+ {
return;
+ }
+
NSGraphicsContext* pContext = [NSGraphicsContext currentContext];
if( (mxLayer != NULL) && (pContext != NULL) )
{
CGContextRef rCGContext = static_cast<CGContextRef>([pContext graphicsPort]);
- CG_TRACE( "[[NSGraphicsContext currentContext] graphicsPort] = " << rCGContext );
+ SAL_INFO( "vcl.cg", "[[NSGraphicsContext currentContext] graphicsPort] = " << rCGContext );
CGMutablePathRef rClip = mpFrame->getClipPath();
if( rClip )
{
CGContextSaveGState( rCGContext );
- CG_TRACE( "CGContextBeginPath(" << rCGContext << ")" );
+ SAL_INFO( "vcl.cg", "CGContextBeginPath(" << rCGContext << ")" );
CGContextBeginPath( rCGContext );
- CG_TRACE( "CGContextAddPath(" << rCGContext << "," << rClip << ")" );
+ SAL_INFO( "vcl.cg", "CGContextAddPath(" << rCGContext << "," << rClip << ")" );
CGContextAddPath( rCGContext, rClip );
- CG_TRACE( "CGContextClip(" << rCGContext << ")" );
+ SAL_INFO( "vcl.cg", "CGContextClip(" << rCGContext << ")" );
CGContextClip( rCGContext );
}
ApplyXorContext();
- CG_TRACE( "CGContextDrawLayerAtPoint(" << rCGContext << "," << CGPointZero << "," << mxLayer << ")" );
+ SAL_INFO( "vcl.cg", "CGContextDrawLayerAtPoint(" << rCGContext << "," << CGPointZero << "," << mxLayer << ")" );
CGContextDrawLayerAtPoint( rCGContext, CGPointZero, mxLayer );
if( rClip ) // cleanup clipping
+ {
CGContextRestoreGState( rCGContext );
+ }
}
else
+ {
DBG_ASSERT( mpFrame->mbInitShow, "UpdateWindow called on uneligible graphics" );
+ }
}
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/vcl/quartz/salvd.cxx b/vcl/quartz/salvd.cxx
index ae25748dfa12..5427eb096940 100644
--- a/vcl/quartz/salvd.cxx
+++ b/vcl/quartz/salvd.cxx
@@ -17,10 +17,11 @@
* the License at http://www.apache.org/licenses/LICENSE-2.0 .
*/
+#include <sal/config.h>
+
#include "vcl/svapp.hxx"
#include "vcl/sysdata.hxx"
-#include "quartz/salvd.h"
#ifdef MACOSX
#include "osx/salinst.h"
#include "osx/saldata.hxx"
@@ -32,17 +33,23 @@
#include "headless/svpvd.hxx"
#endif
#include "quartz/salgdi.h"
+#include "quartz/salvd.h"
#include "quartz/utils.h"
SalVirtualDevice* AquaSalInstance::CreateVirtualDevice( SalGraphics* pGraphics,
- long &nDX, long &nDY, sal_uInt16 nBitCount, const SystemGraphicsData *pData )
+ long &nDX, long &nDY,
+ sal_uInt16 nBitCount,
+ const SystemGraphicsData *pData )
{
// #i92075# can be called first in a thread
SalData::ensureThreadAutoreleasePool();
#ifdef IOS
if( pData )
- return new AquaSalVirtualDevice( static_cast< AquaSalGraphics* >( pGraphics ), nDX, nDY, nBitCount, pData );
+ {
+ return new AquaSalVirtualDevice( static_cast< AquaSalGraphics* >( pGraphics ),
+ nDX, nDY, nBitCount, pData );
+ }
else
{
AquaSalVirtualDevice* pNew = new AquaSalVirtualDevice( NULL, nDX, nDY, nBitCount, NULL );
@@ -50,27 +57,37 @@ SalVirtualDevice* AquaSalInstance::CreateVirtualDevice( SalGraphics* pGraphics,
return pNew;
}
#else
- return new AquaSalVirtualDevice( static_cast< AquaSalGraphics* >( pGraphics ), nDX, nDY, nBitCount, pData );
+ return new AquaSalVirtualDevice( static_cast< AquaSalGraphics* >( pGraphics ),
+ nDX, nDY, nBitCount, pData );
#endif
}
-AquaSalVirtualDevice::AquaSalVirtualDevice( AquaSalGraphics* pGraphic, long &nDX, long &nDY, sal_uInt16 nBitCount, const SystemGraphicsData *pData )
-: mbGraphicsUsed( false )
-, mxBitmapContext( NULL )
-, mnBitmapDepth( 0 )
-, mxLayer( NULL )
+AquaSalVirtualDevice::AquaSalVirtualDevice( AquaSalGraphics* pGraphic, long &nDX, long &nDY,
+ sal_uInt16 nBitCount, const SystemGraphicsData *pData )
+ : mbGraphicsUsed( false )
+ , mxBitmapContext( NULL )
+ , mnBitmapDepth( 0 )
+ , mxLayer( NULL )
{
- SAL_INFO( "vcl.virdev", "AquaSalVirtualDevice::AquaSalVirtualDevice() this=" << this << " size=(" << nDX << "x" << nDY << ") bitcount=" << nBitCount << " pData=" << pData << " context=" << (pData ? pData->rCGContext : 0) );
+ SAL_INFO( "vcl.virdev", "AquaSalVirtualDevice::AquaSalVirtualDevice() this=" << this
+ << " size=(" << nDX << "x" << nDY << ") bitcount=" << nBitCount <<
+ " pData=" << pData << " context=" << (pData ? pData->rCGContext : 0) );
+
if( pGraphic && pData && pData->rCGContext )
{
// Create virtual device based on existing SystemGraphicsData
// We ignore nDx and nDY, as the desired size comes from the SystemGraphicsData.
- mbForeignContext = true; // the mxContext is from pData (what "mxContext"? there is no such field anywhere in vcl;)
+ // the mxContext is from pData (what "mxContext"? there is no such field anywhere in vcl;)
+ mbForeignContext = true;
mpGraphics = new AquaSalGraphics( /*pGraphic*/ );
if (nDX == 0)
+ {
nDX = 1;
+ }
if (nDY == 0)
+ {
nDY = 1;
+ }
mxLayer = CGLayerCreateWithContext( pData->rCGContext, CGSizeMake( nDX, nDY), NULL );
// Interrogate the context as to its real size
if (mxLayer)
@@ -84,7 +101,8 @@ AquaSalVirtualDevice::AquaSalVirtualDevice( AquaSalGraphics* pGraphic, long &nDX
nDX = 0;
nDY = 0;
}
- CG_TRACE( "CGLayerCreateWithContext(" << pData->rCGContext << "," << CGSizeMake( nDX, nDY) << ",NULL) = " << mxLayer );
+ SAL_INFO( "vcl.cg", "CGLayerCreateWithContext(" << pData->rCGContext <<
+ "," << CGSizeMake( nDX, nDY) << ",NULL) = " << mxLayer );
mpGraphics->SetVirDevGraphics( mxLayer, pData->rCGContext );
}
else
@@ -106,8 +124,9 @@ AquaSalVirtualDevice::AquaSalVirtualDevice( AquaSalGraphics* pGraphic, long &nDX
}
#endif
if( nDX && nDY )
+ {
SetSize( nDX, nDY );
-
+ }
// NOTE: if SetSize does not succeed, we just ignore the nDX and nDY
}
}
@@ -115,6 +134,7 @@ AquaSalVirtualDevice::AquaSalVirtualDevice( AquaSalGraphics* pGraphic, long &nDX
AquaSalVirtualDevice::~AquaSalVirtualDevice()
{
SAL_INFO( "vcl.virdev", "AquaSalVirtualDevice::~AquaSalVirtualDevice() this=" << this );
+
if( mpGraphics )
{
mpGraphics->SetVirDevGraphics( NULL, NULL );
@@ -128,7 +148,8 @@ void AquaSalVirtualDevice::Destroy()
{
SAL_INFO( "vcl.virdev", "AquaSalVirtualDevice::Destroy() this=" << this << " mbForeignContext=" << mbForeignContext );
- if( mbForeignContext ) {
+ if( mbForeignContext )
+ {
// Do not delete mxContext that we have received from outside VCL
mxLayer = NULL;
return;
@@ -137,8 +158,10 @@ void AquaSalVirtualDevice::Destroy()
if( mxLayer )
{
if( mpGraphics )
+ {
mpGraphics->SetVirDevGraphics( NULL, NULL );
- CG_TRACE( "CGLayerRelease(" << mxLayer << ")" );
+ }
+ SAL_INFO( "vcl.cg", "CGLayerRelease(" << mxLayer << ")" );
CGLayerRelease( mxLayer );
mxLayer = NULL;
}
@@ -147,7 +170,7 @@ void AquaSalVirtualDevice::Destroy()
{
void* pRawData = CGBitmapContextGetData( mxBitmapContext );
rtl_freeMemory( pRawData );
- CG_TRACE( "CGContextRelease(" << mxBitmapContext << ")" );
+ SAL_INFO( "vcl.cg", "CGContextRelease(" << mxBitmapContext << ")" );
CGContextRelease( mxBitmapContext );
mxBitmapContext = NULL;
}
@@ -156,8 +179,9 @@ void AquaSalVirtualDevice::Destroy()
SalGraphics* AquaSalVirtualDevice::AcquireGraphics()
{
if( mbGraphicsUsed || !mpGraphics )
+ {
return 0;
-
+ }
mbGraphicsUsed = true;
return mpGraphics;
}
@@ -169,7 +193,8 @@ void AquaSalVirtualDevice::ReleaseGraphics( SalGraphics* )
bool AquaSalVirtualDevice::SetSize( long nDX, long nDY )
{
- SAL_INFO( "vcl.virdev", "AquaSalVirtualDevice::SetSize() this=" << this << " (" << nDX << "x" << nDY << ") mbForeignContext=" << mbForeignContext );
+ SAL_INFO( "vcl.virdev", "AquaSalVirtualDevice::SetSize() this=" << this <<
+ " (" << nDX << "x" << nDY << ") mbForeignContext=" << mbForeignContext );
if( mbForeignContext )
{
@@ -180,7 +205,7 @@ bool AquaSalVirtualDevice::SetSize( long nDX, long nDY )
if( mxLayer )
{
const CGSize aSize = CGLayerGetSize( mxLayer );
- CG_TRACE( "CGlayerGetSize(" << mxLayer << ") = " << aSize );
+ SAL_INFO( "vcl.cg", "CGlayerGetSize(" << mxLayer << ") = " << aSize );
if( (nDX == aSize.width) && (nDY == aSize.height) )
{
// Yay, we do not have to do anything :)
@@ -200,11 +225,14 @@ bool AquaSalVirtualDevice::SetSize( long nDX, long nDY )
void* pRawData = rtl_allocateMemory( nBytesPerRow * nDY );
#ifdef DBG_UTIL
for (ssize_t i = 0; i < nBytesPerRow * nDY; i++)
+ {
static_cast<sal_uInt8*>(pRawData)[i] = (i & 0xFF);
+ }
#endif
mxBitmapContext = CGBitmapContextCreate( pRawData, nDX, nDY,
- mnBitmapDepth, nBytesPerRow, GetSalData()->mxGraySpace, kCGImageAlphaNone );
- CG_TRACE( "CGBitmapContextCreate(" << nDX << "x" << nDY << "x" << mnBitmapDepth << ") = " << mxBitmapContext );
+ mnBitmapDepth, nBytesPerRow,
+ GetSalData()->mxGraySpace, kCGImageAlphaNone );
+ SAL_INFO( "vcl.cg", "CGBitmapContextCreate(" << nDX << "x" << nDY << "x" << mnBitmapDepth << ") = " << mxBitmapContext );
xCGContext = mxBitmapContext;
}
else
@@ -236,37 +264,43 @@ bool AquaSalVirtualDevice::SetSize( long nDX, long nDY )
{
NSGraphicsContext* pNSContext = [NSGraphicsContext graphicsContextWithWindow: pNSWindow];
if( pNSContext )
+ {
xCGContext = static_cast<CGContextRef>([pNSContext graphicsPort]);
+ }
}
else
{
// fall back to a bitmap context
mnBitmapDepth = 32;
- const int nBytesPerRow = (mnBitmapDepth * nDX) / 8;
+ const int nBytesPerRow = (mnBitmapDepth * nDX) / 8;
void* pRawData = rtl_allocateMemory( nBytesPerRow * nDY );
#ifdef DBG_UTIL
for (ssize_t i = 0; i < nBytesPerRow * nDY; i++)
+ {
static_cast<sal_uInt8*>(pRawData)[i] = (i & 0xFF);
+ }
#endif
mxBitmapContext = CGBitmapContextCreate( pRawData, nDX, nDY,
8, nBytesPerRow, GetSalData()->mxRGBSpace, kCGImageAlphaNoneSkipFirst );
- CG_TRACE( "CGBitmapContextCreate(" << nDX << "x" << nDY << "x32) = " << mxBitmapContext );
+ SAL_INFO( "vcl.cg", "CGBitmapContextCreate(" << nDX << "x" << nDY << "x32) = " << mxBitmapContext );
xCGContext = mxBitmapContext;
}
}
#else
mnBitmapDepth = 32;
- const int nBytesPerRow = (mnBitmapDepth * nDX) / 8;
+ const int nBytesPerRow = (mnBitmapDepth * nDX) / 8;
void* pRawData = rtl_allocateMemory( nBytesPerRow * nDY );
#ifdef DBG_UTIL
for (ssize_t i = 0; i < nBytesPerRow * nDY; i++)
+ {
((sal_uInt8*)pRawData)[i] = (i & 0xFF);
+ }
#endif
mxBitmapContext = CGBitmapContextCreate( pRawData, nDX, nDY,
8, nBytesPerRow, GetSalData()->mxRGBSpace, kCGImageAlphaNoneSkipFirst );
- CG_TRACE( "CGBitmapContextCreate(" << nDX << "x" << nDY << "x32) = " << mxBitmapContext );
+ SAL_INFO( "vcl.cg", "CGBitmapContextCreate(" << nDX << "x" << nDY << "x32) = " << mxBitmapContext );
xCGContext = mxBitmapContext;
#endif
}
@@ -275,13 +309,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 );
+ SAL_INFO( "vcl.cg", "CGLayerCreateWithContext(" << xCGContext << "," << aNewSize << ",NULL) = " << mxLayer );
if( mxLayer && mpGraphics )
{
// get the matching Quartz context
CGContextRef xDrawContext = CGLayerGetContext( mxLayer );
- CG_TRACE( "CGLayerGetContext(" << mxLayer << ") = " << xDrawContext );
+ SAL_INFO( "vcl.cg", "CGLayerGetContext(" << mxLayer << ") = " << xDrawContext );
mpGraphics->SetVirDevGraphics( mxLayer, xDrawContext, mnBitmapDepth );
}
diff --git a/vcl/quartz/utils.cxx b/vcl/quartz/utils.cxx
index 309859085a37..86832ff88be9 100644
--- a/vcl/quartz/utils.cxx
+++ b/vcl/quartz/utils.cxx
@@ -17,6 +17,8 @@
* the License at http://www.apache.org/licenses/LICENSE-2.0 .
*/
+#include <sal/config.h>
+
#include <iostream>
#include <iomanip>
@@ -28,16 +30,26 @@
OUString GetOUString( CFStringRef rStr )
{
if( rStr == 0 )
+ {
return OUString();
+ }
+
CFIndex nLength = CFStringGetLength( rStr );
if( nLength == 0 )
+ {
return OUString();
+ }
+
const UniChar* pConstStr = CFStringGetCharactersPtr( rStr );
if( pConstStr )
+ {
return OUString( pConstStr, nLength );
+ }
+
UniChar* pStr = static_cast<UniChar*>( rtl_allocateMemory( sizeof(UniChar)*nLength ) );
CFRange aRange = { 0, nLength };
CFStringGetCharacters( rStr, aRange, pStr );
+
OUString aRet( pStr, nLength );
rtl_freeMemory( pStr );
return aRet;
@@ -46,14 +58,20 @@ OUString GetOUString( CFStringRef rStr )
OUString GetOUString( NSString* pStr )
{
if( ! pStr )
+ {
return OUString();
+ }
+
int nLen = [pStr length];
if( nLen == 0 )
+ {
return OUString();
+ }
OUStringBuffer aBuf( nLen+1 );
aBuf.setLength( nLen );
[pStr getCharacters: const_cast<sal_Unicode*>(aBuf.getStr())];
+
return aBuf.makeStringAndClear();
}
@@ -73,9 +91,13 @@ std::ostream &operator <<(std::ostream& s, const CGRect &rRect)
(void) rRect;
#else
if (CGRectIsNull(rRect))
+ {
s << "NULL";
+ }
else
+ {
s << rRect.size << "@" << rRect.origin;
+ }
#endif
return s;
}
@@ -106,10 +128,13 @@ std::ostream &operator <<(std::ostream& s, CGColorRef pColor)
(void) pColor;
#else
CFStringRef colorString = CFCopyDescription(pColor);
- if (colorString) {
+ if (colorString)
+ {
s << GetOUString(colorString);
CFRelease(colorString);
- } else {
+ }
+ else
+ {
s << "NULL";
}
#endif
@@ -122,9 +147,13 @@ std::ostream &operator <<(std::ostream& s, const CGAffineTransform &aXform)
(void) aXform;
#else
if (CGAffineTransformIsIdentity(aXform))
+ {
s << "IDENT";
+ }
else
+ {
s << "[" << aXform.a << "," << aXform.b << "," << aXform.c << "," << aXform.d << "," << aXform.tx << "," << aXform.ty << "]";
+ }
#endif
return s;
}