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

Unified Diff: src/ports/SkFontHost_FreeType_common.cpp

Issue 103923002: Speed up generateImage by re-using the outline/bitmap that has already been loaded. (Closed) Base URL: https://skia.googlecode.com/svn/trunk
Patch Set: Created 7 years 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « src/ports/SkFontHost_FreeType_common.h ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/ports/SkFontHost_FreeType_common.cpp
diff --git a/src/ports/SkFontHost_FreeType_common.cpp b/src/ports/SkFontHost_FreeType_common.cpp
index 2c486847b6d8f4e0fe9c0f108707bf5662756e1a..c2f1926ecdf183657c84c0ff19d6e5ae2fedcd3f 100644
--- a/src/ports/SkFontHost_FreeType_common.cpp
+++ b/src/ports/SkFontHost_FreeType_common.cpp
@@ -129,10 +129,6 @@ void SkScalerContext_FreeType_Base::generateGlyphImage(FT_Face face, const SkGly
FT_BBox bbox;
FT_Bitmap target;
- if (fRec.fFlags & SkScalerContext::kEmbolden_Flag) {
- emboldenOutline(face, outline);
- }
-
int dx = 0, dy = 0;
if (fRec.fFlags & SkScalerContext::kSubpixelPositioning_Flag) {
dx = SkFixedToFDot6(glyph.getSubXFixed());
@@ -176,10 +172,6 @@ void SkScalerContext_FreeType_Base::generateGlyphImage(FT_Face face, const SkGly
} break;
case FT_GLYPH_FORMAT_BITMAP: {
- if (fRec.fFlags & SkScalerContext::kEmbolden_Flag) {
- FT_GlyphSlot_Own_Bitmap(face->glyph);
- FT_Bitmap_Embolden(face->glyph->library, &face->glyph->bitmap, kBitmapEmboldenStrength, 0);
- }
SkASSERT_CONTINUE(glyph.fWidth == face->glyph->bitmap.width);
SkASSERT_CONTINUE(glyph.fHeight == face->glyph->bitmap.rows);
SkASSERT_CONTINUE(glyph.fTop == -face->glyph->bitmap_top);
@@ -295,10 +287,6 @@ static int cubic_proc(const FT_Vector* pt0, const FT_Vector* pt1,
void SkScalerContext_FreeType_Base::generateGlyphPath(FT_Face face,
SkPath* path)
{
- if (fRec.fFlags & SkScalerContext::kEmbolden_Flag) {
- emboldenOutline(face, &face->glyph->outline);
- }
-
FT_Outline_Funcs funcs;
funcs.move_to = move_proc;
@@ -325,3 +313,20 @@ void SkScalerContext_FreeType_Base::emboldenOutline(FT_Face face, FT_Outline* ou
/ 24;
FT_Outline_Embolden(outline, strength);
}
+
+void SkScalerContext_FreeType_Base::emboldenIfNeeded(FT_Face face, FT_GlyphSlot glyph)
+{
+ if (fRec.fFlags & SkScalerContext::kEmbolden_Flag) {
+ switch ( glyph->format ) {
+ case FT_GLYPH_FORMAT_OUTLINE:
+ emboldenOutline(face, &glyph->outline);
+ break;
+ case FT_GLYPH_FORMAT_BITMAP:
+ FT_GlyphSlot_Own_Bitmap(glyph);
+ FT_Bitmap_Embolden(glyph->library, &glyph->bitmap, kBitmapEmboldenStrength, 0);
+ break;
+ default:
+ SkDEBUGFAIL("unknown glyph format");
+ }
+ }
+}
« no previous file with comments | « src/ports/SkFontHost_FreeType_common.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698