Use SkImageCacherator in SkImages
Possible follow-up changes to consider
1. Roll SkImage_Raster and _Gpu into _Generator, where the generator (or cacherator) is backed by a pre-existing texture or raster.
2. Evolve SkImageUsageType into a verb requiring stretching, and have the caller (common code) digest the caps() and usage, so that subclasses are just told what to do (stretch or not)
3. Common code/utility to convert an unstretched texture into a stretch one (and cache it) if the generator can only make an unstretched one.
BUG=skia:
Review URL: https://codereview.chromium.org/1282363002
diff --git a/src/image/SkImage_Gpu.h b/src/image/SkImage_Gpu.h
index 9481690..d168fb6 100644
--- a/src/image/SkImage_Gpu.h
+++ b/src/image/SkImage_Gpu.h
@@ -37,7 +37,9 @@
}
bool getROPixels(SkBitmap*) const override;
- GrTexture* getTexture() const override { return fTexture; }
+ GrTexture* asTextureRef(GrContext* ctx, SkImageUsageType usage) const override;
+
+ GrTexture* peekTexture() const override { return fTexture; }
SkShader* onNewShader(SkShader::TileMode,
SkShader::TileMode,
const SkMatrix* localMatrix) const override;