Index: src/image/SkImage_Generator.cpp |
diff --git a/src/image/SkImage_Generator.cpp b/src/image/SkImage_Generator.cpp |
index f0bf7e364144db8b9106fe1223d176d41017d281..0f1fa3692c8e3dd7a88b46acdc74642555a16e54 100644 |
--- a/src/image/SkImage_Generator.cpp |
+++ b/src/image/SkImage_Generator.cpp |
@@ -28,6 +28,11 @@ |
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; |
+} |
SkSurface* SkImage_Generator::onNewSurface(const SkImageInfo& info, |
const SkSurfaceProps& props) const { |