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/gpu/SkGpuDevice.h b/src/gpu/SkGpuDevice.h
index 5f876a3..2e8d14e 100644
--- a/src/gpu/SkGpuDevice.h
+++ b/src/gpu/SkGpuDevice.h
@@ -194,6 +194,13 @@
*/
// The tileSize and clippedSrcRect will be valid only if true is returned.
+ bool shouldTileImageID(uint32_t imageID, const SkIRect& imageRect,
+ const SkMatrix& viewMatrix,
+ const GrTextureParams& params,
+ const SkRect* srcRectPtr,
+ int maxTileSize,
+ int* tileSize,
+ SkIRect* clippedSubset) const;
bool shouldTileBitmap(const SkBitmap& bitmap,
const SkMatrix& viewMatrix,
const GrTextureParams& sampler,
@@ -201,6 +208,12 @@
int maxTileSize,
int* tileSize,
SkIRect* clippedSrcRect) const;
+ // Just returns the predicate, not the out-tileSize or out-clippedSubset, as they are not
+ // needed at the moment.
+ bool shouldTileImage(const SkImage* image, const SkRect* srcRectPtr,
+ SkCanvas::SrcRectConstraint constraint, SkFilterQuality quality,
+ const SkMatrix& viewMatrix) const;
+
void internalDrawBitmap(const SkBitmap&,
const SkMatrix& viewMatrix,
const SkRect&,