OLD | NEW |
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 70 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
81 switch (format) { | 81 switch (format) { |
82 case SkMask::kBW_Format: | 82 case SkMask::kBW_Format: |
83 // fall through to kA8 -- we store BW glyphs in our 8-bit cache | 83 // fall through to kA8 -- we store BW glyphs in our 8-bit cache |
84 case SkMask::kA8_Format: | 84 case SkMask::kA8_Format: |
85 return kA8_GrMaskFormat; | 85 return kA8_GrMaskFormat; |
86 case SkMask::kLCD16_Format: | 86 case SkMask::kLCD16_Format: |
87 return kA565_GrMaskFormat; | 87 return kA565_GrMaskFormat; |
88 case SkMask::kLCD32_Format: | 88 case SkMask::kLCD32_Format: |
89 return kA888_GrMaskFormat; | 89 return kA888_GrMaskFormat; |
90 default: | 90 default: |
91 GrAssert(!"unsupported SkMask::Format"); | 91 SkASSERT(!"unsupported SkMask::Format"); |
92 return kA8_GrMaskFormat; | 92 return kA8_GrMaskFormat; |
93 } | 93 } |
94 } | 94 } |
95 | 95 |
96 const GrKey* SkGrFontScaler::getKey() { | 96 const GrKey* SkGrFontScaler::getKey() { |
97 if (NULL == fKey) { | 97 if (NULL == fKey) { |
98 fKey = SkNEW_ARGS(SkGrDescKey, (fStrike->getDescriptor())); | 98 fKey = SkNEW_ARGS(SkGrDescKey, (fStrike->getDescriptor())); |
99 } | 99 } |
100 return fKey; | 100 return fKey; |
101 } | 101 } |
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
135 } | 135 } |
136 } | 136 } |
137 } | 137 } |
138 | 138 |
139 bool SkGrFontScaler::getPackedGlyphImage(GrGlyph::PackedID packed, | 139 bool SkGrFontScaler::getPackedGlyphImage(GrGlyph::PackedID packed, |
140 int width, int height, | 140 int width, int height, |
141 int dstRB, void* dst) { | 141 int dstRB, void* dst) { |
142 const SkGlyph& glyph = fStrike->getGlyphIDMetrics(GrGlyph::UnpackID(packed), | 142 const SkGlyph& glyph = fStrike->getGlyphIDMetrics(GrGlyph::UnpackID(packed), |
143 GrGlyph::UnpackFixedX(packed), | 143 GrGlyph::UnpackFixedX(packed), |
144 GrGlyph::UnpackFixedY(packed)); | 144 GrGlyph::UnpackFixedY(packed)); |
145 GrAssert(glyph.fWidth == width); | 145 SkASSERT(glyph.fWidth == width); |
146 GrAssert(glyph.fHeight == height); | 146 SkASSERT(glyph.fHeight == height); |
147 const void* src = fStrike->findImage(glyph); | 147 const void* src = fStrike->findImage(glyph); |
148 if (NULL == src) { | 148 if (NULL == src) { |
149 return false; | 149 return false; |
150 } | 150 } |
151 | 151 |
152 int srcRB = glyph.rowBytes(); | 152 int srcRB = glyph.rowBytes(); |
153 // The windows font host sometimes has BW glyphs in a non-BW strike. So it i
s important here to | 153 // The windows font host sometimes has BW glyphs in a non-BW strike. So it i
s important here to |
154 // check the glyph's format, not the strike's format, and to be able to conv
ert to any of the | 154 // check the glyph's format, not the strike's format, and to be able to conv
ert to any of the |
155 // GrMaskFormats. | 155 // GrMaskFormats. |
156 if (SkMask::kBW_Format == glyph.fMaskFormat) { | 156 if (SkMask::kBW_Format == glyph.fMaskFormat) { |
(...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
192 bool SkGrFontScaler::getGlyphPath(uint16_t glyphID, SkPath* path) { | 192 bool SkGrFontScaler::getGlyphPath(uint16_t glyphID, SkPath* path) { |
193 | 193 |
194 const SkGlyph& glyph = fStrike->getGlyphIDMetrics(glyphID); | 194 const SkGlyph& glyph = fStrike->getGlyphIDMetrics(glyphID); |
195 const SkPath* skPath = fStrike->findPath(glyph); | 195 const SkPath* skPath = fStrike->findPath(glyph); |
196 if (skPath) { | 196 if (skPath) { |
197 *path = *skPath; | 197 *path = *skPath; |
198 return true; | 198 return true; |
199 } | 199 } |
200 return false; | 200 return false; |
201 } | 201 } |
OLD | NEW |