Loading libs/hwui/GenerationCache.h +4 −4 Original line number Diff line number Diff line Loading @@ -33,7 +33,7 @@ public: template<typename K, typename V> class GenerationCache { public: GenerationCache(unsigned int maxCapacity): mMaxCapacity(maxCapacity), mListener(NULL) { }; GenerationCache(uint32_t maxCapacity): mMaxCapacity(maxCapacity), mListener(NULL) { }; ~GenerationCache() { clear(); }; enum Capacity { Loading @@ -50,7 +50,7 @@ public: V* remove(K* key); void removeOldest(); unsigned int size() const; uint32_t size() const; private: template<typename EntryKey, typename EntryValue> Loading @@ -72,7 +72,7 @@ private: void attachToCache(sp<Entry<K*, V*> > entry); void detachFromCache(sp<Entry<K*, V*> > entry); unsigned int mMaxCapacity; uint32_t mMaxCapacity; OnEntryRemoved<K*, V*>* mListener; Loading @@ -83,7 +83,7 @@ private: }; // class GenerationCache template<typename K, typename V> unsigned int GenerationCache<K, V>::size() const { uint32_t GenerationCache<K, V>::size() const { return mCache.size(); } Loading libs/hwui/OpenGLRenderer.cpp +0 −2 Original line number Diff line number Diff line Loading @@ -411,8 +411,6 @@ bool OpenGLRenderer::clipRect(float left, float top, float right, float bottom) void OpenGLRenderer::drawBitmap(SkBitmap* bitmap, float left, float top, const SkPaint* paint) { const Texture* texture = mTextureCache.get(bitmap); LOGD("Texture cache size %d", mTextureCache.getSize()); LOGD(" max size %d", mTextureCache.getMaxSize()); int alpha; SkXfermode::Mode mode; Loading libs/hwui/Texture.h +2 −2 Original line number Diff line number Diff line Loading @@ -41,11 +41,11 @@ struct Texture { /** * Width of the backing bitmap. */ unsigned int width; uint32_t width; /** * Height of the backing bitmap. */ unsigned int height; uint32_t height; }; // struct Texture }; // namespace uirenderer Loading libs/hwui/TextureCache.cpp +6 −6 Original line number Diff line number Diff line Loading @@ -27,7 +27,7 @@ namespace uirenderer { // Constructors/destructor /////////////////////////////////////////////////////////////////////////////// TextureCache::TextureCache(unsigned int maxByteSize): TextureCache::TextureCache(uint32_t maxByteSize): mCache(GenerationCache<SkBitmap, Texture>::kUnlimitedCapacity), mSize(0), mMaxSize(maxByteSize) { mCache.setOnEntryRemovedListener(this); Loading @@ -41,15 +41,15 @@ TextureCache::~TextureCache() { // Size management /////////////////////////////////////////////////////////////////////////////// unsigned int TextureCache::getSize() { uint32_t TextureCache::getSize() { return mSize; } unsigned int TextureCache::getMaxSize() { uint32_t TextureCache::getMaxSize() { return mMaxSize; } void TextureCache::setMaxSize(unsigned int maxSize) { void TextureCache::setMaxSize(uint32_t maxSize) { mMaxSize = maxSize; while (mSize > mMaxSize) { mCache.removeOldest(); Loading @@ -62,7 +62,7 @@ void TextureCache::setMaxSize(unsigned int maxSize) { void TextureCache::operator()(SkBitmap* bitmap, Texture* texture) { if (bitmap) { const unsigned int size = bitmap->rowBytes() * bitmap->height(); const uint32_t size = bitmap->rowBytes() * bitmap->height(); mSize -= size; } Loading @@ -79,7 +79,7 @@ void TextureCache::operator()(SkBitmap* bitmap, Texture* texture) { Texture* TextureCache::get(SkBitmap* bitmap) { Texture* texture = mCache.get(bitmap); if (!texture) { const unsigned int size = bitmap->rowBytes() * bitmap->height(); const uint32_t size = bitmap->rowBytes() * bitmap->height(); // Don't even try to cache a bitmap that's bigger than the cache if (size < mMaxSize) { while (mSize + size > mMaxSize) { Loading libs/hwui/TextureCache.h +6 −6 Original line number Diff line number Diff line Loading @@ -32,7 +32,7 @@ namespace uirenderer { */ class TextureCache: public OnEntryRemoved<SkBitmap*, Texture*> { public: TextureCache(unsigned int maxByteSize); TextureCache(uint32_t maxByteSize); ~TextureCache(); /** Loading @@ -59,15 +59,15 @@ public: /** * Sets the maximum size of the cache in bytes. */ void setMaxSize(unsigned int maxSize); void setMaxSize(uint32_t maxSize); /** * Returns the maximum size of the cache in bytes. */ unsigned int getMaxSize(); uint32_t getMaxSize(); /** * Returns the current size of the cache in bytes. */ unsigned int getSize(); uint32_t getSize(); private: /** Loading @@ -80,8 +80,8 @@ private: GenerationCache<SkBitmap, Texture> mCache; unsigned int mSize; unsigned int mMaxSize; uint32_t mSize; uint32_t mMaxSize; }; // class TextureCache }; // namespace uirenderer Loading Loading
libs/hwui/GenerationCache.h +4 −4 Original line number Diff line number Diff line Loading @@ -33,7 +33,7 @@ public: template<typename K, typename V> class GenerationCache { public: GenerationCache(unsigned int maxCapacity): mMaxCapacity(maxCapacity), mListener(NULL) { }; GenerationCache(uint32_t maxCapacity): mMaxCapacity(maxCapacity), mListener(NULL) { }; ~GenerationCache() { clear(); }; enum Capacity { Loading @@ -50,7 +50,7 @@ public: V* remove(K* key); void removeOldest(); unsigned int size() const; uint32_t size() const; private: template<typename EntryKey, typename EntryValue> Loading @@ -72,7 +72,7 @@ private: void attachToCache(sp<Entry<K*, V*> > entry); void detachFromCache(sp<Entry<K*, V*> > entry); unsigned int mMaxCapacity; uint32_t mMaxCapacity; OnEntryRemoved<K*, V*>* mListener; Loading @@ -83,7 +83,7 @@ private: }; // class GenerationCache template<typename K, typename V> unsigned int GenerationCache<K, V>::size() const { uint32_t GenerationCache<K, V>::size() const { return mCache.size(); } Loading
libs/hwui/OpenGLRenderer.cpp +0 −2 Original line number Diff line number Diff line Loading @@ -411,8 +411,6 @@ bool OpenGLRenderer::clipRect(float left, float top, float right, float bottom) void OpenGLRenderer::drawBitmap(SkBitmap* bitmap, float left, float top, const SkPaint* paint) { const Texture* texture = mTextureCache.get(bitmap); LOGD("Texture cache size %d", mTextureCache.getSize()); LOGD(" max size %d", mTextureCache.getMaxSize()); int alpha; SkXfermode::Mode mode; Loading
libs/hwui/Texture.h +2 −2 Original line number Diff line number Diff line Loading @@ -41,11 +41,11 @@ struct Texture { /** * Width of the backing bitmap. */ unsigned int width; uint32_t width; /** * Height of the backing bitmap. */ unsigned int height; uint32_t height; }; // struct Texture }; // namespace uirenderer Loading
libs/hwui/TextureCache.cpp +6 −6 Original line number Diff line number Diff line Loading @@ -27,7 +27,7 @@ namespace uirenderer { // Constructors/destructor /////////////////////////////////////////////////////////////////////////////// TextureCache::TextureCache(unsigned int maxByteSize): TextureCache::TextureCache(uint32_t maxByteSize): mCache(GenerationCache<SkBitmap, Texture>::kUnlimitedCapacity), mSize(0), mMaxSize(maxByteSize) { mCache.setOnEntryRemovedListener(this); Loading @@ -41,15 +41,15 @@ TextureCache::~TextureCache() { // Size management /////////////////////////////////////////////////////////////////////////////// unsigned int TextureCache::getSize() { uint32_t TextureCache::getSize() { return mSize; } unsigned int TextureCache::getMaxSize() { uint32_t TextureCache::getMaxSize() { return mMaxSize; } void TextureCache::setMaxSize(unsigned int maxSize) { void TextureCache::setMaxSize(uint32_t maxSize) { mMaxSize = maxSize; while (mSize > mMaxSize) { mCache.removeOldest(); Loading @@ -62,7 +62,7 @@ void TextureCache::setMaxSize(unsigned int maxSize) { void TextureCache::operator()(SkBitmap* bitmap, Texture* texture) { if (bitmap) { const unsigned int size = bitmap->rowBytes() * bitmap->height(); const uint32_t size = bitmap->rowBytes() * bitmap->height(); mSize -= size; } Loading @@ -79,7 +79,7 @@ void TextureCache::operator()(SkBitmap* bitmap, Texture* texture) { Texture* TextureCache::get(SkBitmap* bitmap) { Texture* texture = mCache.get(bitmap); if (!texture) { const unsigned int size = bitmap->rowBytes() * bitmap->height(); const uint32_t size = bitmap->rowBytes() * bitmap->height(); // Don't even try to cache a bitmap that's bigger than the cache if (size < mMaxSize) { while (mSize + size > mMaxSize) { Loading
libs/hwui/TextureCache.h +6 −6 Original line number Diff line number Diff line Loading @@ -32,7 +32,7 @@ namespace uirenderer { */ class TextureCache: public OnEntryRemoved<SkBitmap*, Texture*> { public: TextureCache(unsigned int maxByteSize); TextureCache(uint32_t maxByteSize); ~TextureCache(); /** Loading @@ -59,15 +59,15 @@ public: /** * Sets the maximum size of the cache in bytes. */ void setMaxSize(unsigned int maxSize); void setMaxSize(uint32_t maxSize); /** * Returns the maximum size of the cache in bytes. */ unsigned int getMaxSize(); uint32_t getMaxSize(); /** * Returns the current size of the cache in bytes. */ unsigned int getSize(); uint32_t getSize(); private: /** Loading @@ -80,8 +80,8 @@ private: GenerationCache<SkBitmap, Texture> mCache; unsigned int mSize; unsigned int mMaxSize; uint32_t mSize; uint32_t mMaxSize; }; // class TextureCache }; // namespace uirenderer Loading