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

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

Issue 728673002: remove unused kLCD_MaskFormat (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: remove associated Gr enum Created 6 years, 1 month 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 | « src/ports/SkFontHost_FreeType_common.cpp ('k') | src/ports/SkFontHost_win.cpp » ('j') | 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 236 matching lines...) Expand 10 before | Expand all | Expand 10 after
247 247
248 static bool isLion() { 248 static bool isLion() {
249 return darwinVersion() == 11; 249 return darwinVersion() == 11;
250 } 250 }
251 251
252 static bool isMountainLion() { 252 static bool isMountainLion() {
253 return darwinVersion() == 12; 253 return darwinVersion() == 12;
254 } 254 }
255 255
256 static bool isLCDFormat(unsigned format) { 256 static bool isLCDFormat(unsigned format) {
257 return SkMask::kLCD16_Format == format || SkMask::kLCD32_Format == format; 257 return SkMask::kLCD16_Format == format;
258 } 258 }
259 259
260 static CGFloat ScalarToCG(SkScalar scalar) { 260 static CGFloat ScalarToCG(SkScalar scalar) {
261 if (sizeof(CGFloat) == sizeof(float)) { 261 if (sizeof(CGFloat) == sizeof(float)) {
262 return SkScalarToFloat(scalar); 262 return SkScalarToFloat(scalar);
263 } else { 263 } else {
264 SkASSERT(sizeof(CGFloat) == sizeof(double)); 264 SkASSERT(sizeof(CGFloat) == sizeof(double));
265 return (CGFloat) SkScalarToDouble(scalar); 265 return (CGFloat) SkScalarToDouble(scalar);
266 } 266 }
267 } 267 }
(...skipping 868 matching lines...) Expand 10 before | Expand all | Expand 10 after
1136 1136
1137 for (int y = 0; y < glyph.fHeight; y++) { 1137 for (int y = 0; y < glyph.fHeight; y++) {
1138 for (int i = 0; i < width; i++) { 1138 for (int i = 0; i < width; i++) {
1139 dst[i] = rgb_to_lcd16<APPLY_PREBLEND>(cgPixels[i], tableR, tableG, t ableB); 1139 dst[i] = rgb_to_lcd16<APPLY_PREBLEND>(cgPixels[i], tableR, tableG, t ableB);
1140 } 1140 }
1141 cgPixels = (CGRGBPixel*)((char*)cgPixels + cgRowBytes); 1141 cgPixels = (CGRGBPixel*)((char*)cgPixels + cgRowBytes);
1142 dst = (uint16_t*)((char*)dst + dstRB); 1142 dst = (uint16_t*)((char*)dst + dstRB);
1143 } 1143 }
1144 } 1144 }
1145 1145
1146 template<bool APPLY_PREBLEND>
1147 static inline uint32_t rgb_to_lcd32(CGRGBPixel rgb, const uint8_t* tableR,
1148 const uint8_t* tableG,
1149 const uint8_t* tableB) {
1150 U8CPU r = sk_apply_lut_if<APPLY_PREBLEND>((rgb >> 16) & 0xFF, tableR);
1151 U8CPU g = sk_apply_lut_if<APPLY_PREBLEND>((rgb >> 8) & 0xFF, tableG);
1152 U8CPU b = sk_apply_lut_if<APPLY_PREBLEND>((rgb >> 0) & 0xFF, tableB);
1153 return SkPackARGB32(0xFF, r, g, b);
1154 }
1155 template<bool APPLY_PREBLEND>
1156 static void rgb_to_lcd32(const CGRGBPixel* SK_RESTRICT cgPixels, size_t cgRowByt es, const SkGlyph& glyph,
1157 const uint8_t* tableR, const uint8_t* tableG, const uin t8_t* tableB) {
1158 const int width = glyph.fWidth;
1159 size_t dstRB = glyph.rowBytes();
1160 uint32_t* SK_RESTRICT dst = (uint32_t*)glyph.fImage;
1161 for (int y = 0; y < glyph.fHeight; y++) {
1162 for (int i = 0; i < width; i++) {
1163 dst[i] = rgb_to_lcd32<APPLY_PREBLEND>(cgPixels[i], tableR, tableG, t ableB);
1164 }
1165 cgPixels = (CGRGBPixel*)((char*)cgPixels + cgRowBytes);
1166 dst = (uint32_t*)((char*)dst + dstRB);
1167 }
1168 }
1169
1170 #ifdef HACK_COLORGLYPHS 1146 #ifdef HACK_COLORGLYPHS
1171 // hack to colorize the output for testing kARGB32_Format 1147 // hack to colorize the output for testing kARGB32_Format
1172 static SkPMColor cgpixels_to_pmcolor(CGRGBPixel rgb, const SkGlyph& glyph, 1148 static SkPMColor cgpixels_to_pmcolor(CGRGBPixel rgb, const SkGlyph& glyph,
1173 int x, int y) { 1149 int x, int y) {
1174 U8CPU r = (rgb >> 16) & 0xFF; 1150 U8CPU r = (rgb >> 16) & 0xFF;
1175 U8CPU g = (rgb >> 8) & 0xFF; 1151 U8CPU g = (rgb >> 8) & 0xFF;
1176 U8CPU b = (rgb >> 0) & 0xFF; 1152 U8CPU b = (rgb >> 0) & 0xFF;
1177 unsigned a = SkComputeLuminance(r, g, b); 1153 unsigned a = SkComputeLuminance(r, g, b);
1178 1154
1179 // compute gradient from x,y 1155 // compute gradient from x,y
(...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after
1222 int g = (addr[x] >> 8) & 0xFF; 1198 int g = (addr[x] >> 8) & 0xFF;
1223 int b = (addr[x] >> 0) & 0xFF; 1199 int b = (addr[x] >> 0) & 0xFF;
1224 addr[x] = (table[r] << 16) | (table[g] << 8) | table[b]; 1200 addr[x] = (table[r] << 16) | (table[g] << 8) | table[b];
1225 } 1201 }
1226 addr = SkTAddByteOffset(addr, cgRowBytes); 1202 addr = SkTAddByteOffset(addr, cgRowBytes);
1227 } 1203 }
1228 } 1204 }
1229 1205
1230 // Convert glyph to mask 1206 // Convert glyph to mask
1231 switch (glyph.fMaskFormat) { 1207 switch (glyph.fMaskFormat) {
1232 case SkMask::kLCD32_Format: {
1233 if (fPreBlend.isApplicable()) {
1234 rgb_to_lcd32<true>(cgPixels, cgRowBytes, glyph,
1235 fPreBlend.fR, fPreBlend.fG, fPreBlend.fB);
1236 } else {
1237 rgb_to_lcd32<false>(cgPixels, cgRowBytes, glyph,
1238 fPreBlend.fR, fPreBlend.fG, fPreBlend.fB);
1239 }
1240 } break;
1241 case SkMask::kLCD16_Format: { 1208 case SkMask::kLCD16_Format: {
1242 if (fPreBlend.isApplicable()) { 1209 if (fPreBlend.isApplicable()) {
1243 rgb_to_lcd16<true>(cgPixels, cgRowBytes, glyph, 1210 rgb_to_lcd16<true>(cgPixels, cgRowBytes, glyph,
1244 fPreBlend.fR, fPreBlend.fG, fPreBlend.fB); 1211 fPreBlend.fR, fPreBlend.fG, fPreBlend.fB);
1245 } else { 1212 } else {
1246 rgb_to_lcd16<false>(cgPixels, cgRowBytes, glyph, 1213 rgb_to_lcd16<false>(cgPixels, cgRowBytes, glyph,
1247 fPreBlend.fR, fPreBlend.fG, fPreBlend.fB); 1214 fPreBlend.fR, fPreBlend.fG, fPreBlend.fB);
1248 } 1215 }
1249 } break; 1216 } break;
1250 case SkMask::kA8_Format: { 1217 case SkMask::kA8_Format: {
(...skipping 990 matching lines...) Expand 10 before | Expand all | Expand 10 after
2241 } 2208 }
2242 return face; 2209 return face;
2243 } 2210 }
2244 }; 2211 };
2245 2212
2246 /////////////////////////////////////////////////////////////////////////////// 2213 ///////////////////////////////////////////////////////////////////////////////
2247 2214
2248 SkFontMgr* SkFontMgr::Factory() { 2215 SkFontMgr* SkFontMgr::Factory() {
2249 return SkNEW(SkFontMgr_Mac); 2216 return SkNEW(SkFontMgr_Mac);
2250 } 2217 }
OLDNEW
« no previous file with comments | « src/ports/SkFontHost_FreeType_common.cpp ('k') | src/ports/SkFontHost_win.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698