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

Side by Side Diff: src/gpu/GrFontScaler.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/gpu/GrBitmapTextContext.cpp ('k') | src/gpu/GrTextStrike.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 2010 Google Inc. 3 * Copyright 2010 Google Inc.
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 9
10 #include "GrTemplates.h" 10 #include "GrTemplates.h"
(...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after
61 61
62 GrMaskFormat GrFontScaler::getMaskFormat() const { 62 GrMaskFormat GrFontScaler::getMaskFormat() const {
63 SkMask::Format format = fStrike->getMaskFormat(); 63 SkMask::Format format = fStrike->getMaskFormat();
64 switch (format) { 64 switch (format) {
65 case SkMask::kBW_Format: 65 case SkMask::kBW_Format:
66 // fall through to kA8 -- we store BW glyphs in our 8-bit cache 66 // fall through to kA8 -- we store BW glyphs in our 8-bit cache
67 case SkMask::kA8_Format: 67 case SkMask::kA8_Format:
68 return kA8_GrMaskFormat; 68 return kA8_GrMaskFormat;
69 case SkMask::kLCD16_Format: 69 case SkMask::kLCD16_Format:
70 return kA565_GrMaskFormat; 70 return kA565_GrMaskFormat;
71 case SkMask::kLCD32_Format:
72 return kA888_GrMaskFormat;
73 case SkMask::kARGB32_Format: 71 case SkMask::kARGB32_Format:
74 return kARGB_GrMaskFormat; 72 return kARGB_GrMaskFormat;
75 default: 73 default:
76 SkDEBUGFAIL("unsupported SkMask::Format"); 74 SkDEBUGFAIL("unsupported SkMask::Format");
77 return kA8_GrMaskFormat; 75 return kA8_GrMaskFormat;
78 } 76 }
79 } 77 }
80 78
81 const GrFontDescKey* GrFontScaler::getKey() { 79 const GrFontDescKey* GrFontScaler::getKey() {
82 if (NULL == fKey) { 80 if (NULL == fKey) {
83 fKey = SkNEW_ARGS(GrFontDescKey, (fStrike->getDescriptor())); 81 fKey = SkNEW_ARGS(GrFontDescKey, (fStrike->getDescriptor()));
84 } 82 }
85 return fKey; 83 return fKey;
86 } 84 }
87 85
88 GrMaskFormat GrFontScaler::getPackedGlyphMaskFormat(GrGlyph::PackedID packed) co nst { 86 GrMaskFormat GrFontScaler::getPackedGlyphMaskFormat(GrGlyph::PackedID packed) co nst {
89 const SkGlyph& glyph = fStrike->getGlyphIDMetrics(GrGlyph::UnpackID(packed), 87 const SkGlyph& glyph = fStrike->getGlyphIDMetrics(GrGlyph::UnpackID(packed),
90 GrGlyph::UnpackFixedX(pack ed), 88 GrGlyph::UnpackFixedX(pack ed),
91 GrGlyph::UnpackFixedY(pack ed)); 89 GrGlyph::UnpackFixedY(pack ed));
92 SkMask::Format format = static_cast<SkMask::Format>(glyph.fMaskFormat); 90 SkMask::Format format = static_cast<SkMask::Format>(glyph.fMaskFormat);
93 switch (format) { 91 switch (format) {
94 case SkMask::kBW_Format: 92 case SkMask::kBW_Format:
95 // fall through to kA8 -- we store BW glyphs in our 8-bit cache 93 // fall through to kA8 -- we store BW glyphs in our 8-bit cache
96 case SkMask::kA8_Format: 94 case SkMask::kA8_Format:
97 return kA8_GrMaskFormat; 95 return kA8_GrMaskFormat;
98 case SkMask::kLCD16_Format: 96 case SkMask::kLCD16_Format:
99 return kA565_GrMaskFormat; 97 return kA565_GrMaskFormat;
100 case SkMask::kLCD32_Format:
101 return kA888_GrMaskFormat;
102 case SkMask::kARGB32_Format: 98 case SkMask::kARGB32_Format:
103 return kARGB_GrMaskFormat; 99 return kARGB_GrMaskFormat;
104 default: 100 default:
105 SkDEBUGFAIL("unsupported SkMask::Format"); 101 SkDEBUGFAIL("unsupported SkMask::Format");
106 return kA8_GrMaskFormat; 102 return kA8_GrMaskFormat;
107 } 103 }
108 } 104 }
109 105
110 bool GrFontScaler::getPackedGlyphBounds(GrGlyph::PackedID packed, SkIRect* bound s) { 106 bool GrFontScaler::getPackedGlyphBounds(GrGlyph::PackedID packed, SkIRect* bound s) {
111 const SkGlyph& glyph = fStrike->getGlyphIDMetrics(GrGlyph::UnpackID(packed), 107 const SkGlyph& glyph = fStrike->getGlyphIDMetrics(GrGlyph::UnpackID(packed),
(...skipping 64 matching lines...) Expand 10 before | Expand all | Expand 10 after
176 case kA8_GrMaskFormat:{ 172 case kA8_GrMaskFormat:{
177 uint8_t* bytes = reinterpret_cast<uint8_t*>(dst); 173 uint8_t* bytes = reinterpret_cast<uint8_t*>(dst);
178 expand_bits(bytes, bits, width, height, dstRB, srcRB); 174 expand_bits(bytes, bits, width, height, dstRB, srcRB);
179 break; 175 break;
180 } 176 }
181 case kA565_GrMaskFormat: { 177 case kA565_GrMaskFormat: {
182 uint16_t* rgb565 = reinterpret_cast<uint16_t*>(dst); 178 uint16_t* rgb565 = reinterpret_cast<uint16_t*>(dst);
183 expand_bits(rgb565, bits, width, height, dstRB, srcRB); 179 expand_bits(rgb565, bits, width, height, dstRB, srcRB);
184 break; 180 break;
185 } 181 }
186 case kA888_GrMaskFormat: {
187 uint32_t* rgba8888 = reinterpret_cast<uint32_t*>(dst);
188 expand_bits(rgba8888, bits, width, height, dstRB, srcRB);
189 break;
190 }
191 default: 182 default:
192 SkFAIL("Invalid GrMaskFormat"); 183 SkFAIL("Invalid GrMaskFormat");
193 } 184 }
194 } else if (srcRB == dstRB) { 185 } else if (srcRB == dstRB) {
195 memcpy(dst, src, dstRB * height); 186 memcpy(dst, src, dstRB * height);
196 } else { 187 } else {
197 const int bbp = GrMaskFormatBytesPerPixel(this->getMaskFormat()); 188 const int bbp = GrMaskFormatBytesPerPixel(this->getMaskFormat());
198 for (int y = 0; y < height; y++) { 189 for (int y = 0; y < height; y++) {
199 memcpy(dst, src, width * bbp); 190 memcpy(dst, src, width * bbp);
200 src = (const char*)src + srcRB; 191 src = (const char*)src + srcRB;
(...skipping 25 matching lines...) Expand all
226 bool GrFontScaler::getGlyphPath(uint16_t glyphID, SkPath* path) { 217 bool GrFontScaler::getGlyphPath(uint16_t glyphID, SkPath* path) {
227 218
228 const SkGlyph& glyph = fStrike->getGlyphIDMetrics(glyphID); 219 const SkGlyph& glyph = fStrike->getGlyphIDMetrics(glyphID);
229 const SkPath* skPath = fStrike->findPath(glyph); 220 const SkPath* skPath = fStrike->findPath(glyph);
230 if (skPath) { 221 if (skPath) {
231 *path = *skPath; 222 *path = *skPath;
232 return true; 223 return true;
233 } 224 }
234 return false; 225 return false;
235 } 226 }
OLDNEW
« no previous file with comments | « src/gpu/GrBitmapTextContext.cpp ('k') | src/gpu/GrTextStrike.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698