diff options
Diffstat (limited to 'libs/hwui/TextureCache.h')
-rw-r--r-- | libs/hwui/TextureCache.h | 23 |
1 files changed, 19 insertions, 4 deletions
diff --git a/libs/hwui/TextureCache.h b/libs/hwui/TextureCache.h index e7fc990a6588..83c6e91ec55c 100644 --- a/libs/hwui/TextureCache.h +++ b/libs/hwui/TextureCache.h @@ -76,10 +76,20 @@ public: bool prefetchAndMarkInUse(const SkBitmap* bitmap); /** - * Returns the texture associated with the specified bitmap. If the texture - * cannot be found in the cache, a new texture is generated. + * Returns the texture associated with the specified bitmap from either within the cache, or + * the AssetAtlas. If the texture cannot be found in the cache, a new texture is generated. */ - Texture* get(const SkBitmap* bitmap); + Texture* get(const SkBitmap* bitmap) { + return get(bitmap, AtlasUsageType::Use); + } + + /** + * Returns the texture associated with the specified bitmap. If the texture cannot be found in + * the cache, a new texture is generated, even if it resides in the AssetAtlas. + */ + Texture* getAndBypassAtlas(const SkBitmap* bitmap) { + return get(bitmap, AtlasUsageType::Bypass); + } /** * Removes the texture associated with the specified pixelRef. This is meant @@ -123,10 +133,15 @@ public: void setAssetAtlas(AssetAtlas* assetAtlas); private: + enum class AtlasUsageType { + Use, + Bypass, + }; bool canMakeTextureFromBitmap(const SkBitmap* bitmap); - Texture* getCachedTexture(const SkBitmap* bitmap); + Texture* get(const SkBitmap* bitmap, AtlasUsageType atlasUsageType); + Texture* getCachedTexture(const SkBitmap* bitmap, AtlasUsageType atlasUsageType); /** * Generates the texture from a bitmap into the specified texture structure. |