From ccb74eabccf19f66b6bf31f4acae89b62baa16c3 Mon Sep 17 00:00:00 2001 From: "yangsu@google.com" Date: Tue, 21 Jun 2011 13:09:32 +0000 Subject: [PATCH] Changed mac specific files to use ApplicationServices rather than Carbon http://codereview.appspot.com/4644053/ git-svn-id: http://skia.googlecode.com/svn/trunk@1658 2bbb7eff-a529-9590-31e7-b0007b416f81 --- gyp/core.gyp | 1 + include/ports/SkTypeface_mac.h | 7 ++++++- include/utils/mac/SkCGUtils.h | 4 +--- src/core/SkAdvancedTypefaceMetrics.cpp | 9 +++++++-- src/ports/SkFontHost_mac_coretext.cpp | 17 ++++++++++++----- src/ports/SkImageDecoder_CG.cpp | 2 +- 6 files changed, 28 insertions(+), 12 deletions(-) diff --git a/gyp/core.gyp b/gyp/core.gyp index ba63485..e9b019f 100644 --- a/gyp/core.gyp +++ b/gyp/core.gyp @@ -293,6 +293,7 @@ 'link_settings': { 'libraries': [ '$(SDKROOT)/System/Library/Frameworks/Carbon.framework', + '$(SDKROOT)/System/Library/Frameworks/ApplicationServices.framework', ], }, }], diff --git a/include/ports/SkTypeface_mac.h b/include/ports/SkTypeface_mac.h index 61b226b..8f8af50 100644 --- a/include/ports/SkTypeface_mac.h +++ b/include/ports/SkTypeface_mac.h @@ -19,8 +19,13 @@ #define SkTypeface_mac_DEFINED #include "SkTypeface.h" -#include +#ifdef SK_BUILD_FOR_MAC +#import +#endif +#ifdef SK_BUILD_FOR_IOS +#include +#endif /** * Like the other Typeface create methods, this returns a new reference to the * corresponding typeface for the specified CTFontRef. The caller must call diff --git a/include/utils/mac/SkCGUtils.h b/include/utils/mac/SkCGUtils.h index db67edf..06bb85c 100644 --- a/include/utils/mac/SkCGUtils.h +++ b/include/utils/mac/SkCGUtils.h @@ -4,9 +4,7 @@ #include "SkTypes.h" #ifdef SK_BUILD_FOR_MAC - #include -#else - #include +#include #endif class SkBitmap; diff --git a/src/core/SkAdvancedTypefaceMetrics.cpp b/src/core/SkAdvancedTypefaceMetrics.cpp index 05d5c28..d902224 100644 --- a/src/core/SkAdvancedTypefaceMetrics.cpp +++ b/src/core/SkAdvancedTypefaceMetrics.cpp @@ -23,7 +23,12 @@ #endif #ifdef SK_BUILD_FOR_MAC -#include +#import +#endif + +#ifdef SK_BUILD_FOR_IOS +#include +#include #endif namespace skia_advanced_typeface_metrics_utils { @@ -146,7 +151,7 @@ template SkAdvancedTypefaceMetrics::WidthRange* getAdvanceData( FT_Face face, int num_glyphs, bool (*getAdvance)(FT_Face face, int gId, int16_t* data)); -#elif defined(SK_BUILD_FOR_MAC) +#elif defined(SK_BUILD_FOR_MAC) || defined(SK_BUILD_FOR_IOS) template SkAdvancedTypefaceMetrics::WidthRange* getAdvanceData( CTFontRef ctFont, int num_glyphs, diff --git a/src/ports/SkFontHost_mac_coretext.cpp b/src/ports/SkFontHost_mac_coretext.cpp index f9eba95..30a2d67 100644 --- a/src/ports/SkFontHost_mac_coretext.cpp +++ b/src/ports/SkFontHost_mac_coretext.cpp @@ -14,7 +14,14 @@ ** limitations under the License. */ #include -#include +#ifdef SK_BUILD_FOR_MAC +#import +#endif + +#ifdef SK_BUILD_FOR_IOS +#include +#include +#endif #include "SkFontHost.h" #include "SkDescriptor.h" @@ -788,9 +795,9 @@ struct TableEntry { uint32_t fLength; }; -static uint32 CalcTableCheckSum(uint32 *table, uint32 numberOfBytesInTable) { - uint32 sum = 0; - uint32 nLongs = (numberOfBytesInTable + 3) / 4; +static uint32_t CalcTableCheckSum(uint32_t *table, uint32_t numberOfBytesInTable) { + uint32_t sum = 0; + uint32_t nLongs = (numberOfBytesInTable + 3) / 4; while (nLongs-- > 0) { sum += SkEndian_SwapBE32(*table++); @@ -847,7 +854,7 @@ SkStream* SkFontHost::OpenStream(SkFontID uniqueID) { GetTableData(uniqueID, tableTags[index], 0, tableSize, dataPtr); entry->fTag = SkEndian_SwapBE32(tableTags[index]); entry->fCheckSum = SkEndian_SwapBE32(CalcTableCheckSum( - (uint32*)dataPtr, tableSize)); + (uint32_t*)dataPtr, tableSize)); entry->fOffset = SkEndian_SwapBE32(dataPtr - dataStart); entry->fLength = SkEndian_SwapBE32(tableSize); dataPtr += (tableSize + 3) & ~3; diff --git a/src/ports/SkImageDecoder_CG.cpp b/src/ports/SkImageDecoder_CG.cpp index f7cc1ee..eb7ee16 100644 --- a/src/ports/SkImageDecoder_CG.cpp +++ b/src/ports/SkImageDecoder_CG.cpp @@ -13,7 +13,7 @@ ** limitations under the License. */ -#include +#include #include "SkImageDecoder.h" #include "SkImageEncoder.h" #include "SkMovie.h" -- 2.7.4