Move SkShader::fLocalMatrix into SkShader constructor.
As a first step towards removing SkShader::setLocalMatrix, which will make
SkShader thread-safe, remove calls to setLocalMatrix that happen immediately
after the shader is being created. Instead, pass the matrix into the constructor
or factory method.
BUG=skia:1976
R=scroggo@google.com, reed@google.com, skyostil@google.com, mtklein@google.com
Author: dominikg@chromium.org
Review URL: https://codereview.chromium.org/245963010
git-svn-id: http://skia.googlecode.com/svn/trunk@14401 2bbb7eff-a529-9590-31e7-b0007b416f81
diff --git a/gm/drawbitmaprect.cpp b/gm/drawbitmaprect.cpp
index 92e0c38..3cc9026 100644
--- a/gm/drawbitmaprect.cpp
+++ b/gm/drawbitmaprect.cpp
@@ -55,15 +55,15 @@
SK_Scalar1};
SkPaint paint;
- paint.setShader(SkGradientShader::CreateRadial(
- pt, radius,
- colors, pos,
- SK_ARRAY_COUNT(colors),
- SkShader::kRepeat_TileMode))->unref();
SkRect rect = SkRect::MakeWH(wScalar, hScalar);
SkMatrix mat = SkMatrix::I();
for (int i = 0; i < 4; ++i) {
- paint.getShader()->setLocalMatrix(mat);
+ paint.setShader(SkGradientShader::CreateRadial(
+ pt, radius,
+ colors, pos,
+ SK_ARRAY_COUNT(colors),
+ SkShader::kRepeat_TileMode,
+ NULL, 0, &mat))->unref();
canvas.drawRect(rect, paint);
rect.inset(wScalar / 8, hScalar / 8);
mat.postScale(SK_Scalar1 / 4, SK_Scalar1 / 4);