Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(97)

Unified Diff: src/image/SkImage_Generator.cpp

Issue 1355863002: Revert of add ImageShader, sharing code with its Bitmap cousin (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: Created 5 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « src/image/SkImage_Base.h ('k') | src/image/SkImage_Gpu.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 {
« no previous file with comments | « src/image/SkImage_Base.h ('k') | src/image/SkImage_Gpu.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698