@@ -76,10 +76,20 @@ class TextureCache : public OnEntryRemoved<uint32_t, Texture*> {
7676 bool prefetchAndMarkInUse (const SkBitmap* bitmap);
7777
7878 /* *
79- * Returns the texture associated with the specified bitmap. If the texture
80- * cannot be found in the cache, a new texture is generated.
79+ * Returns the texture associated with the specified bitmap from either within the cache, or
80+ * the AssetAtlas. If the texture cannot be found in the cache, a new texture is generated.
8181 */
82- Texture* get (const SkBitmap* bitmap);
82+ Texture* get (const SkBitmap* bitmap) {
83+ return get (bitmap, AtlasUsageType::Use);
84+ }
85+
86+ /* *
87+ * Returns the texture associated with the specified bitmap. If the texture cannot be found in
88+ * the cache, a new texture is generated, even if it resides in the AssetAtlas.
89+ */
90+ Texture* getAndBypassAtlas (const SkBitmap* bitmap) {
91+ return get (bitmap, AtlasUsageType::Bypass);
92+ }
8393
8494 /* *
8595 * Removes the texture associated with the specified pixelRef. This is meant
@@ -123,10 +133,15 @@ class TextureCache : public OnEntryRemoved<uint32_t, Texture*> {
123133 void setAssetAtlas (AssetAtlas* assetAtlas);
124134
125135private:
136+ enum class AtlasUsageType {
137+ Use,
138+ Bypass,
139+ };
126140
127141 bool canMakeTextureFromBitmap (const SkBitmap* bitmap);
128142
129- Texture* getCachedTexture (const SkBitmap* bitmap);
143+ Texture* get (const SkBitmap* bitmap, AtlasUsageType atlasUsageType);
144+ Texture* getCachedTexture (const SkBitmap* bitmap, AtlasUsageType atlasUsageType);
130145
131146 /* *
132147 * Generates the texture from a bitmap into the specified texture structure.
0 commit comments