Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1)

Side by Side Diff: src/ports/SkFontHost_mac.cpp

Issue 841843002: Work around changes in OSX 10.10. (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: Address comments, fix comments. Created 5 years, 11 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 1
2 /* 2 /*
3 * Copyright 2006 The Android Open Source Project 3 * Copyright 2006 The Android Open Source Project
4 * 4 *
5 * Use of this source code is governed by a BSD-style license that can be 5 * Use of this source code is governed by a BSD-style license that can be
6 * found in the LICENSE file. 6 * found in the LICENSE file.
7 */ 7 */
8 8
9 #ifdef SK_BUILD_FOR_MAC 9 #ifdef SK_BUILD_FOR_MAC
10 #import <ApplicationServices/ApplicationServices.h> 10 #import <ApplicationServices/ApplicationServices.h>
(...skipping 28 matching lines...) Expand all
39 #include "SkStream.h" 39 #include "SkStream.h"
40 #include "SkThread.h" 40 #include "SkThread.h"
41 #include "SkTypeface_mac.h" 41 #include "SkTypeface_mac.h"
42 #include "SkUtils.h" 42 #include "SkUtils.h"
43 #include "SkTypefaceCache.h" 43 #include "SkTypefaceCache.h"
44 #include "SkFontMgr.h" 44 #include "SkFontMgr.h"
45 #include "SkUtils.h" 45 #include "SkUtils.h"
46 46
47 #include <dlfcn.h> 47 #include <dlfcn.h>
48 48
49 // Set to make glyph bounding boxes visible.
50 #define SK_SHOW_TEXT_BLIT_COVERAGE 0
51
49 class SkScalerContext_Mac; 52 class SkScalerContext_Mac;
50 53
51 // CTFontManagerCopyAvailableFontFamilyNames() is not always available, so we 54 // CTFontManagerCopyAvailableFontFamilyNames() is not always available, so we
52 // provide a wrapper here that will return an empty array if need be. 55 // provide a wrapper here that will return an empty array if need be.
53 static CFArrayRef SkCTFontManagerCopyAvailableFontFamilyNames() { 56 static CFArrayRef SkCTFontManagerCopyAvailableFontFamilyNames() {
54 #ifdef SK_BUILD_FOR_IOS 57 #ifdef SK_BUILD_FOR_IOS
55 return CFArrayCreate(NULL, NULL, 0, NULL); 58 return CFArrayCreate(NULL, NULL, 0, NULL);
56 #else 59 #else
57 return CTFontManagerCopyAvailableFontFamilyNames(); 60 return CTFontManagerCopyAvailableFontFamilyNames();
58 #endif 61 #endif
(...skipping 615 matching lines...) Expand 10 before | Expand all | Expand 10 after
674 * 677 *
675 * Used on Snow Leopard to correct CTFontGetVerticalTranslationsForGlyphs. 678 * Used on Snow Leopard to correct CTFontGetVerticalTranslationsForGlyphs.
676 * Used on Lion to correct CTFontGetBoundingRectsForGlyphs. 679 * Used on Lion to correct CTFontGetBoundingRectsForGlyphs.
677 */ 680 */
678 SkMatrix fFUnitMatrix; 681 SkMatrix fFUnitMatrix;
679 682
680 Offscreen fOffscreen; 683 Offscreen fOffscreen;
681 AutoCFRelease<CTFontRef> fCTFont; 684 AutoCFRelease<CTFontRef> fCTFont;
682 CGAffineTransform fInvTransform; 685 CGAffineTransform fInvTransform;
683 686
684 /** Vertical variant of fCTFont. 687 /** Unrotated variant of fCTFont.
688 *
689 * In 10.10.1 CTFontGetAdvancesForGlyphs applies the font transform to the width of the
690 * advances, but always sets the height to 0. This font is used to get the advances of the
691 * unrotated glyph, and then the rotation is applied separately.
685 * 692 *
686 * CT vertical metrics are pre-rotated (in em space, before transform) 90de g clock-wise. 693 * CT vertical metrics are pre-rotated (in em space, before transform) 90de g clock-wise.
687 * This makes kCTFontDefaultOrientation dangerous, because the metrics from 694 * This makes kCTFontDefaultOrientation dangerous, because the metrics from
688 * kCTFontHorizontalOrientation are in a different space from kCTFontVertic alOrientation. 695 * kCTFontHorizontalOrientation are in a different space from kCTFontVertic alOrientation.
689 * Use fCTVerticalFont with kCTFontVerticalOrientation to get metrics in th e same space. 696 * With kCTFontVerticalOrientation the advances must be unrotated.
690 */ 697 */
691 AutoCFRelease<CTFontRef> fCTVerticalFont; 698 AutoCFRelease<CTFontRef> fCTUnrotatedFont;
692 699
693 AutoCFRelease<CGFontRef> fCGFont; 700 AutoCFRelease<CGFontRef> fCGFont;
694 SkAutoTMalloc<GlyphRect> fFBoundingBoxes; 701 SkAutoTMalloc<GlyphRect> fFBoundingBoxes;
695 uint16_t fFBoundingBoxesGlyphOffset; 702 uint16_t fFBoundingBoxesGlyphOffset;
696 uint16_t fGlyphCount; 703 uint16_t fGlyphCount;
697 bool fGeneratedFBoundingBoxes; 704 bool fGeneratedFBoundingBoxes;
698 const bool fDoSubPosition; 705 const bool fDoSubPosition;
699 const bool fVertical; 706 const bool fVertical;
700 707
701 friend class Offscreen; 708 friend class Offscreen;
(...skipping 20 matching lines...) Expand all
722 // As a result, it is necessary to know the actual device size and request t hat. 729 // As a result, it is necessary to know the actual device size and request t hat.
723 SkVector scale; 730 SkVector scale;
724 SkMatrix skTransform; 731 SkMatrix skTransform;
725 fRec.computeMatrices(SkScalerContextRec::kVertical_PreMatrixScale, &scale, & skTransform, 732 fRec.computeMatrices(SkScalerContextRec::kVertical_PreMatrixScale, &scale, & skTransform,
726 NULL, NULL, &fFUnitMatrix); 733 NULL, NULL, &fFUnitMatrix);
727 CGAffineTransform transform = MatrixToCGAffineTransform(skTransform); 734 CGAffineTransform transform = MatrixToCGAffineTransform(skTransform);
728 fInvTransform = CGAffineTransformInvert(transform); 735 fInvTransform = CGAffineTransformInvert(transform);
729 736
730 AutoCFRelease<CTFontDescriptorRef> ctFontDesc; 737 AutoCFRelease<CTFontDescriptorRef> ctFontDesc;
731 if (fVertical) { 738 if (fVertical) {
739 // Setting the vertical orientation here affects the character to glyph mapping.
732 AutoCFRelease<CFMutableDictionaryRef> cfAttributes(CFDictionaryCreateMut able( 740 AutoCFRelease<CFMutableDictionaryRef> cfAttributes(CFDictionaryCreateMut able(
733 kCFAllocatorDefault, 0, 741 kCFAllocatorDefault, 0,
734 &kCFTypeDictionaryKeyCallBacks, 742 &kCFTypeDictionaryKeyCallBacks,
735 &kCFTypeDictionaryValueCallBacks)); 743 &kCFTypeDictionaryValueCallBacks));
736 if (cfAttributes) { 744 if (cfAttributes) {
737 CTFontOrientation ctOrientation = kCTFontVerticalOrientation; 745 CTFontOrientation ctOrientation = kCTFontVerticalOrientation;
738 AutoCFRelease<CFNumberRef> cfVertical(CFNumberCreate( 746 AutoCFRelease<CFNumberRef> cfVertical(CFNumberCreate(
739 kCFAllocatorDefault, kCFNumberSInt32Type, &ctOrientation)); 747 kCFAllocatorDefault, kCFNumberSInt32Type, &ctOrientation));
740 CFDictionaryAddValue(cfAttributes, kCTFontOrientationAttribute, cfVe rtical); 748 CFDictionaryAddValue(cfAttributes, kCTFontOrientationAttribute, cfVe rtical);
741 ctFontDesc.reset(CTFontDescriptorCreateWithAttributes(cfAttributes)) ; 749 ctFontDesc.reset(CTFontDescriptorCreateWithAttributes(cfAttributes)) ;
742 } 750 }
743 } 751 }
744 752
745 // The transform contains everything except the requested text size. 753 // The transform contains everything except the requested text size.
746 // Some properties, like 'trak', are based on the text size (before applying the matrix). 754 // Some properties, like 'trak', are based on the text size (before applying the matrix).
747 CGFloat textSize = ScalarToCG(scale.y()); 755 CGFloat textSize = ScalarToCG(scale.y());
748 756
749 fCTFont.reset(CTFontCreateCopyWithAttributes(ctFont, textSize, &transform, c tFontDesc)); 757 fCTFont.reset(CTFontCreateCopyWithAttributes(ctFont, textSize, &transform, c tFontDesc));
750 fCGFont.reset(CTFontCopyGraphicsFont(fCTFont, NULL)); 758 fCGFont.reset(CTFontCopyGraphicsFont(fCTFont, NULL));
751 if (fVertical) { 759 fCTUnrotatedFont.reset(CTFontCreateCopyWithAttributes(ctFont, textSize,
752 CGAffineTransform rotateLeft = CGAffineTransformMake(0, -1, 1, 0, 0, 0); 760 &CGAffineTransformIden tity, NULL));
753 transform = CGAffineTransformConcat(rotateLeft, transform);
754 fCTVerticalFont.reset(CTFontCreateCopyWithAttributes(ctFont, textSize, & transform, NULL));
755 }
756 761
757 // The fUnitMatrix includes the text size (and em) as it is used to scale th e raw font data. 762 // The fUnitMatrix includes the text size (and em) as it is used to scale th e raw font data.
758 SkScalar emPerFUnit = SkScalarInvert(SkIntToScalar(CGFontGetUnitsPerEm(fCGFo nt))); 763 SkScalar emPerFUnit = SkScalarInvert(SkIntToScalar(CGFontGetUnitsPerEm(fCGFo nt)));
759 fFUnitMatrix.preScale(emPerFUnit, -emPerFUnit); 764 fFUnitMatrix.preScale(emPerFUnit, -emPerFUnit);
760 } 765 }
761 766
762 extern "C" { 767 extern "C" {
763 768
764 /** CTFontDrawGlyphs was introduced in 10.7. */ 769 /** CTFontDrawGlyphs was introduced in 10.7. */
765 typedef void (*CTFontDrawGlyphsProc)(CTFontRef, const CGGlyph[], const CGPoint[] , 770 typedef void (*CTFontDrawGlyphsProc)(CTFontRef, const CGGlyph[], const CGPoint[] ,
(...skipping 123 matching lines...) Expand 10 before | Expand all | Expand 10 after
889 } 894 }
890 895
891 // CoreText and CoreGraphics always draw using the horizontal baseline origi n. 896 // CoreText and CoreGraphics always draw using the horizontal baseline origi n.
892 if (context.fVertical) { 897 if (context.fVertical) {
893 SkPoint offset; 898 SkPoint offset;
894 context.getVerticalOffset(glyphID, &offset); 899 context.getVerticalOffset(glyphID, &offset);
895 subX += offset.fX; 900 subX += offset.fX;
896 subY += offset.fY; 901 subY += offset.fY;
897 } 902 }
898 903
899 // CTFontDrawGlyphs and CGContextShowGlyphsAtPositions take 'positions' whic h are in text space.
900 // The glyph location (in device space) must be mapped into text space, so t hat CG can convert
901 // it back into device space.
902 CGPoint point = CGPointMake(-glyph.fLeft + subX, glyph.fTop + glyph.fHeight - subY); 904 CGPoint point = CGPointMake(-glyph.fLeft + subX, glyph.fTop + glyph.fHeight - subY);
903 point = CGPointApplyAffineTransform(point, context.fInvTransform); 905 if (darwinVersion() < 14) {
906 // Prior to 10.10, CTFontDrawGlyphs acted like CGContextShowGlyphsAtPosi tions and took
907 // 'positions' which are in text space. The glyph location (in device sp ace) must be
908 // mapped into text space, so that CG can convert it back into device sp ace.
909 // In 10.10 and later, this is handled directly in CTFontDrawGlyphs.
910 point = CGPointApplyAffineTransform(point, context.fInvTransform);
911 }
904 ctFontDrawGlyphs(context.fCTFont, &glyphID, &point, 1, fCG); 912 ctFontDrawGlyphs(context.fCTFont, &glyphID, &point, 1, fCG);
905 913
906 SkASSERT(rowBytesPtr); 914 SkASSERT(rowBytesPtr);
907 *rowBytesPtr = rowBytes; 915 *rowBytesPtr = rowBytes;
908 return image; 916 return image;
909 } 917 }
910 918
911 void SkScalerContext_Mac::getVerticalOffset(CGGlyph glyphID, SkPoint* offset) co nst { 919 void SkScalerContext_Mac::getVerticalOffset(CGGlyph glyphID, SkPoint* offset) co nst {
912 // Snow Leopard returns cgVertOffset in completely un-transformed FUnits (em space, y up). 920 // Snow Leopard returns cgVertOffset in completely un-transformed FUnits (em space, y up).
913 // Lion and Leopard return cgVertOffset in CG units (pixels, y up). 921 // Lion and Leopard return cgVertOffset in CG units (pixels, y up).
(...skipping 86 matching lines...) Expand 10 before | Expand all | Expand 10 after
1000 this->generateMetrics(glyph); 1008 this->generateMetrics(glyph);
1001 } 1009 }
1002 1010
1003 void SkScalerContext_Mac::generateMetrics(SkGlyph* glyph) { 1011 void SkScalerContext_Mac::generateMetrics(SkGlyph* glyph) {
1004 const CGGlyph cgGlyph = (CGGlyph) glyph->getGlyphID(); 1012 const CGGlyph cgGlyph = (CGGlyph) glyph->getGlyphID();
1005 glyph->zeroMetrics(); 1013 glyph->zeroMetrics();
1006 1014
1007 // The following block produces cgAdvance in CG units (pixels, y up). 1015 // The following block produces cgAdvance in CG units (pixels, y up).
1008 CGSize cgAdvance; 1016 CGSize cgAdvance;
1009 if (fVertical) { 1017 if (fVertical) {
1010 CTFontGetAdvancesForGlyphs(fCTVerticalFont, kCTFontVerticalOrientation, 1018 CTFontGetAdvancesForGlyphs(fCTUnrotatedFont, kCTFontVerticalOrientation,
1011 &cgGlyph, &cgAdvance, 1); 1019 &cgGlyph, &cgAdvance, 1);
1020 // Vertical advances are returned as widths instead of heights.
1021 SkTSwap(cgAdvance.height, cgAdvance.width);
1022 cgAdvance.height = -cgAdvance.height;
1012 } else { 1023 } else {
1013 CTFontGetAdvancesForGlyphs(fCTFont, kCTFontHorizontalOrientation, 1024 CTFontGetAdvancesForGlyphs(fCTUnrotatedFont, kCTFontHorizontalOrientatio n,
1014 &cgGlyph, &cgAdvance, 1); 1025 &cgGlyph, &cgAdvance, 1);
1015 } 1026 }
1027 cgAdvance = CGSizeApplyAffineTransform(cgAdvance, CTFontGetMatrix(fCTFont));
1016 glyph->fAdvanceX = SkFloatToFixed_Check(cgAdvance.width); 1028 glyph->fAdvanceX = SkFloatToFixed_Check(cgAdvance.width);
1017 glyph->fAdvanceY = -SkFloatToFixed_Check(cgAdvance.height); 1029 glyph->fAdvanceY = -SkFloatToFixed_Check(cgAdvance.height);
1018 1030
1019 // The following produces skBounds in SkGlyph units (pixels, y down), 1031 // The following produces skBounds in SkGlyph units (pixels, y down),
1020 // or returns early if skBounds would be empty. 1032 // or returns early if skBounds would be empty.
1021 SkRect skBounds; 1033 SkRect skBounds;
1022 1034
1023 // On Mountain Lion, CTFontGetBoundingRectsForGlyphs with kCTFontVerticalOri entation and 1035 // On Mountain Lion, CTFontGetBoundingRectsForGlyphs with kCTFontVerticalOri entation and
1024 // CTFontGetVerticalTranslationsForGlyphs do not agree when using OTF CFF fo nts. 1036 // CTFontGetVerticalTranslationsForGlyphs do not agree when using OTF CFF fo nts.
1025 // For TTF fonts these two do agree and we can use CTFontGetBoundingRectsFor Glyphs to get 1037 // For TTF fonts these two do agree and we can use CTFontGetBoundingRectsFor Glyphs to get
(...skipping 120 matching lines...) Expand 10 before | Expand all | Expand 10 after
1146 } 1158 }
1147 *dst++ = mask; 1159 *dst++ = mask;
1148 } 1160 }
1149 } 1161 }
1150 1162
1151 template<bool APPLY_PREBLEND> 1163 template<bool APPLY_PREBLEND>
1152 static inline uint8_t rgb_to_a8(CGRGBPixel rgb, const uint8_t* table8) { 1164 static inline uint8_t rgb_to_a8(CGRGBPixel rgb, const uint8_t* table8) {
1153 U8CPU r = (rgb >> 16) & 0xFF; 1165 U8CPU r = (rgb >> 16) & 0xFF;
1154 U8CPU g = (rgb >> 8) & 0xFF; 1166 U8CPU g = (rgb >> 8) & 0xFF;
1155 U8CPU b = (rgb >> 0) & 0xFF; 1167 U8CPU b = (rgb >> 0) & 0xFF;
1156 return sk_apply_lut_if<APPLY_PREBLEND>(SkComputeLuminance(r, g, b), table8); 1168 U8CPU lum = sk_apply_lut_if<APPLY_PREBLEND>(SkComputeLuminance(r, g, b), tab le8);
1169 #if SK_SHOW_TEXT_BLIT_COVERAGE
1170 lum = SkTMax(lum, (U8CPU)0x30);
1171 #endif
1172 return lum;
1157 } 1173 }
1158 template<bool APPLY_PREBLEND> 1174 template<bool APPLY_PREBLEND>
1159 static void rgb_to_a8(const CGRGBPixel* SK_RESTRICT cgPixels, size_t cgRowBytes, 1175 static void rgb_to_a8(const CGRGBPixel* SK_RESTRICT cgPixels, size_t cgRowBytes,
1160 const SkGlyph& glyph, const uint8_t* table8) { 1176 const SkGlyph& glyph, const uint8_t* table8) {
1161 const int width = glyph.fWidth; 1177 const int width = glyph.fWidth;
1162 size_t dstRB = glyph.rowBytes(); 1178 size_t dstRB = glyph.rowBytes();
1163 uint8_t* SK_RESTRICT dst = (uint8_t*)glyph.fImage; 1179 uint8_t* SK_RESTRICT dst = (uint8_t*)glyph.fImage;
1164 1180
1165 for (int y = 0; y < glyph.fHeight; y++) { 1181 for (int y = 0; y < glyph.fHeight; y++) {
1166 for (int i = 0; i < width; ++i) { 1182 for (int i = 0; i < width; ++i) {
1167 dst[i] = rgb_to_a8<APPLY_PREBLEND>(cgPixels[i], table8); 1183 dst[i] = rgb_to_a8<APPLY_PREBLEND>(cgPixels[i], table8);
1168 } 1184 }
1169 cgPixels = (CGRGBPixel*)((char*)cgPixels + cgRowBytes); 1185 cgPixels = (CGRGBPixel*)((char*)cgPixels + cgRowBytes);
1170 dst += dstRB; 1186 dst += dstRB;
1171 } 1187 }
1172 } 1188 }
1173 1189
1174 template<bool APPLY_PREBLEND> 1190 template<bool APPLY_PREBLEND>
1175 static inline uint16_t rgb_to_lcd16(CGRGBPixel rgb, const uint8_t* tableR, 1191 static inline uint16_t rgb_to_lcd16(CGRGBPixel rgb, const uint8_t* tableR,
1176 const uint8_t* tableG, 1192 const uint8_t* tableG,
1177 const uint8_t* tableB) { 1193 const uint8_t* tableB) {
1178 U8CPU r = sk_apply_lut_if<APPLY_PREBLEND>((rgb >> 16) & 0xFF, tableR); 1194 U8CPU r = sk_apply_lut_if<APPLY_PREBLEND>((rgb >> 16) & 0xFF, tableR);
1179 U8CPU g = sk_apply_lut_if<APPLY_PREBLEND>((rgb >> 8) & 0xFF, tableG); 1195 U8CPU g = sk_apply_lut_if<APPLY_PREBLEND>((rgb >> 8) & 0xFF, tableG);
1180 U8CPU b = sk_apply_lut_if<APPLY_PREBLEND>((rgb >> 0) & 0xFF, tableB); 1196 U8CPU b = sk_apply_lut_if<APPLY_PREBLEND>((rgb >> 0) & 0xFF, tableB);
1197 #if SK_SHOW_TEXT_BLIT_COVERAGE
1198 r = SkTMax(r, (U8CPU)0x30);
1199 g = SkTMax(g, (U8CPU)0x30);
1200 b = SkTMax(b, (U8CPU)0x30);
1201 #endif
1181 return SkPack888ToRGB16(r, g, b); 1202 return SkPack888ToRGB16(r, g, b);
1182 } 1203 }
1183 template<bool APPLY_PREBLEND> 1204 template<bool APPLY_PREBLEND>
1184 static void rgb_to_lcd16(const CGRGBPixel* SK_RESTRICT cgPixels, size_t cgRowByt es, const SkGlyph& glyph, 1205 static void rgb_to_lcd16(const CGRGBPixel* SK_RESTRICT cgPixels, size_t cgRowByt es, const SkGlyph& glyph,
1185 const uint8_t* tableR, const uint8_t* tableG, const uin t8_t* tableB) { 1206 const uint8_t* tableR, const uint8_t* tableG, const uin t8_t* tableB) {
1186 const int width = glyph.fWidth; 1207 const int width = glyph.fWidth;
1187 size_t dstRB = glyph.rowBytes(); 1208 size_t dstRB = glyph.rowBytes();
1188 uint16_t* SK_RESTRICT dst = (uint16_t*)glyph.fImage; 1209 uint16_t* SK_RESTRICT dst = (uint16_t*)glyph.fImage;
1189 1210
1190 for (int y = 0; y < glyph.fHeight; y++) { 1211 for (int y = 0; y < glyph.fHeight; y++) {
1191 for (int i = 0; i < width; i++) { 1212 for (int i = 0; i < width; i++) {
1192 dst[i] = rgb_to_lcd16<APPLY_PREBLEND>(cgPixels[i], tableR, tableG, t ableB); 1213 dst[i] = rgb_to_lcd16<APPLY_PREBLEND>(cgPixels[i], tableR, tableG, t ableB);
1193 } 1214 }
1194 cgPixels = (CGRGBPixel*)((char*)cgPixels + cgRowBytes); 1215 cgPixels = (CGRGBPixel*)((char*)cgPixels + cgRowBytes);
1195 dst = (uint16_t*)((char*)dst + dstRB); 1216 dst = (uint16_t*)((char*)dst + dstRB);
1196 } 1217 }
1197 } 1218 }
1198 1219
1199 static SkPMColor cgpixels_to_pmcolor(CGRGBPixel rgb) { 1220 static SkPMColor cgpixels_to_pmcolor(CGRGBPixel rgb) {
1200 U8CPU a = (rgb >> 24) & 0xFF; 1221 U8CPU a = (rgb >> 24) & 0xFF;
1201 U8CPU r = (rgb >> 16) & 0xFF; 1222 U8CPU r = (rgb >> 16) & 0xFF;
1202 U8CPU g = (rgb >> 8) & 0xFF; 1223 U8CPU g = (rgb >> 8) & 0xFF;
1203 U8CPU b = (rgb >> 0) & 0xFF; 1224 U8CPU b = (rgb >> 0) & 0xFF;
1204 1225 #if SK_SHOW_TEXT_BLIT_COVERAGE
1226 a = SkTMax(a, (U8CPU)0x30);
1227 #endif
1205 return SkPackARGB32(a, r, g, b); 1228 return SkPackARGB32(a, r, g, b);
1206 } 1229 }
1207 1230
1208 template <typename T> T* SkTAddByteOffset(T* ptr, size_t byteOffset) { 1231 template <typename T> T* SkTAddByteOffset(T* ptr, size_t byteOffset) {
1209 return (T*)((char*)ptr + byteOffset); 1232 return (T*)((char*)ptr + byteOffset);
1210 } 1233 }
1211 1234
1212 void SkScalerContext_Mac::generateImage(const SkGlyph& glyph) { 1235 void SkScalerContext_Mac::generateImage(const SkGlyph& glyph) {
1213 CGGlyph cgGlyph = (CGGlyph) glyph.getGlyphID(); 1236 CGGlyph cgGlyph = (CGGlyph) glyph.getGlyphID();
1214 1237
(...skipping 1049 matching lines...) Expand 10 before | Expand all | Expand 10 after
2264 } 2287 }
2265 return face; 2288 return face;
2266 } 2289 }
2267 }; 2290 };
2268 2291
2269 /////////////////////////////////////////////////////////////////////////////// 2292 ///////////////////////////////////////////////////////////////////////////////
2270 2293
2271 SkFontMgr* SkFontMgr::Factory() { 2294 SkFontMgr* SkFontMgr::Factory() {
2272 return SkNEW(SkFontMgr_Mac); 2295 return SkNEW(SkFontMgr_Mac);
2273 } 2296 }
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698