aboutsummaryrefslogtreecommitdiffhomepage
path: root/gm/tilemodes_scaled.cpp
diff options
context:
space:
mode:
authorGravatar reed <reed@google.com>2016-03-13 13:01:57 -0700
committerGravatar Commit bot <commit-bot@chromium.org>2016-03-13 13:01:57 -0700
commit9283d20afc27571f7a871d1bd1100dd5df584941 (patch)
tree3688fa1847d47e1f2493b040bbe91594f6274cf0 /gm/tilemodes_scaled.cpp
parentce563cdd48ec7ce4e0420dd88760df9be9dba50c (diff)
Revert of more shader-->sp conversions (patchset #5 id:80001 of https://codereview.chromium.org/1789633002/ )
Reason for revert: seems to have changed pictureshadertile Original issue's description: > more shader-->sp conversions > > BUG=skia: > GOLD_TRYBOT_URL= https://gold.skia.org/search2?unt=true&query=source_type%3Dgm&master=false&issue=1789633002 > > Committed: https://skia.googlesource.com/skia/+/ce563cdd48ec7ce4e0420dd88760df9be9dba50c TBR=fmalita@chromium.org # Skipping CQ checks because original CL landed less than 1 days ago. NOPRESUBMIT=true NOTREECHECKS=true NOTRY=true BUG=skia: Review URL: https://codereview.chromium.org/1790353002
Diffstat (limited to 'gm/tilemodes_scaled.cpp')
-rw-r--r--gm/tilemodes_scaled.cpp23
1 files changed, 12 insertions, 11 deletions
diff --git a/gm/tilemodes_scaled.cpp b/gm/tilemodes_scaled.cpp
index 21224b44e8..0d46fb66c5 100644
--- a/gm/tilemodes_scaled.cpp
+++ b/gm/tilemodes_scaled.cpp
@@ -27,14 +27,15 @@ static void makebm(SkBitmap* bm, SkColorType ct, int w, int h) {
SkPaint paint;
paint.setDither(true);
- paint.setShader(SkGradientShader::MakeLinear(pts, colors, pos,
- SK_ARRAY_COUNT(colors), SkShader::kClamp_TileMode));
+ paint.setShader(SkGradientShader::CreateLinear(pts, colors, pos,
+ SK_ARRAY_COUNT(colors), SkShader::kClamp_TileMode))->unref();
canvas.drawPaint(paint);
}
static void setup(SkPaint* paint, const SkBitmap& bm, SkFilterQuality filter_level,
SkShader::TileMode tmx, SkShader::TileMode tmy) {
- paint->setShader(SkShader::MakeBitmapShader(bm, tmx, tmy));
+ SkShader* shader = SkShader::CreateBitmapShader(bm, tmx, tmy);
+ paint->setShader(shader)->unref();
paint->setFilterQuality(filter_level);
}
@@ -159,13 +160,13 @@ private:
static const int gWidth = 32;
static const int gHeight = 32;
-static sk_sp<SkShader> make_bm(SkShader::TileMode tx, SkShader::TileMode ty) {
+static SkShader* make_bm(SkShader::TileMode tx, SkShader::TileMode ty) {
SkBitmap bm;
makebm(&bm, kN32_SkColorType, gWidth, gHeight);
- return SkShader::MakeBitmapShader(bm, tx, ty);
+ return SkShader::CreateBitmapShader(bm, tx, ty);
}
-static sk_sp<SkShader> make_grad(SkShader::TileMode tx, SkShader::TileMode ty) {
+static SkShader* make_grad(SkShader::TileMode tx, SkShader::TileMode ty) {
SkPoint pts[] = { { 0, 0 }, { SkIntToScalar(gWidth), SkIntToScalar(gHeight)} };
SkPoint center = { SkIntToScalar(gWidth)/2, SkIntToScalar(gHeight)/2 };
SkScalar rad = SkIntToScalar(gWidth)/2;
@@ -174,17 +175,17 @@ static sk_sp<SkShader> make_grad(SkShader::TileMode tx, SkShader::TileMode ty) {
int index = (int)ty;
switch (index % 3) {
case 0:
- return SkGradientShader::MakeLinear(pts, colors, nullptr, SK_ARRAY_COUNT(colors), tx);
+ return SkGradientShader::CreateLinear(pts, colors, nullptr, SK_ARRAY_COUNT(colors), tx);
case 1:
- return SkGradientShader::MakeRadial(center, rad, colors, nullptr, SK_ARRAY_COUNT(colors), tx);
+ return SkGradientShader::CreateRadial(center, rad, colors, nullptr, SK_ARRAY_COUNT(colors), tx);
case 2:
- return SkGradientShader::MakeSweep(center.fX, center.fY, colors, nullptr, SK_ARRAY_COUNT(colors));
+ return SkGradientShader::CreateSweep(center.fX, center.fY, colors, nullptr, SK_ARRAY_COUNT(colors));
}
return nullptr;
}
-typedef sk_sp<SkShader> (*ShaderProc)(SkShader::TileMode, SkShader::TileMode);
+typedef SkShader* (*ShaderProc)(SkShader::TileMode, SkShader::TileMode);
class ScaledTiling2GM : public skiagm::GM {
ShaderProc fProc;
@@ -242,7 +243,7 @@ protected:
x += SkIntToScalar(50);
for (size_t kx = 0; kx < SK_ARRAY_COUNT(gModes); kx++) {
SkPaint paint;
- paint.setShader(fProc(gModes[kx], gModes[ky]));
+ paint.setShader(fProc(gModes[kx], gModes[ky]))->unref();
canvas->save();
canvas->translate(x, y);