Loading libs/hwui/FontRenderer.cpp +24 −25 Original line number Diff line number Diff line Loading @@ -24,6 +24,7 @@ #include "Rect.h" #include "renderstate/RenderState.h" #include "utils/Blur.h" #include "utils/MathUtils.h" #include "utils/Timing.h" #include <SkGlyph.h> Loading @@ -47,7 +48,6 @@ namespace uirenderer { // TextSetupFunctor /////////////////////////////////////////////////////////////////////////////// status_t TextSetupFunctor::setup(GLenum glyphFormat) { renderer->setupDraw(); renderer->setupDrawTextGamma(paint); renderer->setupDrawDirtyRegionsDisabled(); Loading Loading @@ -94,20 +94,23 @@ status_t TextSetupFunctor::setup(GLenum glyphFormat) { static bool sLogFontRendererCreate = true; FontRenderer::FontRenderer() : mActiveFonts(LruCache<Font::FontDescription, Font*>::kUnlimitedCapacity) { FontRenderer::FontRenderer() : mGammaTable(nullptr) , mCurrentFont(nullptr) , mActiveFonts(LruCache<Font::FontDescription, Font*>::kUnlimitedCapacity) , mCurrentCacheTexture(nullptr) , mUploadTexture(false) , mFunctor(nullptr) , mClip(nullptr) , mBounds(nullptr) , mDrawn(false) , mInitialized(false) , mLinearFiltering(false) { if (sLogFontRendererCreate) { INIT_LOGD("Creating FontRenderer"); } mGammaTable = nullptr; mInitialized = false; mCurrentCacheTexture = nullptr; mLinearFiltering = false; mSmallCacheWidth = DEFAULT_TEXT_SMALL_CACHE_WIDTH; mSmallCacheHeight = DEFAULT_TEXT_SMALL_CACHE_HEIGHT; mLargeCacheWidth = DEFAULT_TEXT_LARGE_CACHE_WIDTH; Loading @@ -131,10 +134,11 @@ FontRenderer::FontRenderer() : } uint32_t maxTextureSize = (uint32_t) Caches::getInstance().maxTextureSize; mSmallCacheWidth = mSmallCacheWidth > maxTextureSize ? maxTextureSize : mSmallCacheWidth; mSmallCacheHeight = mSmallCacheHeight > maxTextureSize ? maxTextureSize : mSmallCacheHeight; mLargeCacheWidth = mLargeCacheWidth > maxTextureSize ? maxTextureSize : mLargeCacheWidth; mLargeCacheHeight = mLargeCacheHeight > maxTextureSize ? maxTextureSize : mLargeCacheHeight; mSmallCacheWidth = MathUtils::min(mSmallCacheWidth, maxTextureSize); mSmallCacheHeight = MathUtils::min(mSmallCacheHeight, maxTextureSize); mLargeCacheWidth = MathUtils::min(mLargeCacheWidth, maxTextureSize); mLargeCacheHeight = MathUtils::min(mLargeCacheHeight, maxTextureSize); if (sLogFontRendererCreate) { INIT_LOGD(" Text cache sizes, in pixels: %i x %i, %i x %i, %i x %i, %i x %i", Loading Loading @@ -493,22 +497,19 @@ void FontRenderer::issueDrawCommand(Vector<CacheTexture*>& cacheTextures) { CacheTexture* texture = cacheTextures[i]; if (texture->canDraw()) { if (first) { if (mFunctor) { mFunctor->setup(texture->getFormat()); } checkTextureUpdate(); renderState.meshState().bindQuadIndicesBuffer(); if (!mDrawn) { // If returns true, a VBO was bound and we must // rebind our vertex attrib pointers even if // they have the same values as the current pointers forceRebind = renderState.meshState().unbindMeshBuffer(); } caches.textureState().activateTexture(0); first = false; mDrawn = true; } caches.textureState().bindTexture(texture->getTextureId()); Loading @@ -531,8 +532,6 @@ void FontRenderer::issueDrawCommand(Vector<CacheTexture*>& cacheTextures) { void FontRenderer::issueDrawCommand() { issueDrawCommand(mACacheTextures); issueDrawCommand(mRGBACacheTextures); mDrawn = true; } void FontRenderer::appendMeshQuadNoClip(float x1, float y1, float u1, float v1, Loading libs/hwui/OpenGLRenderer.cpp +6 −17 Original line number Diff line number Diff line Loading @@ -1169,7 +1169,7 @@ void OpenGLRenderer::drawRegionRects(const SkRegion& region, const SkPaint& pain } void OpenGLRenderer::dirtyLayer(const float left, const float top, const float right, const float bottom, const mat4 transform) { const float right, const float bottom, const Matrix4& transform) { if (hasLayer()) { Rect bounds(left, top, right, bottom); transform.mapRect(bounds); Loading Loading @@ -2805,16 +2805,11 @@ void OpenGLRenderer::drawPosText(const char* text, int bytesCount, int count, TextSetupFunctor functor(this, x, y, pureTranslate, alpha, mode, paint); if (fontRenderer.renderPosText(paint, &clip, text, 0, bytesCount, count, x, y, positions, hasActiveLayer ? &bounds : nullptr, &functor)) { if (hasActiveLayer) { if (!pureTranslate) { currentTransform()->mapRect(bounds); } dirtyLayerUnchecked(bounds, getRegion()); } positions, hasLayer() ? &bounds : nullptr, &functor)) { dirtyLayer(bounds.left, bounds.top, bounds.right, bounds.bottom, *currentTransform()); mDirty = true; } mDirty = true; } bool OpenGLRenderer::findBestFontTransform(const mat4& transform, SkMatrix* outMatrix) const { Loading Loading @@ -3011,14 +3006,10 @@ void OpenGLRenderer::drawTextOnPath(const char* text, int bytesCount, int count, if (fontRenderer.renderTextOnPath(paint, clip, text, 0, bytesCount, count, path, hOffset, vOffset, hasActiveLayer ? &bounds : nullptr, &functor)) { if (hasActiveLayer) { currentTransform()->mapRect(bounds); dirtyLayerUnchecked(bounds, getRegion()); } } dirtyLayer(bounds.left, bounds.top, bounds.right, bounds.bottom, *currentTransform()); mDirty = true; } } void OpenGLRenderer::drawPath(const SkPath* path, const SkPaint* paint) { if (mState.currentlyIgnored()) return; Loading Loading @@ -3109,11 +3100,9 @@ void OpenGLRenderer::drawLayer(Layer* layer, float x, float y) { x + layer->layer.getWidth(), y + layer->layer.getHeight()); } TextureVertex* mesh = &layer->mesh[0]; GLsizei elementsCount = layer->meshElementCount; while (elementsCount > 0) { GLsizei drawCount = MathUtils::min(elementsCount, (GLsizei) kMaxNumberOfQuads * 6); Loading libs/hwui/OpenGLRenderer.h +1 −1 Original line number Diff line number Diff line Loading @@ -677,7 +677,7 @@ private: * are transformed with the supplied matrix. */ void dirtyLayer(const float left, const float top, const float right, const float bottom, const mat4 transform); const float right, const float bottom, const Matrix4& transform); /** * Mark the layer as dirty at the specified coordinates. Loading Loading
libs/hwui/FontRenderer.cpp +24 −25 Original line number Diff line number Diff line Loading @@ -24,6 +24,7 @@ #include "Rect.h" #include "renderstate/RenderState.h" #include "utils/Blur.h" #include "utils/MathUtils.h" #include "utils/Timing.h" #include <SkGlyph.h> Loading @@ -47,7 +48,6 @@ namespace uirenderer { // TextSetupFunctor /////////////////////////////////////////////////////////////////////////////// status_t TextSetupFunctor::setup(GLenum glyphFormat) { renderer->setupDraw(); renderer->setupDrawTextGamma(paint); renderer->setupDrawDirtyRegionsDisabled(); Loading Loading @@ -94,20 +94,23 @@ status_t TextSetupFunctor::setup(GLenum glyphFormat) { static bool sLogFontRendererCreate = true; FontRenderer::FontRenderer() : mActiveFonts(LruCache<Font::FontDescription, Font*>::kUnlimitedCapacity) { FontRenderer::FontRenderer() : mGammaTable(nullptr) , mCurrentFont(nullptr) , mActiveFonts(LruCache<Font::FontDescription, Font*>::kUnlimitedCapacity) , mCurrentCacheTexture(nullptr) , mUploadTexture(false) , mFunctor(nullptr) , mClip(nullptr) , mBounds(nullptr) , mDrawn(false) , mInitialized(false) , mLinearFiltering(false) { if (sLogFontRendererCreate) { INIT_LOGD("Creating FontRenderer"); } mGammaTable = nullptr; mInitialized = false; mCurrentCacheTexture = nullptr; mLinearFiltering = false; mSmallCacheWidth = DEFAULT_TEXT_SMALL_CACHE_WIDTH; mSmallCacheHeight = DEFAULT_TEXT_SMALL_CACHE_HEIGHT; mLargeCacheWidth = DEFAULT_TEXT_LARGE_CACHE_WIDTH; Loading @@ -131,10 +134,11 @@ FontRenderer::FontRenderer() : } uint32_t maxTextureSize = (uint32_t) Caches::getInstance().maxTextureSize; mSmallCacheWidth = mSmallCacheWidth > maxTextureSize ? maxTextureSize : mSmallCacheWidth; mSmallCacheHeight = mSmallCacheHeight > maxTextureSize ? maxTextureSize : mSmallCacheHeight; mLargeCacheWidth = mLargeCacheWidth > maxTextureSize ? maxTextureSize : mLargeCacheWidth; mLargeCacheHeight = mLargeCacheHeight > maxTextureSize ? maxTextureSize : mLargeCacheHeight; mSmallCacheWidth = MathUtils::min(mSmallCacheWidth, maxTextureSize); mSmallCacheHeight = MathUtils::min(mSmallCacheHeight, maxTextureSize); mLargeCacheWidth = MathUtils::min(mLargeCacheWidth, maxTextureSize); mLargeCacheHeight = MathUtils::min(mLargeCacheHeight, maxTextureSize); if (sLogFontRendererCreate) { INIT_LOGD(" Text cache sizes, in pixels: %i x %i, %i x %i, %i x %i, %i x %i", Loading Loading @@ -493,22 +497,19 @@ void FontRenderer::issueDrawCommand(Vector<CacheTexture*>& cacheTextures) { CacheTexture* texture = cacheTextures[i]; if (texture->canDraw()) { if (first) { if (mFunctor) { mFunctor->setup(texture->getFormat()); } checkTextureUpdate(); renderState.meshState().bindQuadIndicesBuffer(); if (!mDrawn) { // If returns true, a VBO was bound and we must // rebind our vertex attrib pointers even if // they have the same values as the current pointers forceRebind = renderState.meshState().unbindMeshBuffer(); } caches.textureState().activateTexture(0); first = false; mDrawn = true; } caches.textureState().bindTexture(texture->getTextureId()); Loading @@ -531,8 +532,6 @@ void FontRenderer::issueDrawCommand(Vector<CacheTexture*>& cacheTextures) { void FontRenderer::issueDrawCommand() { issueDrawCommand(mACacheTextures); issueDrawCommand(mRGBACacheTextures); mDrawn = true; } void FontRenderer::appendMeshQuadNoClip(float x1, float y1, float u1, float v1, Loading
libs/hwui/OpenGLRenderer.cpp +6 −17 Original line number Diff line number Diff line Loading @@ -1169,7 +1169,7 @@ void OpenGLRenderer::drawRegionRects(const SkRegion& region, const SkPaint& pain } void OpenGLRenderer::dirtyLayer(const float left, const float top, const float right, const float bottom, const mat4 transform) { const float right, const float bottom, const Matrix4& transform) { if (hasLayer()) { Rect bounds(left, top, right, bottom); transform.mapRect(bounds); Loading Loading @@ -2805,16 +2805,11 @@ void OpenGLRenderer::drawPosText(const char* text, int bytesCount, int count, TextSetupFunctor functor(this, x, y, pureTranslate, alpha, mode, paint); if (fontRenderer.renderPosText(paint, &clip, text, 0, bytesCount, count, x, y, positions, hasActiveLayer ? &bounds : nullptr, &functor)) { if (hasActiveLayer) { if (!pureTranslate) { currentTransform()->mapRect(bounds); } dirtyLayerUnchecked(bounds, getRegion()); } positions, hasLayer() ? &bounds : nullptr, &functor)) { dirtyLayer(bounds.left, bounds.top, bounds.right, bounds.bottom, *currentTransform()); mDirty = true; } mDirty = true; } bool OpenGLRenderer::findBestFontTransform(const mat4& transform, SkMatrix* outMatrix) const { Loading Loading @@ -3011,14 +3006,10 @@ void OpenGLRenderer::drawTextOnPath(const char* text, int bytesCount, int count, if (fontRenderer.renderTextOnPath(paint, clip, text, 0, bytesCount, count, path, hOffset, vOffset, hasActiveLayer ? &bounds : nullptr, &functor)) { if (hasActiveLayer) { currentTransform()->mapRect(bounds); dirtyLayerUnchecked(bounds, getRegion()); } } dirtyLayer(bounds.left, bounds.top, bounds.right, bounds.bottom, *currentTransform()); mDirty = true; } } void OpenGLRenderer::drawPath(const SkPath* path, const SkPaint* paint) { if (mState.currentlyIgnored()) return; Loading Loading @@ -3109,11 +3100,9 @@ void OpenGLRenderer::drawLayer(Layer* layer, float x, float y) { x + layer->layer.getWidth(), y + layer->layer.getHeight()); } TextureVertex* mesh = &layer->mesh[0]; GLsizei elementsCount = layer->meshElementCount; while (elementsCount > 0) { GLsizei drawCount = MathUtils::min(elementsCount, (GLsizei) kMaxNumberOfQuads * 6); Loading
libs/hwui/OpenGLRenderer.h +1 −1 Original line number Diff line number Diff line Loading @@ -677,7 +677,7 @@ private: * are transformed with the supplied matrix. */ void dirtyLayer(const float left, const float top, const float right, const float bottom, const mat4 transform); const float right, const float bottom, const Matrix4& transform); /** * Mark the layer as dirty at the specified coordinates. Loading