Loading libs/hwui/FontRenderer.cpp +8 −3 Original line number Diff line number Diff line Loading @@ -292,6 +292,9 @@ FontRenderer::FontRenderer() { mCurrentQuadIndex = 0; mTextureId = 0; mTextMeshPtr = NULL; mTextTexture = NULL; mIndexBufferID = 0; mCacheWidth = DEFAULT_TEXT_CACHE_WIDTH; Loading Loading @@ -319,8 +322,10 @@ FontRenderer::~FontRenderer() { } mCacheLines.clear(); if (mInitialized) { delete[] mTextMeshPtr; delete[] mTextTexture; } if (mTextureId) { glDeleteTextures(1, &mTextureId); Loading libs/hwui/GradientCache.cpp +1 −2 Original line number Diff line number Diff line Loading @@ -80,8 +80,7 @@ void GradientCache::operator()(SkShader*& shader, Texture*& texture) { /////////////////////////////////////////////////////////////////////////////// Texture* GradientCache::get(SkShader* shader) { Texture* texture = mCache.get(shader); return texture; return mCache.get(shader); } void GradientCache::remove(SkShader* shader) { Loading libs/hwui/OpenGLRenderer.cpp +5 −0 Original line number Diff line number Diff line Loading @@ -436,6 +436,7 @@ void OpenGLRenderer::drawBitmap(SkBitmap* bitmap, float left, float top, const S } const Texture* texture = mTextureCache.get(bitmap); if (!texture) return; const AutoTexture autoCleanup(texture); drawTextureRect(left, top, right, bottom, texture, paint); Loading @@ -451,6 +452,7 @@ void OpenGLRenderer::drawBitmap(SkBitmap* bitmap, const SkMatrix* matrix, const } const Texture* texture = mTextureCache.get(bitmap); if (!texture) return; const AutoTexture autoCleanup(texture); drawTextureRect(r.left, r.top, r.right, r.bottom, texture, paint); Loading @@ -465,6 +467,7 @@ void OpenGLRenderer::drawBitmap(SkBitmap* bitmap, } const Texture* texture = mTextureCache.get(bitmap); if (!texture) return; const AutoTexture autoCleanup(texture); const float width = texture->width; Loading @@ -489,6 +492,7 @@ void OpenGLRenderer::drawPatch(SkBitmap* bitmap, Res_png_9patch* patch, } const Texture* texture = mTextureCache.get(bitmap); if (!texture) return; const AutoTexture autoCleanup(texture); int alpha; Loading Loading @@ -617,6 +621,7 @@ void OpenGLRenderer::drawPath(SkPath* path, SkPaint* paint) { glActiveTexture(gTextureUnits[textureUnit]); const PathTexture* texture = mPathCache.get(path, paint); if (!texture) return; const AutoTexture autoCleanup(texture); int alpha; Loading libs/hwui/PathCache.cpp +15 −2 Original line number Diff line number Diff line Loading @@ -34,6 +34,10 @@ PathCache::PathCache(uint32_t maxByteSize): mCache(GenerationCache<PathCacheEntry, PathTexture*>::kUnlimitedCapacity), mSize(0), mMaxSize(maxByteSize) { mCache.setOnEntryRemovedListener(this); GLint maxTextureSize; glGetIntegerv(GL_MAX_TEXTURE_SIZE, &maxTextureSize); mMaxTextureSize = maxTextureSize; } PathCache::~PathCache() { Loading Loading @@ -94,9 +98,18 @@ PathTexture* PathCache::get(SkPath* path, SkPaint* paint) { PathTexture* PathCache::addTexture(const PathCacheEntry& entry, const SkPath *path, const SkPaint* paint) { const SkRect& bounds = path->getBounds(); const float pathWidth = bounds.width(); const float pathHeight = bounds.height(); if (pathWidth > mMaxTextureSize || pathHeight > mMaxTextureSize) { LOGW("Path too large to be rendered into a texture"); return NULL; } const float offset = entry.strokeWidth * 1.5f; const uint32_t width = uint32_t(bounds.width() + offset * 2.0 + 0.5); const uint32_t height = uint32_t(bounds.height() + offset * 2.0 + 0.5); const uint32_t width = uint32_t(pathWidth + offset * 2.0 + 0.5); const uint32_t height = uint32_t(pathHeight + offset * 2.0 + 0.5); const uint32_t size = width * height; // Don't even try to cache a bitmap that's bigger than the cache Loading libs/hwui/PathCache.h +1 −0 Original line number Diff line number Diff line Loading @@ -139,6 +139,7 @@ private: uint32_t mSize; uint32_t mMaxSize; GLuint mMaxTextureSize; }; // class PathCache }; // namespace uirenderer Loading Loading
libs/hwui/FontRenderer.cpp +8 −3 Original line number Diff line number Diff line Loading @@ -292,6 +292,9 @@ FontRenderer::FontRenderer() { mCurrentQuadIndex = 0; mTextureId = 0; mTextMeshPtr = NULL; mTextTexture = NULL; mIndexBufferID = 0; mCacheWidth = DEFAULT_TEXT_CACHE_WIDTH; Loading Loading @@ -319,8 +322,10 @@ FontRenderer::~FontRenderer() { } mCacheLines.clear(); if (mInitialized) { delete[] mTextMeshPtr; delete[] mTextTexture; } if (mTextureId) { glDeleteTextures(1, &mTextureId); Loading
libs/hwui/GradientCache.cpp +1 −2 Original line number Diff line number Diff line Loading @@ -80,8 +80,7 @@ void GradientCache::operator()(SkShader*& shader, Texture*& texture) { /////////////////////////////////////////////////////////////////////////////// Texture* GradientCache::get(SkShader* shader) { Texture* texture = mCache.get(shader); return texture; return mCache.get(shader); } void GradientCache::remove(SkShader* shader) { Loading
libs/hwui/OpenGLRenderer.cpp +5 −0 Original line number Diff line number Diff line Loading @@ -436,6 +436,7 @@ void OpenGLRenderer::drawBitmap(SkBitmap* bitmap, float left, float top, const S } const Texture* texture = mTextureCache.get(bitmap); if (!texture) return; const AutoTexture autoCleanup(texture); drawTextureRect(left, top, right, bottom, texture, paint); Loading @@ -451,6 +452,7 @@ void OpenGLRenderer::drawBitmap(SkBitmap* bitmap, const SkMatrix* matrix, const } const Texture* texture = mTextureCache.get(bitmap); if (!texture) return; const AutoTexture autoCleanup(texture); drawTextureRect(r.left, r.top, r.right, r.bottom, texture, paint); Loading @@ -465,6 +467,7 @@ void OpenGLRenderer::drawBitmap(SkBitmap* bitmap, } const Texture* texture = mTextureCache.get(bitmap); if (!texture) return; const AutoTexture autoCleanup(texture); const float width = texture->width; Loading @@ -489,6 +492,7 @@ void OpenGLRenderer::drawPatch(SkBitmap* bitmap, Res_png_9patch* patch, } const Texture* texture = mTextureCache.get(bitmap); if (!texture) return; const AutoTexture autoCleanup(texture); int alpha; Loading Loading @@ -617,6 +621,7 @@ void OpenGLRenderer::drawPath(SkPath* path, SkPaint* paint) { glActiveTexture(gTextureUnits[textureUnit]); const PathTexture* texture = mPathCache.get(path, paint); if (!texture) return; const AutoTexture autoCleanup(texture); int alpha; Loading
libs/hwui/PathCache.cpp +15 −2 Original line number Diff line number Diff line Loading @@ -34,6 +34,10 @@ PathCache::PathCache(uint32_t maxByteSize): mCache(GenerationCache<PathCacheEntry, PathTexture*>::kUnlimitedCapacity), mSize(0), mMaxSize(maxByteSize) { mCache.setOnEntryRemovedListener(this); GLint maxTextureSize; glGetIntegerv(GL_MAX_TEXTURE_SIZE, &maxTextureSize); mMaxTextureSize = maxTextureSize; } PathCache::~PathCache() { Loading Loading @@ -94,9 +98,18 @@ PathTexture* PathCache::get(SkPath* path, SkPaint* paint) { PathTexture* PathCache::addTexture(const PathCacheEntry& entry, const SkPath *path, const SkPaint* paint) { const SkRect& bounds = path->getBounds(); const float pathWidth = bounds.width(); const float pathHeight = bounds.height(); if (pathWidth > mMaxTextureSize || pathHeight > mMaxTextureSize) { LOGW("Path too large to be rendered into a texture"); return NULL; } const float offset = entry.strokeWidth * 1.5f; const uint32_t width = uint32_t(bounds.width() + offset * 2.0 + 0.5); const uint32_t height = uint32_t(bounds.height() + offset * 2.0 + 0.5); const uint32_t width = uint32_t(pathWidth + offset * 2.0 + 0.5); const uint32_t height = uint32_t(pathHeight + offset * 2.0 + 0.5); const uint32_t size = width * height; // Don't even try to cache a bitmap that's bigger than the cache Loading
libs/hwui/PathCache.h +1 −0 Original line number Diff line number Diff line Loading @@ -139,6 +139,7 @@ private: uint32_t mSize; uint32_t mMaxSize; GLuint mMaxTextureSize; }; // class PathCache }; // namespace uirenderer Loading