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

Unified Diff: gm/gradients_no_texture.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/gradients_2pt_conical.cpp ('k') | gm/shaderbounds.cpp » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: gm/gradients_no_texture.cpp
diff --git a/gm/gradients_no_texture.cpp b/gm/gradients_no_texture.cpp
index fcbba45ae70136188e3bffb0a243c3297581b10d..2e75c9ed79fcdd844c75dcd78fe73dc54d4ce383 100644
--- a/gm/gradients_no_texture.cpp
+++ b/gm/gradients_no_texture.cpp
@@ -26,26 +26,32 @@
{ 4, gColors, NULL },
};
-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* MakeRadial(const SkPoint pts[2], const GradData& data, SkShader::TileMode 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, 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);
-}
-
-static SkShader* MakeSweep(const SkPoint pts[2], const GradData& data, SkShader::TileMode) {
+ data.fPos, data.fCount, tm, mapper);
+}
+
+static SkShader* MakeSweep(const SkPoint pts[2], const GradData& data,
+ SkShader::TileMode, 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);
-}
-
-static SkShader* Make2Radial(const SkPoint pts[2], const GradData& data, SkShader::TileMode tm) {
+ 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, SkUnitMapper* mapper) {
SkPoint center0, center1;
center0.set(SkScalarAve(pts[0].fX, pts[1].fX),
SkScalarAve(pts[0].fY, pts[1].fY));
@@ -54,10 +60,11 @@
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);
-}
-
-static SkShader* Make2Conical(const SkPoint pts[2], const GradData& data, SkShader::TileMode tm) {
+ data.fColors, data.fPos, data.fCount, tm, mapper);
+}
+
+static SkShader* Make2Conical(const SkPoint pts[2], const GradData& data,
+ SkShader::TileMode tm, SkUnitMapper* mapper) {
SkPoint center0, center1;
SkScalar radius0 = SkScalarDiv(pts[1].fX - pts[0].fX, 10);
SkScalar radius1 = SkScalarDiv(pts[1].fX - pts[0].fX, 3);
@@ -66,12 +73,12 @@
return SkGradientShader::CreateTwoPointConical(center1, radius1,
center0, radius0,
data.fColors, data.fPos,
- data.fCount, tm);
-}
-
-
-typedef SkShader* (*GradMaker)(const SkPoint pts[2], const GradData& data, SkShader::TileMode tm);
-
+ data.fCount, tm, mapper);
+}
+
+
+typedef SkShader* (*GradMaker)(const SkPoint pts[2], const GradData& data,
+ SkShader::TileMode tm, SkUnitMapper* mapper);
static const GradMaker gGradMakers[] = {
MakeLinear, MakeRadial, MakeSweep, Make2Radial, Make2Conical,
};
@@ -106,7 +113,7 @@
for (size_t i = 0; i < SK_ARRAY_COUNT(gGradData); ++i) {
canvas->save();
for (size_t j = 0; j < SK_ARRAY_COUNT(gGradMakers); ++j) {
- SkShader* shader = gGradMakers[j](kPts, gGradData[i], kTM);
+ SkShader* shader = gGradMakers[j](kPts, gGradData[i], kTM, NULL);
paint.setShader(shader)->unref();
paint.setAlpha(kAlphas[a]);
canvas->drawRect(kRect, paint);
« no previous file with comments | « gm/gradients_2pt_conical.cpp ('k') | gm/shaderbounds.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698