diff options
author | piotaixr <piotaixr@chromium.org> | 2014-07-22 15:02:05 -0700 |
---|---|---|
committer | Commit bot <commit-bot@chromium.org> | 2014-07-22 15:02:05 -0700 |
commit | 76d5b477c92ef076374fc7ea9d551c798656bebd (patch) | |
tree | 2afc05ee8510aa022cdac0deae9d32d1a6b4e7eb /src | |
parent | 85d36525c613c6c94e1f1c5dc51c1a2f73a0bc9c (diff) |
Now able to set the localMatrix when creating a SkShader from a SkImage
BUG=skia:2771
R=junov@chromium.org, reed@chromium.org, bsalomon@chromium.org, bsalomon@google.com
Author: piotaixr@chromium.org
Review URL: https://codereview.chromium.org/409653003
Diffstat (limited to 'src')
-rw-r--r-- | src/image/SkImage.cpp | 6 | ||||
-rw-r--r-- | src/image/SkImage_Base.h | 4 | ||||
-rw-r--r-- | src/image/SkImage_Gpu.cpp | 11 | ||||
-rw-r--r-- | src/image/SkImage_Raster.cpp | 11 |
4 files changed, 23 insertions, 9 deletions
diff --git a/src/image/SkImage.cpp b/src/image/SkImage.cpp index 9e136f5a27..c812f58eff 100644 --- a/src/image/SkImage.cpp +++ b/src/image/SkImage.cpp @@ -78,8 +78,10 @@ GrTexture* SkImage::getTexture() { return as_IB(this)->onGetTexture(); } -SkShader* SkImage::newShader(SkShader::TileMode tileX, SkShader::TileMode tileY) const { - return as_IB(this)->onNewShader(tileX, tileY); +SkShader* SkImage::newShader(SkShader::TileMode tileX, + SkShader::TileMode tileY, + const SkMatrix* localMatrix) const { + return as_IB(this)->onNewShader(tileX, tileY, localMatrix); } SkData* SkImage::encode(SkImageEncoder::Type type, int quality) const { diff --git a/src/image/SkImage_Base.h b/src/image/SkImage_Base.h index 1a54157b8e..752afedc09 100644 --- a/src/image/SkImage_Base.h +++ b/src/image/SkImage_Base.h @@ -31,7 +31,9 @@ public: // but only inspect them (or encode them). virtual bool getROPixels(SkBitmap*) const { return false; } - virtual SkShader* onNewShader(SkShader::TileMode, SkShader::TileMode) const { return NULL; }; + virtual SkShader* onNewShader(SkShader::TileMode, + SkShader::TileMode, + const SkMatrix* localMatrix) const { return NULL; }; private: typedef SkImage INHERITED; }; diff --git a/src/image/SkImage_Gpu.cpp b/src/image/SkImage_Gpu.cpp index 7a73c7453b..81114b0fe8 100644 --- a/src/image/SkImage_Gpu.cpp +++ b/src/image/SkImage_Gpu.cpp @@ -27,7 +27,9 @@ public: GrTexture* getTexture() { return fBitmap.getTexture(); } - virtual SkShader* onNewShader(SkShader::TileMode, SkShader::TileMode) const SK_OVERRIDE; + virtual SkShader* onNewShader(SkShader::TileMode, + SkShader::TileMode, + const SkMatrix* localMatrix) const SK_OVERRIDE; private: SkBitmap fBitmap; @@ -45,8 +47,11 @@ SkImage_Gpu::SkImage_Gpu(const SkBitmap& bitmap) SkImage_Gpu::~SkImage_Gpu() { } -SkShader* SkImage_Gpu::onNewShader(SkShader::TileMode tileX, SkShader::TileMode tileY) const { - return SkShader::CreateBitmapShader(fBitmap, tileX, tileY, NULL); +SkShader* SkImage_Gpu::onNewShader(SkShader::TileMode tileX, + SkShader::TileMode tileY, + const SkMatrix* localMatrix) const +{ + return SkShader::CreateBitmapShader(fBitmap, tileX, tileY, localMatrix); } void SkImage_Gpu::onDraw(SkCanvas* canvas, SkScalar x, SkScalar y, diff --git a/src/image/SkImage_Raster.cpp b/src/image/SkImage_Raster.cpp index 464a4ba7a4..828d80276c 100644 --- a/src/image/SkImage_Raster.cpp +++ b/src/image/SkImage_Raster.cpp @@ -64,7 +64,9 @@ public: SkPixelRef* getPixelRef() const { return fBitmap.pixelRef(); } - virtual SkShader* onNewShader(SkShader::TileMode, SkShader::TileMode) const SK_OVERRIDE; + virtual SkShader* onNewShader(SkShader::TileMode, + SkShader::TileMode, + const SkMatrix* localMatrix) const SK_OVERRIDE; private: SkImage_Raster() : INHERITED(0, 0) {} @@ -113,8 +115,11 @@ SkImage_Raster::SkImage_Raster(const Info& info, SkPixelRef* pr, size_t rowBytes SkImage_Raster::~SkImage_Raster() {} -SkShader* SkImage_Raster::onNewShader(SkShader::TileMode tileX, SkShader::TileMode tileY) const { - return SkShader::CreateBitmapShader(fBitmap, tileX, tileY, NULL); +SkShader* SkImage_Raster::onNewShader(SkShader::TileMode tileX, + SkShader::TileMode tileY, + const SkMatrix* localMatrix) const +{ + return SkShader::CreateBitmapShader(fBitmap, tileX, tileY, localMatrix); } void SkImage_Raster::onDraw(SkCanvas* canvas, SkScalar x, SkScalar y, const SkPaint* paint) { |