From 0b93e3149d2cb30860c51f9f3204ae811d9a97ca Mon Sep 17 00:00:00 2001 From: reed Date: Fri, 18 Sep 2015 08:26:25 -0700 Subject: add ImageShader, sharing code with its Bitmap cousin This is done by having abstracted the BitmapShaderContext to take a BitmapProvider, instead of just a bitmap. This allows us to share all of that code between SkBitmap and SkImage, since both are valid providers. It also means that we can simplify SkImage_Base to not need a virtual for onNewShader, since ALL images can uniformly be turned into a shader now. BUG=skia: Review URL: https://codereview.chromium.org/1342113002 --- src/image/SkImage_Generator.cpp | 16 ---------------- 1 file changed, 16 deletions(-) (limited to 'src/image/SkImage_Generator.cpp') diff --git a/src/image/SkImage_Generator.cpp b/src/image/SkImage_Generator.cpp index 0f1fa3692c..f0bf7e3641 100644 --- a/src/image/SkImage_Generator.cpp +++ b/src/image/SkImage_Generator.cpp @@ -28,11 +28,6 @@ public: 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: @@ -43,17 +38,6 @@ private: /////////////////////////////////////////////////////////////////////////////// -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 { return SkSurface::NewRaster(info, &props); -- cgit v1.2.3