Fix AssetAtlas usage in BitmapShaders
bug:22521999
Change-Id: I60859748ceee19ebc89ec98845e550ea26e36ecd
diff --git a/libs/hwui/TextureCache.h b/libs/hwui/TextureCache.h
index e7fc990..83c6e91 100644
--- a/libs/hwui/TextureCache.h
+++ b/libs/hwui/TextureCache.h
@@ -76,10 +76,20 @@
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 @@
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.