Index: src/image/SkImage_Generator.cpp |
diff --git a/src/image/SkImage_Generator.cpp b/src/image/SkImage_Generator.cpp |
index 1c1b26337178aa1965058a8fb0121ef73fd85c25..765234fa0c0e1757487220b99f1d1b2fdfc39706 100644 |
--- a/src/image/SkImage_Generator.cpp |
+++ b/src/image/SkImage_Generator.cpp |
@@ -28,6 +28,11 @@ |
SkImage* onNewSubset(const SkIRect&) const override; |
bool getROPixels(SkBitmap*) const override; |
GrTexture* asTextureRef(GrContext*, SkImageUsageType) const override; |
+ |
+ SkShader* onNewShader(SkShader::TileMode, |
+ SkShader::TileMode, |
+ const SkMatrix* localMatrix) const override; |
+ |
bool onIsLazyGenerated() const override { return true; } |
private: |
@@ -37,6 +42,17 @@ |
}; |
/////////////////////////////////////////////////////////////////////////////// |
+ |
+SkShader* SkImage_Generator::onNewShader(SkShader::TileMode tileX, SkShader::TileMode tileY, |
+ const SkMatrix* localMatrix) const { |
+ // TODO: need a native Shader that takes Cacherator (or this image) so we can natively return |
+ // textures as output from the shader. |
+ SkBitmap bm; |
+ if (this->getROPixels(&bm)) { |
+ return SkShader::CreateBitmapShader(bm, tileX, tileY, localMatrix); |
+ } |
+ return nullptr; |
+} |
bool SkImage_Generator::onReadPixels(const SkImageInfo& dstInfo, void* dstPixels, size_t dstRB, |
int srcX, int srcY) const { |