From 257ae3502cfad43df681b1783528d645bdabc63f Mon Sep 17 00:00:00 2001 From: Romain Guy Date: Wed, 20 Mar 2013 16:31:12 -0700 Subject: Optimize text GL setup Only performs the GL setup steps when at least one glyph is drawn. This change also skips various draw operations when the specified paint draws with alpha = 0. Change-Id: I9eda148b0503acffc552ee19196f5d52e958a1a2 --- libs/hwui/FontRenderer.h | 15 +++++++-------- 1 file changed, 7 insertions(+), 8 deletions(-) (limited to 'libs/hwui/FontRenderer.h') diff --git a/libs/hwui/FontRenderer.h b/libs/hwui/FontRenderer.h index 080cc713b0a6..1da3b6cb3433 100644 --- a/libs/hwui/FontRenderer.h +++ b/libs/hwui/FontRenderer.h @@ -38,6 +38,8 @@ namespace RSC { class ScriptIntrinsicBlur; } +class Functor; + namespace android { namespace uirenderer { @@ -62,7 +64,8 @@ public: // bounds is an out parameter bool renderPosText(SkPaint* paint, const Rect* clip, const char *text, uint32_t startIndex, - uint32_t len, int numGlyphs, int x, int y, const float* positions, Rect* bounds); + uint32_t len, int numGlyphs, int x, int y, const float* positions, Rect* bounds, + Functor* functor); // bounds is an out parameter bool renderTextOnPath(SkPaint* paint, const Rect* clip, const char *text, uint32_t startIndex, uint32_t len, int numGlyphs, SkPath* path, float hOffset, float vOffset, Rect* bounds); @@ -88,13 +91,8 @@ public: DropShadow renderDropShadow(SkPaint* paint, const char *text, uint32_t startIndex, uint32_t len, int numGlyphs, uint32_t radius, const float* positions); - GLuint getTexture(bool linearFiltering = false) { - checkInit(); - - mCurrentCacheTexture->setLinearFiltering(linearFiltering); + void setTextureFiltering(bool linearFiltering) { mLinearFiltering = linearFiltering; - - return mCurrentCacheTexture->getTextureId(); } uint32_t getCacheSize() const { @@ -125,7 +123,7 @@ private: void initVertexArrayBuffers(); void checkInit(); - void initRender(const Rect* clip, Rect* bounds); + void initRender(const Rect* clip, Rect* bounds, Functor* functor); void finishRender(); void issueDrawCommand(); @@ -167,6 +165,7 @@ private: uint32_t mMaxNumberOfQuads; uint32_t mIndexBufferID; + Functor* mFunctor; const Rect* mClip; Rect* mBounds; bool mDrawn; -- cgit v1.2.3-59-g8ed1b