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

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: Check for atlas ownership when searching ClientPlotUsage. 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
« no previous file with comments | « src/gpu/GrDistanceFieldTextContext.cpp ('k') | src/gpu/GrTextStrike.h » ('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 41 matching lines...) Expand 10 before | Expand all | Expand 10 after
52 52
53 GrFontScaler::GrFontScaler(SkGlyphCache* strike) { 53 GrFontScaler::GrFontScaler(SkGlyphCache* strike) {
54 fStrike = strike; 54 fStrike = strike;
55 fKey = NULL; 55 fKey = NULL;
56 } 56 }
57 57
58 GrFontScaler::~GrFontScaler() { 58 GrFontScaler::~GrFontScaler() {
59 SkSafeUnref(fKey); 59 SkSafeUnref(fKey);
60 } 60 }
61 61
62 GrMaskFormat GrFontScaler::getMaskFormat() { 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: 71 case SkMask::kLCD32_Format:
72 return kA888_GrMaskFormat; 72 return kA888_GrMaskFormat;
73 case SkMask::kARGB32_Format: 73 case SkMask::kARGB32_Format:
74 return kARGB_GrMaskFormat; 74 return kARGB_GrMaskFormat;
75 default: 75 default:
76 SkDEBUGFAIL("unsupported SkMask::Format"); 76 SkDEBUGFAIL("unsupported SkMask::Format");
77 return kA8_GrMaskFormat; 77 return kA8_GrMaskFormat;
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) co nst {
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
« no previous file with comments | « src/gpu/GrDistanceFieldTextContext.cpp ('k') | src/gpu/GrTextStrike.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698