Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(457)

Unified Diff: gm/gradients.cpp

Issue 287063009: Revert of remove unused (by clients) SkUnitMapper (Closed) Base URL: https://skia.googlecode.com/svn/trunk
Patch Set: Created 6 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « gm/gradient_matrix.cpp ('k') | gm/gradients_2pt_conical.cpp » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: gm/gradients.cpp
diff --git a/gm/gradients.cpp b/gm/gradients.cpp
index 277033b5dd1d368e3f557c81441776ebcda0b66d..f5abb07efc235e93d9e239d75ffaf519ca9bb6ba 100644
--- a/gm/gradients.cpp
+++ b/gm/gradients.cpp
@@ -40,31 +40,35 @@
};
static SkShader* MakeLinear(const SkPoint pts[2], const GradData& data,
- SkShader::TileMode tm, const SkMatrix& localMatrix) {
+ SkShader::TileMode tm, SkUnitMapper* mapper,
+ const SkMatrix& localMatrix) {
return SkGradientShader::CreateLinear(pts, data.fColors, data.fPos,
- data.fCount, tm, 0, &localMatrix);
+ data.fCount, tm, mapper, 0, &localMatrix);
}
static SkShader* MakeRadial(const SkPoint pts[2], const GradData& data,
- SkShader::TileMode tm, const SkMatrix& localMatrix) {
+ SkShader::TileMode tm, SkUnitMapper* mapper,
+ const SkMatrix& localMatrix) {
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, 0, &localMatrix);
+ data.fPos, data.fCount, tm, mapper, 0, &localMatrix);
}
static SkShader* MakeSweep(const SkPoint pts[2], const GradData& data,
- SkShader::TileMode, const SkMatrix& localMatrix) {
+ SkShader::TileMode, SkUnitMapper* mapper,
+ const SkMatrix& localMatrix) {
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, 0, &localMatrix);
+ data.fPos, data.fCount, mapper, 0, &localMatrix);
}
static SkShader* Make2Radial(const SkPoint pts[2], const GradData& data,
- SkShader::TileMode tm, const SkMatrix& localMatrix) {
+ SkShader::TileMode tm, SkUnitMapper* mapper,
+ const SkMatrix& localMatrix) {
SkPoint center0, center1;
center0.set(SkScalarAve(pts[0].fX, pts[1].fX),
SkScalarAve(pts[0].fY, pts[1].fY));
@@ -73,12 +77,13 @@
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,
0, &localMatrix);
}
static SkShader* Make2Conical(const SkPoint pts[2], const GradData& data,
- SkShader::TileMode tm, const SkMatrix& localMatrix) {
+ SkShader::TileMode tm, SkUnitMapper* mapper,
+ const SkMatrix& localMatrix) {
SkPoint center0, center1;
SkScalar radius0 = SkScalarDiv(pts[1].fX - pts[0].fX, 10);
SkScalar radius1 = SkScalarDiv(pts[1].fX - pts[0].fX, 3);
@@ -87,11 +92,13 @@
return SkGradientShader::CreateTwoPointConical(center1, radius1,
center0, radius0,
data.fColors, data.fPos,
- data.fCount, tm, 0, &localMatrix);
+ data.fCount, tm, mapper,
+ 0, &localMatrix);
}
typedef SkShader* (*GradMaker)(const SkPoint pts[2], const GradData& data,
- SkShader::TileMode tm, const SkMatrix& localMatrix);
+ SkShader::TileMode tm, SkUnitMapper* mapper,
+ const SkMatrix& localMatrix);
static const GradMaker gGradMakers[] = {
MakeLinear, MakeRadial, MakeSweep, Make2Radial, Make2Conical
};
@@ -137,7 +144,7 @@
scale.postTranslate(25.f, 25.f);
}
- SkShader* shader = gGradMakers[j](pts, gGradData[i], tm, scale);
+ SkShader* shader = gGradMakers[j](pts, gGradData[i], tm, NULL, scale);
paint.setShader(shader);
canvas->drawRect(r, paint);
@@ -195,7 +202,7 @@
perspective.setSkewX(SkScalarDiv(SkIntToScalar((unsigned) i+1),
SkIntToScalar(10)));
- SkShader* shader = gGradMakers[j](pts, gGradData[i], tm, perspective);
+ SkShader* shader = gGradMakers[j](pts, gGradData[i], tm, NULL, perspective);
paint.setShader(shader);
canvas->drawRect(r, paint);
@@ -320,7 +327,7 @@
SkShader* shader = SkGradientShader::CreateRadial(
SkPoint(center),
SkIntToScalar(200), gColors, NULL, 5,
- SkShader::kClamp_TileMode);
+ SkShader::kClamp_TileMode, NULL);
paint.setShader(shader);
canvas->drawRect(r, paint);
shader->unref();
@@ -415,17 +422,17 @@
SkAutoTUnref<SkShader> sweep(
SkGradientShader::CreateSweep(cx, cy, sweep_colors,
NULL, SK_ARRAY_COUNT(sweep_colors),
- flags[i], NULL));
+ NULL, flags[i]));
SkAutoTUnref<SkShader> radial1(
SkGradientShader::CreateRadial(center, radius, colors1,
NULL, SK_ARRAY_COUNT(colors1),
SkShader::kClamp_TileMode,
- flags[i], NULL));
+ NULL, flags[i]));
SkAutoTUnref<SkShader> radial2(
SkGradientShader::CreateRadial(center, radius, colors2,
NULL, SK_ARRAY_COUNT(colors2),
SkShader::kClamp_TileMode,
- flags[i], NULL));
+ NULL, flags[i]));
paint1.setShader(sweep);
paint2.setShader(radial1);
paint3.setShader(radial2);
« no previous file with comments | « gm/gradient_matrix.cpp ('k') | gm/gradients_2pt_conical.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698