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

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: 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 #define SK_SHOW_TEXT_BLIT_COVERAGE 0
mtklein 2015/01/08 14:45:54 Add a little note about what's going on here? Is
bungeman-skia 2015/01/08 16:21:58 Done. Hmmm... I keep adding this without explanati
50
49 class SkScalerContext_Mac; 51 class SkScalerContext_Mac;
50 52
51 // CTFontManagerCopyAvailableFontFamilyNames() is not always available, so we 53 // CTFontManagerCopyAvailableFontFamilyNames() is not always available, so we
52 // provide a wrapper here that will return an empty array if need be. 54 // provide a wrapper here that will return an empty array if need be.
53 static CFArrayRef SkCTFontManagerCopyAvailableFontFamilyNames() { 55 static CFArrayRef SkCTFontManagerCopyAvailableFontFamilyNames() {
54 #ifdef SK_BUILD_FOR_IOS 56 #ifdef SK_BUILD_FOR_IOS
55 return CFArrayCreate(NULL, NULL, 0, NULL); 57 return CFArrayCreate(NULL, NULL, 0, NULL);
56 #else 58 #else
57 return CTFontManagerCopyAvailableFontFamilyNames(); 59 return CTFontManagerCopyAvailableFontFamilyNames();
58 #endif 60 #endif
(...skipping 615 matching lines...) Expand 10 before | Expand all | Expand 10 after
674 * 676 *
675 * Used on Snow Leopard to correct CTFontGetVerticalTranslationsForGlyphs. 677 * Used on Snow Leopard to correct CTFontGetVerticalTranslationsForGlyphs.
676 * Used on Lion to correct CTFontGetBoundingRectsForGlyphs. 678 * Used on Lion to correct CTFontGetBoundingRectsForGlyphs.
677 */ 679 */
678 SkMatrix fFUnitMatrix; 680 SkMatrix fFUnitMatrix;
679 681
680 Offscreen fOffscreen; 682 Offscreen fOffscreen;
681 AutoCFRelease<CTFontRef> fCTFont; 683 AutoCFRelease<CTFontRef> fCTFont;
682 CGAffineTransform fInvTransform; 684 CGAffineTransform fInvTransform;
683 685
684 /** Vertical variant of fCTFont. 686 /** Unrotated variant of fCTFont.
687 *
688 * In 10.10.1 CTFontGetAdvancesForGlyphs applies the font transform to the width of the
689 * advances, but always sets the height to 0. This font is used to get the advances of the
690 * unrotated glyph, and then the rotation is applied separately.
685 * 691 *
686 * CT vertical metrics are pre-rotated (in em space, before transform) 90de g clock-wise. 692 * CT vertical metrics are pre-rotated (in em space, before transform) 90de g clock-wise.
687 * This makes kCTFontDefaultOrientation dangerous, because the metrics from 693 * This makes kCTFontDefaultOrientation dangerous, because the metrics from
688 * kCTFontHorizontalOrientation are in a different space from kCTFontVertic alOrientation. 694 * kCTFontHorizontalOrientation are in a different space from kCTFontVertic alOrientation.
689 * Use fCTVerticalFont with kCTFontVerticalOrientation to get metrics in th e same space. 695 * With kCTFontVerticalOrientation the advances must be unrotated.
690 */ 696 */
691 AutoCFRelease<CTFontRef> fCTVerticalFont; 697 AutoCFRelease<CTFontRef> fCTUnrotatedFont;
692 698
693 AutoCFRelease<CGFontRef> fCGFont; 699 AutoCFRelease<CGFontRef> fCGFont;
694 SkAutoTMalloc<GlyphRect> fFBoundingBoxes; 700 SkAutoTMalloc<GlyphRect> fFBoundingBoxes;
695 uint16_t fFBoundingBoxesGlyphOffset; 701 uint16_t fFBoundingBoxesGlyphOffset;
696 uint16_t fGlyphCount; 702 uint16_t fGlyphCount;
697 bool fGeneratedFBoundingBoxes; 703 bool fGeneratedFBoundingBoxes;
698 const bool fDoSubPosition; 704 const bool fDoSubPosition;
699 const bool fVertical; 705 const bool fVertical;
700 706
701 friend class Offscreen; 707 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. 728 // As a result, it is necessary to know the actual device size and request t hat.
723 SkVector scale; 729 SkVector scale;
724 SkMatrix skTransform; 730 SkMatrix skTransform;
725 fRec.computeMatrices(SkScalerContextRec::kVertical_PreMatrixScale, &scale, & skTransform, 731 fRec.computeMatrices(SkScalerContextRec::kVertical_PreMatrixScale, &scale, & skTransform,
726 NULL, NULL, &fFUnitMatrix); 732 NULL, NULL, &fFUnitMatrix);
727 CGAffineTransform transform = MatrixToCGAffineTransform(skTransform); 733 CGAffineTransform transform = MatrixToCGAffineTransform(skTransform);
728 fInvTransform = CGAffineTransformInvert(transform); 734 fInvTransform = CGAffineTransformInvert(transform);
729 735
730 AutoCFRelease<CTFontDescriptorRef> ctFontDesc; 736 AutoCFRelease<CTFontDescriptorRef> ctFontDesc;
731 if (fVertical) { 737 if (fVertical) {
738 // Setting the vertical orientation here affects the character to glyph mapping.
732 AutoCFRelease<CFMutableDictionaryRef> cfAttributes(CFDictionaryCreateMut able( 739 AutoCFRelease<CFMutableDictionaryRef> cfAttributes(CFDictionaryCreateMut able(
733 kCFAllocatorDefault, 0, 740 kCFAllocatorDefault, 0,
734 &kCFTypeDictionaryKeyCallBacks, 741 &kCFTypeDictionaryKeyCallBacks,
735 &kCFTypeDictionaryValueCallBacks)); 742 &kCFTypeDictionaryValueCallBacks));
736 if (cfAttributes) { 743 if (cfAttributes) {
737 CTFontOrientation ctOrientation = kCTFontVerticalOrientation; 744 CTFontOrientation ctOrientation = kCTFontVerticalOrientation;
738 AutoCFRelease<CFNumberRef> cfVertical(CFNumberCreate( 745 AutoCFRelease<CFNumberRef> cfVertical(CFNumberCreate(
739 kCFAllocatorDefault, kCFNumberSInt32Type, &ctOrientation)); 746 kCFAllocatorDefault, kCFNumberSInt32Type, &ctOrientation));
740 CFDictionaryAddValue(cfAttributes, kCTFontOrientationAttribute, cfVe rtical); 747 CFDictionaryAddValue(cfAttributes, kCTFontOrientationAttribute, cfVe rtical);
741 ctFontDesc.reset(CTFontDescriptorCreateWithAttributes(cfAttributes)) ; 748 ctFontDesc.reset(CTFontDescriptorCreateWithAttributes(cfAttributes)) ;
742 } 749 }
743 } 750 }
744 751
745 // The transform contains everything except the requested text size. 752 // The transform contains everything except the requested text size.
746 // Some properties, like 'trak', are based on the text size (before applying the matrix). 753 // Some properties, like 'trak', are based on the text size (before applying the matrix).
747 CGFloat textSize = ScalarToCG(scale.y()); 754 CGFloat textSize = ScalarToCG(scale.y());
748 755
749 fCTFont.reset(CTFontCreateCopyWithAttributes(ctFont, textSize, &transform, c tFontDesc)); 756 fCTFont.reset(CTFontCreateCopyWithAttributes(ctFont, textSize, &transform, c tFontDesc));
750 fCGFont.reset(CTFontCopyGraphicsFont(fCTFont, NULL)); 757 fCGFont.reset(CTFontCopyGraphicsFont(fCTFont, NULL));
751 if (fVertical) { 758 fCTUnrotatedFont.reset(CTFontCreateCopyWithAttributes(ctFont, textSize,
752 CGAffineTransform rotateLeft = CGAffineTransformMake(0, -1, 1, 0, 0, 0); 759 &CGAffineTransformIden tity, NULL));
753 transform = CGAffineTransformConcat(rotateLeft, transform);
754 fCTVerticalFont.reset(CTFontCreateCopyWithAttributes(ctFont, textSize, & transform, NULL));
755 }
756 760
757 // The fUnitMatrix includes the text size (and em) as it is used to scale th e raw font data. 761 // 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))); 762 SkScalar emPerFUnit = SkScalarInvert(SkIntToScalar(CGFontGetUnitsPerEm(fCGFo nt)));
759 fFUnitMatrix.preScale(emPerFUnit, -emPerFUnit); 763 fFUnitMatrix.preScale(emPerFUnit, -emPerFUnit);
760 } 764 }
761 765
762 extern "C" { 766 extern "C" {
763 767
764 /** CTFontDrawGlyphs was introduced in 10.7. */ 768 /** CTFontDrawGlyphs was introduced in 10.7. */
765 typedef void (*CTFontDrawGlyphsProc)(CTFontRef, const CGGlyph[], const CGPoint[] , 769 typedef void (*CTFontDrawGlyphsProc)(CTFontRef, const CGGlyph[], const CGPoint[] ,
(...skipping 123 matching lines...) Expand 10 before | Expand all | Expand 10 after
889 } 893 }
890 894
891 // CoreText and CoreGraphics always draw using the horizontal baseline origi n. 895 // CoreText and CoreGraphics always draw using the horizontal baseline origi n.
892 if (context.fVertical) { 896 if (context.fVertical) {
893 SkPoint offset; 897 SkPoint offset;
894 context.getVerticalOffset(glyphID, &offset); 898 context.getVerticalOffset(glyphID, &offset);
895 subX += offset.fX; 899 subX += offset.fX;
896 subY += offset.fY; 900 subY += offset.fY;
897 } 901 }
898 902
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); 903 CGPoint point = CGPointMake(-glyph.fLeft + subX, glyph.fTop + glyph.fHeight - subY);
903 point = CGPointApplyAffineTransform(point, context.fInvTransform); 904 if (darwinVersion() < 14) {
905 // Prior to 10.10, CTFontDrawGlyphs and (the no longer used) CGContextSh owGlyphsAtPositions
mtklein 2015/01/08 14:45:54 might drop off the bit about no-longer-used code?
bungeman-skia 2015/01/08 16:21:58 Done. Thanks for reminding me about this comment.
906 // take 'positions' which are in text space. The glyph location (in devi ce space) must be
907 // mapped into text space, so that CG can convert it back into device sp ace.
908 // In 10.10 and later, this is handled directly in CTFontDrawGlyphs.
909 point = CGPointApplyAffineTransform(point, context.fInvTransform);
910 }
904 ctFontDrawGlyphs(context.fCTFont, &glyphID, &point, 1, fCG); 911 ctFontDrawGlyphs(context.fCTFont, &glyphID, &point, 1, fCG);
905 912
906 SkASSERT(rowBytesPtr); 913 SkASSERT(rowBytesPtr);
907 *rowBytesPtr = rowBytes; 914 *rowBytesPtr = rowBytes;
908 return image; 915 return image;
909 } 916 }
910 917
911 void SkScalerContext_Mac::getVerticalOffset(CGGlyph glyphID, SkPoint* offset) co nst { 918 void SkScalerContext_Mac::getVerticalOffset(CGGlyph glyphID, SkPoint* offset) co nst {
912 // Snow Leopard returns cgVertOffset in completely un-transformed FUnits (em space, y up). 919 // 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). 920 // 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); 1007 this->generateMetrics(glyph);
1001 } 1008 }
1002 1009
1003 void SkScalerContext_Mac::generateMetrics(SkGlyph* glyph) { 1010 void SkScalerContext_Mac::generateMetrics(SkGlyph* glyph) {
1004 const CGGlyph cgGlyph = (CGGlyph) glyph->getGlyphID(); 1011 const CGGlyph cgGlyph = (CGGlyph) glyph->getGlyphID();
1005 glyph->zeroMetrics(); 1012 glyph->zeroMetrics();
1006 1013
1007 // The following block produces cgAdvance in CG units (pixels, y up). 1014 // The following block produces cgAdvance in CG units (pixels, y up).
1008 CGSize cgAdvance; 1015 CGSize cgAdvance;
1009 if (fVertical) { 1016 if (fVertical) {
1010 CTFontGetAdvancesForGlyphs(fCTVerticalFont, kCTFontVerticalOrientation, 1017 CTFontGetAdvancesForGlyphs(fCTUnrotatedFont, kCTFontVerticalOrientation,
1011 &cgGlyph, &cgAdvance, 1); 1018 &cgGlyph, &cgAdvance, 1);
1019 // Vertical metrics are rotated 90 degrees.
mtklein 2015/01/08 14:45:54 ... 90 degrees clockwise. ?
bungeman-skia 2015/01/08 16:21:58 Done. As if they were horizontal. They're not real
1020 SkTSwap(cgAdvance.height, cgAdvance.width);
1021 cgAdvance.height = -cgAdvance.height;
1012 } else { 1022 } else {
1013 CTFontGetAdvancesForGlyphs(fCTFont, kCTFontHorizontalOrientation, 1023 CTFontGetAdvancesForGlyphs(fCTUnrotatedFont, kCTFontHorizontalOrientatio n,
1014 &cgGlyph, &cgAdvance, 1); 1024 &cgGlyph, &cgAdvance, 1);
1015 } 1025 }
1026 cgAdvance = CGSizeApplyAffineTransform(cgAdvance, CTFontGetMatrix(fCTFont));
1016 glyph->fAdvanceX = SkFloatToFixed_Check(cgAdvance.width); 1027 glyph->fAdvanceX = SkFloatToFixed_Check(cgAdvance.width);
1017 glyph->fAdvanceY = -SkFloatToFixed_Check(cgAdvance.height); 1028 glyph->fAdvanceY = -SkFloatToFixed_Check(cgAdvance.height);
1018 1029
1019 // The following produces skBounds in SkGlyph units (pixels, y down), 1030 // The following produces skBounds in SkGlyph units (pixels, y down),
1020 // or returns early if skBounds would be empty. 1031 // or returns early if skBounds would be empty.
1021 SkRect skBounds; 1032 SkRect skBounds;
1022 1033
1023 // On Mountain Lion, CTFontGetBoundingRectsForGlyphs with kCTFontVerticalOri entation and 1034 // On Mountain Lion, CTFontGetBoundingRectsForGlyphs with kCTFontVerticalOri entation and
1024 // CTFontGetVerticalTranslationsForGlyphs do not agree when using OTF CFF fo nts. 1035 // 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 1036 // 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 } 1157 }
1147 *dst++ = mask; 1158 *dst++ = mask;
1148 } 1159 }
1149 } 1160 }
1150 1161
1151 template<bool APPLY_PREBLEND> 1162 template<bool APPLY_PREBLEND>
1152 static inline uint8_t rgb_to_a8(CGRGBPixel rgb, const uint8_t* table8) { 1163 static inline uint8_t rgb_to_a8(CGRGBPixel rgb, const uint8_t* table8) {
1153 U8CPU r = (rgb >> 16) & 0xFF; 1164 U8CPU r = (rgb >> 16) & 0xFF;
1154 U8CPU g = (rgb >> 8) & 0xFF; 1165 U8CPU g = (rgb >> 8) & 0xFF;
1155 U8CPU b = (rgb >> 0) & 0xFF; 1166 U8CPU b = (rgb >> 0) & 0xFF;
1156 return sk_apply_lut_if<APPLY_PREBLEND>(SkComputeLuminance(r, g, b), table8); 1167 U8CPU lum = sk_apply_lut_if<APPLY_PREBLEND>(SkComputeLuminance(r, g, b), tab le8);
1168 #if SK_SHOW_TEXT_BLIT_COVERAGE
1169 lum = SkTMax(lum, (U8CPU)0x30);
1170 #endif
1171 return lum;
1157 } 1172 }
1158 template<bool APPLY_PREBLEND> 1173 template<bool APPLY_PREBLEND>
1159 static void rgb_to_a8(const CGRGBPixel* SK_RESTRICT cgPixels, size_t cgRowBytes, 1174 static void rgb_to_a8(const CGRGBPixel* SK_RESTRICT cgPixels, size_t cgRowBytes,
1160 const SkGlyph& glyph, const uint8_t* table8) { 1175 const SkGlyph& glyph, const uint8_t* table8) {
1161 const int width = glyph.fWidth; 1176 const int width = glyph.fWidth;
1162 size_t dstRB = glyph.rowBytes(); 1177 size_t dstRB = glyph.rowBytes();
1163 uint8_t* SK_RESTRICT dst = (uint8_t*)glyph.fImage; 1178 uint8_t* SK_RESTRICT dst = (uint8_t*)glyph.fImage;
1164 1179
1165 for (int y = 0; y < glyph.fHeight; y++) { 1180 for (int y = 0; y < glyph.fHeight; y++) {
1166 for (int i = 0; i < width; ++i) { 1181 for (int i = 0; i < width; ++i) {
1167 dst[i] = rgb_to_a8<APPLY_PREBLEND>(cgPixels[i], table8); 1182 dst[i] = rgb_to_a8<APPLY_PREBLEND>(cgPixels[i], table8);
1168 } 1183 }
1169 cgPixels = (CGRGBPixel*)((char*)cgPixels + cgRowBytes); 1184 cgPixels = (CGRGBPixel*)((char*)cgPixels + cgRowBytes);
1170 dst += dstRB; 1185 dst += dstRB;
1171 } 1186 }
1172 } 1187 }
1173 1188
1174 template<bool APPLY_PREBLEND> 1189 template<bool APPLY_PREBLEND>
1175 static inline uint16_t rgb_to_lcd16(CGRGBPixel rgb, const uint8_t* tableR, 1190 static inline uint16_t rgb_to_lcd16(CGRGBPixel rgb, const uint8_t* tableR,
1176 const uint8_t* tableG, 1191 const uint8_t* tableG,
1177 const uint8_t* tableB) { 1192 const uint8_t* tableB) {
1178 U8CPU r = sk_apply_lut_if<APPLY_PREBLEND>((rgb >> 16) & 0xFF, tableR); 1193 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); 1194 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); 1195 U8CPU b = sk_apply_lut_if<APPLY_PREBLEND>((rgb >> 0) & 0xFF, tableB);
1196 #if SK_SHOW_TEXT_BLIT_COVERAGE
1197 r = SkTMax(r, (U8CPU)0x30);
1198 g = SkTMax(g, (U8CPU)0x30);
1199 b = SkTMax(b, (U8CPU)0x30);
1200 #endif
1181 return SkPack888ToRGB16(r, g, b); 1201 return SkPack888ToRGB16(r, g, b);
1182 } 1202 }
1183 template<bool APPLY_PREBLEND> 1203 template<bool APPLY_PREBLEND>
1184 static void rgb_to_lcd16(const CGRGBPixel* SK_RESTRICT cgPixels, size_t cgRowByt es, const SkGlyph& glyph, 1204 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) { 1205 const uint8_t* tableR, const uint8_t* tableG, const uin t8_t* tableB) {
1186 const int width = glyph.fWidth; 1206 const int width = glyph.fWidth;
1187 size_t dstRB = glyph.rowBytes(); 1207 size_t dstRB = glyph.rowBytes();
1188 uint16_t* SK_RESTRICT dst = (uint16_t*)glyph.fImage; 1208 uint16_t* SK_RESTRICT dst = (uint16_t*)glyph.fImage;
1189 1209
1190 for (int y = 0; y < glyph.fHeight; y++) { 1210 for (int y = 0; y < glyph.fHeight; y++) {
1191 for (int i = 0; i < width; i++) { 1211 for (int i = 0; i < width; i++) {
1192 dst[i] = rgb_to_lcd16<APPLY_PREBLEND>(cgPixels[i], tableR, tableG, t ableB); 1212 dst[i] = rgb_to_lcd16<APPLY_PREBLEND>(cgPixels[i], tableR, tableG, t ableB);
1193 } 1213 }
1194 cgPixels = (CGRGBPixel*)((char*)cgPixels + cgRowBytes); 1214 cgPixels = (CGRGBPixel*)((char*)cgPixels + cgRowBytes);
1195 dst = (uint16_t*)((char*)dst + dstRB); 1215 dst = (uint16_t*)((char*)dst + dstRB);
1196 } 1216 }
1197 } 1217 }
1198 1218
1199 static SkPMColor cgpixels_to_pmcolor(CGRGBPixel rgb) { 1219 static SkPMColor cgpixels_to_pmcolor(CGRGBPixel rgb) {
1200 U8CPU a = (rgb >> 24) & 0xFF; 1220 U8CPU a = (rgb >> 24) & 0xFF;
1201 U8CPU r = (rgb >> 16) & 0xFF; 1221 U8CPU r = (rgb >> 16) & 0xFF;
1202 U8CPU g = (rgb >> 8) & 0xFF; 1222 U8CPU g = (rgb >> 8) & 0xFF;
1203 U8CPU b = (rgb >> 0) & 0xFF; 1223 U8CPU b = (rgb >> 0) & 0xFF;
1204 1224 #if SK_SHOW_TEXT_BLIT_COVERAGE
1225 a = SkTMax(a, (U8CPU)0x30);
1226 #endif
1205 return SkPackARGB32(a, r, g, b); 1227 return SkPackARGB32(a, r, g, b);
1206 } 1228 }
1207 1229
1208 template <typename T> T* SkTAddByteOffset(T* ptr, size_t byteOffset) { 1230 template <typename T> T* SkTAddByteOffset(T* ptr, size_t byteOffset) {
1209 return (T*)((char*)ptr + byteOffset); 1231 return (T*)((char*)ptr + byteOffset);
1210 } 1232 }
1211 1233
1212 void SkScalerContext_Mac::generateImage(const SkGlyph& glyph) { 1234 void SkScalerContext_Mac::generateImage(const SkGlyph& glyph) {
1213 CGGlyph cgGlyph = (CGGlyph) glyph.getGlyphID(); 1235 CGGlyph cgGlyph = (CGGlyph) glyph.getGlyphID();
1214 1236
(...skipping 1049 matching lines...) Expand 10 before | Expand all | Expand 10 after
2264 } 2286 }
2265 return face; 2287 return face;
2266 } 2288 }
2267 }; 2289 };
2268 2290
2269 /////////////////////////////////////////////////////////////////////////////// 2291 ///////////////////////////////////////////////////////////////////////////////
2270 2292
2271 SkFontMgr* SkFontMgr::Factory() { 2293 SkFontMgr* SkFontMgr::Factory() {
2272 return SkNEW(SkFontMgr_Mac); 2294 return SkNEW(SkFontMgr_Mac);
2273 } 2295 }
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