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

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

Issue 834103004: Remove distance field generation and storage from SkGlyphCache. (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: Created 5 years, 11 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/core/SkGlyphCache.cpp ('k') | no next file » | 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 178 matching lines...) Expand 10 before | Expand all | Expand 10 after
189 for (int y = 0; y < height; y++) { 189 for (int y = 0; y < height; y++) {
190 memcpy(dst, src, width * bbp); 190 memcpy(dst, src, width * bbp);
191 src = (const char*)src + srcRB; 191 src = (const char*)src + srcRB;
192 dst = (char*)dst + dstRB; 192 dst = (char*)dst + dstRB;
193 } 193 }
194 } 194 }
195 return true; 195 return true;
196 } 196 }
197 197
198 bool GrFontScaler::getPackedGlyphDFImage(GrGlyph::PackedID packed, 198 bool GrFontScaler::getPackedGlyphDFImage(GrGlyph::PackedID packed,
199 int width, int height, 199 int width, int height,
200 void* dst) { 200 void* dst) {
201 const SkGlyph& glyph = fStrike->getGlyphIDMetrics(GrGlyph::UnpackID(packed), 201 const SkGlyph& glyph = fStrike->getGlyphIDMetrics(GrGlyph::UnpackID(packed),
202 GrGlyph::UnpackFixedX(pack ed), 202 GrGlyph::UnpackFixedX(pack ed),
203 GrGlyph::UnpackFixedY(pack ed)); 203 GrGlyph::UnpackFixedY(pack ed));
204 SkASSERT(glyph.fWidth + 2*SK_DistanceFieldPad == width); 204 SkASSERT(glyph.fWidth + 2*SK_DistanceFieldPad == width);
205 SkASSERT(glyph.fHeight + 2*SK_DistanceFieldPad == height); 205 SkASSERT(glyph.fHeight + 2*SK_DistanceFieldPad == height);
206 const void* src = fStrike->findDistanceField(glyph); 206 const void* image = fStrike->findImage(glyph);
207 if (NULL == src) { 207 if (NULL == image) {
208 return false;
209 }
210 // now generate the distance field
211 SkASSERT(dst);
212 SkMask::Format maskFormat = static_cast<SkMask::Format>(glyph.fMaskFormat);
213 if (SkMask::kA8_Format == maskFormat) {
214 // make the distance field from the image
215 SkGenerateDistanceFieldFromA8Image((unsigned char*)dst,
216 (unsigned char*)image,
217 glyph.fWidth, glyph.fHeight,
218 glyph.rowBytes());
219 } else if (SkMask::kBW_Format == maskFormat) {
220 // make the distance field from the image
221 SkGenerateDistanceFieldFromBWImage((unsigned char*)dst,
222 (unsigned char*)image,
223 glyph.fWidth, glyph.fHeight,
224 glyph.rowBytes());
225 } else {
208 return false; 226 return false;
209 } 227 }
210 228
211 memcpy(dst, src, width * height);
212
213 return true; 229 return true;
214 } 230 }
215 231
216 // we should just return const SkPath* (NULL means false) 232 // we should just return const SkPath* (NULL means false)
217 bool GrFontScaler::getGlyphPath(uint16_t glyphID, SkPath* path) { 233 bool GrFontScaler::getGlyphPath(uint16_t glyphID, SkPath* path) {
218 234
219 const SkGlyph& glyph = fStrike->getGlyphIDMetrics(glyphID); 235 const SkGlyph& glyph = fStrike->getGlyphIDMetrics(glyphID);
220 const SkPath* skPath = fStrike->findPath(glyph); 236 const SkPath* skPath = fStrike->findPath(glyph);
221 if (skPath) { 237 if (skPath) {
222 *path = *skPath; 238 *path = *skPath;
223 return true; 239 return true;
224 } 240 }
225 return false; 241 return false;
226 } 242 }
OLDNEW
« no previous file with comments | « src/core/SkGlyphCache.cpp ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698