Changed mac specific files to use ApplicationServices rather than Carbon
authoryangsu@google.com <yangsu@google.com@2bbb7eff-a529-9590-31e7-b0007b416f81>
Tue, 21 Jun 2011 13:09:32 +0000 (13:09 +0000)
committeryangsu@google.com <yangsu@google.com@2bbb7eff-a529-9590-31e7-b0007b416f81>
Tue, 21 Jun 2011 13:09:32 +0000 (13:09 +0000)
http://codereview.appspot.com/4644053/

git-svn-id: http://skia.googlecode.com/svn/trunk@1658 2bbb7eff-a529-9590-31e7-b0007b416f81

gyp/core.gyp
include/ports/SkTypeface_mac.h
include/utils/mac/SkCGUtils.h
src/core/SkAdvancedTypefaceMetrics.cpp
src/ports/SkFontHost_mac_coretext.cpp
src/ports/SkImageDecoder_CG.cpp

index ba63485385b62e98c8499b2b5b438614746c2d07..e9b019ff5d84e86f22a4d0034c322f473e8598d3 100644 (file)
           'link_settings': {
             'libraries': [
               '$(SDKROOT)/System/Library/Frameworks/Carbon.framework',
+              '$(SDKROOT)/System/Library/Frameworks/ApplicationServices.framework',
             ],
           },
         }],
index 61b226bbc2db4f556ff5774aefe311bfe17b2612..8f8af507475708944e59964c40918277362c8745 100644 (file)
 #define SkTypeface_mac_DEFINED
 
 #include "SkTypeface.h"
-#include <Carbon/Carbon.h>
+#ifdef SK_BUILD_FOR_MAC
+#import <ApplicationServices/ApplicationServices.h>
+#endif
 
+#ifdef SK_BUILD_FOR_IOS
+#include <CoreText/CoreText.h>
+#endif
 /**
  *  Like the other Typeface create methods, this returns a new reference to the
  *  corresponding typeface for the specified CTFontRef. The caller must call
index db67edf6e52d3e85bf73b86c387b8aca3d3c6beb..06bb85c6876db1755b1f372ff3319c9b83750f56 100644 (file)
@@ -4,9 +4,7 @@
 #include "SkTypes.h"
 
 #ifdef SK_BUILD_FOR_MAC
-    #include <Carbon/Carbon.h>
-#else
-    #include <CoreGraphics/CoreGraphics.h>
+#include <ApplicationServices/ApplicationServices.h>
 #endif
 
 class SkBitmap;
index 05d5c28e6adebb96eca1b8f13bd28ddef85acb7a..d9022246bd15713ed11117f0e7440e61299e0548 100644 (file)
 #endif
 
 #ifdef SK_BUILD_FOR_MAC
-#include <Carbon/Carbon.h>
+#import <ApplicationServices/ApplicationServices.h>
+#endif
+
+#ifdef SK_BUILD_FOR_IOS
+#include <CoreText/CoreText.h>
+#include <CoreGraphics/CoreGraphics.h>
 #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,
index f9eba95c7b3903a415ce15ded9141e558687ab05..30a2d6738137f5068748cbf59b915da09272f4ed 100644 (file)
  ** limitations under the License.
 */
 #include <vector>
-#include <Carbon/Carbon.h>
+#ifdef SK_BUILD_FOR_MAC
+#import <ApplicationServices/ApplicationServices.h>
+#endif
+
+#ifdef SK_BUILD_FOR_IOS
+#include <CoreText/CoreText.h>
+#include <CoreGraphics/CoreGraphics.h>
+#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;
index f7cc1ee368bd1bb56de6b6f9fb520fc82fa3e6cd..eb7ee16f39c1b1c45e341828e4d2a521087b4122 100644 (file)
@@ -13,7 +13,7 @@
 ** limitations under the License.
 */
 
-#include <Carbon/Carbon.h>
+#include <ApplicationServices/ApplicationServices.h>
 #include "SkImageDecoder.h"
 #include "SkImageEncoder.h"
 #include "SkMovie.h"