diff options
author | Vincent Sanders <vince@netsurf-browser.org> | 2009-02-26 10:50:00 +0000 |
---|---|---|
committer | Vincent Sanders <vince@netsurf-browser.org> | 2009-02-26 10:50:00 +0000 |
commit | 743f722bcb3eb639230cd7c1006199534f4ba2b3 (patch) | |
tree | e472bb0ddc7c609e3ff482cf2f160889d6259080 /framebuffer/fb_32bpp_plotters.c | |
parent | caf41b6b19b816a94ff52bfe0626e1e7dd906e24 (diff) | |
download | netsurf-743f722bcb3eb639230cd7c1006199534f4ba2b3.tar.gz netsurf-743f722bcb3eb639230cd7c1006199534f4ba2b3.tar.bz2 |
cache freetype glyphs, massive reduction in cpu requirement
svn path=/trunk/netsurf/; revision=6622
Diffstat (limited to 'framebuffer/fb_32bpp_plotters.c')
-rw-r--r-- | framebuffer/fb_32bpp_plotters.c | 45 |
1 files changed, 21 insertions, 24 deletions
diff --git a/framebuffer/fb_32bpp_plotters.c b/framebuffer/fb_32bpp_plotters.c index 1950ff30b..1237f01a0 100644 --- a/framebuffer/fb_32bpp_plotters.c +++ b/framebuffer/fb_32bpp_plotters.c @@ -324,37 +324,34 @@ static bool fb_32bpp_text(int x, int y, const struct css_style *style, { uint32_t ucs4; size_t nxtchr = 0; - FT_UInt glyph_index; - FT_Face face = fb_get_face(style); - FT_Error error; + FT_Glyph glyph; + FT_BitmapGlyph bglyph; while (nxtchr < length) { ucs4 = utf8_to_ucs4(text + nxtchr, length - nxtchr); nxtchr = utf8_next(text, length, nxtchr); - glyph_index = FT_Get_Char_Index(face, ucs4); - - error = FT_Load_Glyph(face, - glyph_index, - FT_LOAD_RENDER | - FT_LOAD_FORCE_AUTOHINT | - ft_load_type); - if (error) + + glyph = fb_getglyph(style, ucs4); + if (glyph == NULL) continue; - /* now, draw to our target surface */ - if (face->glyph->bitmap.pixel_mode == FT_PIXEL_MODE_MONO) { - fb_32bpp_draw_ft_monobitmap( &face->glyph->bitmap, - x + face->glyph->bitmap_left, - y - face->glyph->bitmap_top, - c); - } else { - fb_32bpp_draw_ft_bitmap( &face->glyph->bitmap, - x + face->glyph->bitmap_left, - y - face->glyph->bitmap_top, - c); + if (glyph->format == FT_GLYPH_FORMAT_BITMAP) { + bglyph = (FT_BitmapGlyph)glyph; + + /* now, draw to our target surface */ + if (bglyph->bitmap.pixel_mode == FT_PIXEL_MODE_MONO) { + fb_32bpp_draw_ft_monobitmap(&bglyph->bitmap, + x + bglyph->left, + y - bglyph->top, + c); + } else { + fb_32bpp_draw_ft_bitmap(&bglyph->bitmap, + x + bglyph->left, + y - bglyph->top, + c); + } } - - x += face->glyph->advance.x >> 6; + x += glyph->advance.x >> 16; } return true; |