Index: samplecode/SampleGradients.cpp |
diff --git a/samplecode/SampleGradients.cpp b/samplecode/SampleGradients.cpp |
index f328d761a5ef9c019ff21349b4b49da67c8127bf..fead71473fee1b0016c3496f26e1ca68893c8847 100644 |
--- a/samplecode/SampleGradients.cpp |
+++ b/samplecode/SampleGradients.cpp |
@@ -13,7 +13,8 @@ |
static SkShader* setgrad(const SkRect& r, SkColor c0, SkColor c1) { |
SkColor colors[] = { c0, c1 }; |
SkPoint pts[] = { { r.fLeft, r.fTop }, { r.fRight, r.fTop } }; |
- return SkGradientShader::CreateLinear(pts, colors, NULL, 2, SkShader::kClamp_TileMode); |
+ return SkGradientShader::CreateLinear(pts, colors, NULL, 2, |
+ SkShader::kClamp_TileMode, NULL); |
} |
static void test_alphagradients(SkCanvas* canvas) { |
@@ -63,26 +64,32 @@ |
{ 5, gColors, gPos2 } |
}; |
-static SkShader* MakeLinear(const SkPoint pts[2], const GradData& data, SkShader::TileMode tm) { |
- return SkGradientShader::CreateLinear(pts, data.fColors, data.fPos, data.fCount, tm); |
+static SkShader* MakeLinear(const SkPoint pts[2], const GradData& data, |
+ SkShader::TileMode tm, SkUnitMapper* mapper) { |
+ return SkGradientShader::CreateLinear(pts, data.fColors, data.fPos, |
+ data.fCount, tm, mapper); |
} |
-static SkShader* MakeRadial(const SkPoint pts[2], const GradData& data, SkShader::TileMode tm) { |
+static SkShader* MakeRadial(const SkPoint pts[2], const GradData& data, |
+ SkShader::TileMode tm, SkUnitMapper* mapper) { |
SkPoint center; |
center.set(SkScalarAve(pts[0].fX, pts[1].fX), |
SkScalarAve(pts[0].fY, pts[1].fY)); |
return SkGradientShader::CreateRadial(center, center.fX, data.fColors, |
- data.fPos, data.fCount, tm); |
+ data.fPos, data.fCount, tm, mapper); |
} |
-static SkShader* MakeSweep(const SkPoint pts[2], const GradData& data, SkShader::TileMode tm) { |
+static SkShader* MakeSweep(const SkPoint pts[2], const GradData& data, |
+ SkShader::TileMode tm, SkUnitMapper* mapper) { |
SkPoint center; |
center.set(SkScalarAve(pts[0].fX, pts[1].fX), |
SkScalarAve(pts[0].fY, pts[1].fY)); |
- return SkGradientShader::CreateSweep(center.fX, center.fY, data.fColors, data.fPos, data.fCount); |
+ return SkGradientShader::CreateSweep(center.fX, center.fY, data.fColors, |
+ data.fPos, data.fCount, mapper); |
} |
-static SkShader* Make2Radial(const SkPoint pts[2], const GradData& data, SkShader::TileMode tm) { |
+static SkShader* Make2Radial(const SkPoint pts[2], const GradData& data, |
+ SkShader::TileMode tm, SkUnitMapper* mapper) { |
SkPoint center0, center1; |
center0.set(SkScalarAve(pts[0].fX, pts[1].fX), |
SkScalarAve(pts[0].fY, pts[1].fY)); |
@@ -91,22 +98,22 @@ |
return SkGradientShader::CreateTwoPointRadial( |
center1, (pts[1].fX - pts[0].fX) / 7, |
center0, (pts[1].fX - pts[0].fX) / 2, |
- data.fColors, data.fPos, data.fCount, tm); |
+ data.fColors, data.fPos, data.fCount, tm, mapper); |
} |
static SkShader* Make2RadialConcentric(const SkPoint pts[2], const GradData& data, |
- SkShader::TileMode tm) { |
+ SkShader::TileMode tm, SkUnitMapper* mapper) { |
SkPoint center; |
center.set(SkScalarAve(pts[0].fX, pts[1].fX), |
SkScalarAve(pts[0].fY, pts[1].fY)); |
return SkGradientShader::CreateTwoPointRadial( |
center, (pts[1].fX - pts[0].fX) / 7, |
center, (pts[1].fX - pts[0].fX) / 2, |
- data.fColors, data.fPos, data.fCount, tm); |
+ data.fColors, data.fPos, data.fCount, tm, mapper); |
} |
-typedef SkShader* (*GradMaker)(const SkPoint pts[2], const GradData& data, SkShader::TileMode tm); |
- |
+typedef SkShader* (*GradMaker)(const SkPoint pts[2], const GradData& data, |
+ SkShader::TileMode tm, SkUnitMapper* mapper); |
static const GradMaker gGradMakers[] = { |
MakeLinear, MakeRadial, MakeSweep, Make2Radial, Make2RadialConcentric |
}; |
@@ -147,7 +154,7 @@ |
canvas->save(); |
for (size_t j = 0; j < SK_ARRAY_COUNT(gGradMakers); j++) { |
SkShader* shader; |
- shader = gGradMakers[j](pts, gGradData[i], (SkShader::TileMode)tm); |
+ shader = gGradMakers[j](pts, gGradData[i], (SkShader::TileMode)tm, NULL); |
paint.setShader(shader)->unref(); |
canvas->drawRect(r, paint); |
canvas->translate(0, SkIntToScalar(120)); |