Support 3D rotations when drawing text
If a perspective transform is set on the Canvas, drawText() should not attempt to rasterize glyphs in screen space. This change uses the old behavior instead (i.e. rasterize the glyphs at the native font size and apply the transform on the resulting mesh.) This change also adds an optimization: empty glyphs (spaces) do not generate vertices anymore. This saves a lot of vertices in text heavy applications such as Gmail. Change-Id: Ib531384163f5165b5785501612a7b1474f3ff599
This commit is contained in:
@ -180,7 +180,17 @@ CacheTexture* FontRenderer::cacheBitmapInTexture(const SkGlyph& glyph,
|
||||
void FontRenderer::cacheBitmap(const SkGlyph& glyph, CachedGlyphInfo* cachedGlyph,
|
||||
uint32_t* retOriginX, uint32_t* retOriginY, bool precaching) {
|
||||
checkInit();
|
||||
|
||||
// If the glyph bitmap is empty let's assum the glyph is valid
|
||||
// so we can avoid doing extra work later on
|
||||
if (glyph.fWidth == 0 || glyph.fHeight == 0) {
|
||||
cachedGlyph->mIsValid = true;
|
||||
cachedGlyph->mCacheTexture = NULL;
|
||||
return;
|
||||
}
|
||||
|
||||
cachedGlyph->mIsValid = false;
|
||||
|
||||
// If the glyph is too tall, don't cache it
|
||||
if (glyph.fHeight + TEXTURE_BORDER_SIZE * 2 >
|
||||
mCacheTextures[mCacheTextures.size() - 1]->getHeight()) {
|
||||
|
Reference in New Issue
Block a user