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

Unified Diff: gm/pictureshader.cpp

Issue 1793303002: Reland of "more shader-->sp conversions (patchset #5 id:80001 of https://codereview.chromium… (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: make pictureRef a value, so its clearer what's going on Created 4 years, 9 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/pictureimagegenerator.cpp ('k') | gm/pictureshadertile.cpp » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: gm/pictureshader.cpp
diff --git a/gm/pictureshader.cpp b/gm/pictureshader.cpp
index c35c5c964edea5199089c231a0ba5b5df9836767..f27c4eda4780317400d0c40d4f82751b2152f77c 100644
--- a/gm/pictureshader.cpp
+++ b/gm/pictureshader.cpp
@@ -150,20 +150,17 @@ private:
canvas->drawRect(SkRect::MakeWH(fSceneSize, fSceneSize), paint);
canvas->drawRect(SkRect::MakeXYWH(fSceneSize * 1.1f, 0, fSceneSize, fSceneSize), paint);
- SkAutoTUnref<SkShader> pictureShader(
- SkShader::CreatePictureShader(fPicture, kTileConfigs[tileMode].tmx,
- kTileConfigs[tileMode].tmy, &localMatrix, nullptr));
- paint.setShader(pictureShader.get());
+ paint.setShader(SkShader::MakePictureShader(fPicture, kTileConfigs[tileMode].tmx,
+ kTileConfigs[tileMode].tmy, &localMatrix,
+ nullptr));
canvas->drawRect(SkRect::MakeWH(fSceneSize, fSceneSize), paint);
canvas->translate(fSceneSize * 1.1f, 0);
- SkAutoTUnref<SkShader> bitmapShader(SkShader::CreateBitmapShader(
- fBitmap,
- kTileConfigs[tileMode].tmx,
- kTileConfigs[tileMode].tmy,
- &localMatrix));
- paint.setShader(bitmapShader.get());
+ paint.setShader(SkShader::MakeBitmapShader(fBitmap,
+ kTileConfigs[tileMode].tmx,
+ kTileConfigs[tileMode].tmy,
+ &localMatrix));
canvas->drawRect(SkRect::MakeWH(fSceneSize, fSceneSize), paint);
canvas->restore();
@@ -172,7 +169,7 @@ private:
SkScalar fTileSize;
SkScalar fSceneSize;
- SkAutoTUnref<SkPicture> fPicture;
+ sk_sp<SkPicture> fPicture;
SkBitmap fBitmap;
typedef GM INHERITED;
@@ -196,10 +193,10 @@ DEF_SIMPLE_GM(tiled_picture_shader, canvas, 400, 400) {
p.setStrokeWidth(10);
c->drawLine(20, 20, 80, 80, p);
- SkAutoTUnref<SkPicture> picture(recorder.endRecording());
- SkAutoTUnref<SkShader> shader(
- SkShader::CreatePictureShader(picture.get(), SkShader::kRepeat_TileMode,
- SkShader::kRepeat_TileMode, nullptr, nullptr));
+ sk_sp<SkPicture> picture(recorder.endRecording());
+ sk_sp<SkShader> shader(SkShader::MakePictureShader(picture, SkShader::kRepeat_TileMode,
+ SkShader::kRepeat_TileMode,
+ nullptr, nullptr));
p.setColor(sk_tool_utils::color_to_565(0xFF8BC34A)); // green
canvas->drawPaint(p);
« no previous file with comments | « gm/pictureimagegenerator.cpp ('k') | gm/pictureshadertile.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698