summaryrefslogtreecommitdiff
path: root/core/SkDraw.cpp
diff options
context:
space:
mode:
authorBo Liu <boliu@google.com>2014-05-01 10:38:38 -0700
committerBo Liu <boliu@google.com>2014-05-01 10:38:38 -0700
commit27ab20dffff01006f5d20fdb2b3f4ea503d69114 (patch)
treef8a42f1186f835772ed0c20a7f9095392e124b04 /core/SkDraw.cpp
parent51512eaae8128a677f92e2689d8df720dca13d32 (diff)
parent2e8705638185600b128f867809b6cd034225451c (diff)
downloadsrc-27ab20dffff01006f5d20fdb2b3f4ea503d69114.tar.gz
Merge from Chromium at DEPS revision 267519idea133-weekly-release
This commit was generated by merge_to_master.py. Change-Id: Ic063600f0ecbd8d3c74d2d514eaf91c1a33c9f07
Diffstat (limited to 'core/SkDraw.cpp')
-rw-r--r--core/SkDraw.cpp13
1 files changed, 6 insertions, 7 deletions
diff --git a/core/SkDraw.cpp b/core/SkDraw.cpp
index 6ddd0d27..f9e06e52 100644
--- a/core/SkDraw.cpp
+++ b/core/SkDraw.cpp
@@ -72,11 +72,12 @@ private:
*/
class SkAutoBitmapShaderInstall : SkNoncopyable {
public:
- SkAutoBitmapShaderInstall(const SkBitmap& src, const SkPaint& paint)
+ SkAutoBitmapShaderInstall(const SkBitmap& src, const SkPaint& paint,
+ const SkMatrix* localMatrix = NULL)
: fPaint(paint) /* makes a copy of the paint */ {
fPaint.setShader(CreateBitmapShader(src, SkShader::kClamp_TileMode,
SkShader::kClamp_TileMode,
- &fAllocator));
+ localMatrix, &fAllocator));
// we deliberately left the shader with an owner-count of 2
SkASSERT(2 == fPaint.getShader()->getRefCnt());
}
@@ -1374,18 +1375,16 @@ void SkDraw::drawSprite(const SkBitmap& bitmap, int x, int y,
}
}
- SkAutoBitmapShaderInstall install(bitmap, paint);
- const SkPaint& shaderPaint = install.paintWithShader();
-
SkMatrix matrix;
SkRect r;
// get a scalar version of our rect
r.set(bounds);
- // tell the shader our offset
+ // create shader with offset
matrix.setTranslate(r.fLeft, r.fTop);
- shaderPaint.getShader()->setLocalMatrix(matrix);
+ SkAutoBitmapShaderInstall install(bitmap, paint, &matrix);
+ const SkPaint& shaderPaint = install.paintWithShader();
SkDraw draw(*this);
matrix.reset();