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

Side by Side Diff: src/gpu/GrFontScaler.cpp

Issue 636183005: Fix color emoji. (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: Fix even dumber bug introduced by previous fix Created 6 years, 2 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
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 67 matching lines...) Expand 10 before | Expand all | Expand 10 after
78 } 78 }
79 } 79 }
80 80
81 const GrFontDescKey* GrFontScaler::getKey() { 81 const GrFontDescKey* GrFontScaler::getKey() {
82 if (NULL == fKey) { 82 if (NULL == fKey) {
83 fKey = SkNEW_ARGS(GrFontDescKey, (fStrike->getDescriptor())); 83 fKey = SkNEW_ARGS(GrFontDescKey, (fStrike->getDescriptor()));
84 } 84 }
85 return fKey; 85 return fKey;
86 } 86 }
87 87
88 GrMaskFormat GrFontScaler::getPackedGlyphMaskFormat(GrGlyph::PackedID packed) {
89 const SkGlyph& glyph = fStrike->getGlyphIDMetrics(GrGlyph::UnpackID(packed),
90 GrGlyph::UnpackFixedX(pack ed),
91 GrGlyph::UnpackFixedY(pack ed));
92 SkMask::Format format = static_cast<SkMask::Format>(glyph.fMaskFormat);
93 switch (format) {
94 case SkMask::kBW_Format:
95 // fall through to kA8 -- we store BW glyphs in our 8-bit cache
96 case SkMask::kA8_Format:
97 return kA8_GrMaskFormat;
98 case SkMask::kLCD16_Format:
99 return kA565_GrMaskFormat;
100 case SkMask::kLCD32_Format:
101 return kA888_GrMaskFormat;
102 case SkMask::kARGB32_Format:
103 return kARGB_GrMaskFormat;
104 default:
105 SkDEBUGFAIL("unsupported SkMask::Format");
106 return kA8_GrMaskFormat;
107 }
108 }
109
88 bool GrFontScaler::getPackedGlyphBounds(GrGlyph::PackedID packed, SkIRect* bound s) { 110 bool GrFontScaler::getPackedGlyphBounds(GrGlyph::PackedID packed, SkIRect* bound s) {
89 const SkGlyph& glyph = fStrike->getGlyphIDMetrics(GrGlyph::UnpackID(packed), 111 const SkGlyph& glyph = fStrike->getGlyphIDMetrics(GrGlyph::UnpackID(packed),
90 GrGlyph::UnpackFixedX(pack ed), 112 GrGlyph::UnpackFixedX(pack ed),
91 GrGlyph::UnpackFixedY(pack ed)); 113 GrGlyph::UnpackFixedY(pack ed));
92 bounds->setXYWH(glyph.fLeft, glyph.fTop, glyph.fWidth, glyph.fHeight); 114 bounds->setXYWH(glyph.fLeft, glyph.fTop, glyph.fWidth, glyph.fHeight);
93 115
94 return true; 116 return true;
95 } 117 }
96 118
97 bool GrFontScaler::getPackedGlyphDFBounds(GrGlyph::PackedID packed, SkIRect* bou nds) { 119 bool GrFontScaler::getPackedGlyphDFBounds(GrGlyph::PackedID packed, SkIRect* bou nds) {
(...skipping 106 matching lines...) Expand 10 before | Expand all | Expand 10 after
204 bool GrFontScaler::getGlyphPath(uint16_t glyphID, SkPath* path) { 226 bool GrFontScaler::getGlyphPath(uint16_t glyphID, SkPath* path) {
205 227
206 const SkGlyph& glyph = fStrike->getGlyphIDMetrics(glyphID); 228 const SkGlyph& glyph = fStrike->getGlyphIDMetrics(glyphID);
207 const SkPath* skPath = fStrike->findPath(glyph); 229 const SkPath* skPath = fStrike->findPath(glyph);
208 if (skPath) { 230 if (skPath) {
209 *path = *skPath; 231 *path = *skPath;
210 return true; 232 return true;
211 } 233 }
212 return false; 234 return false;
213 } 235 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698