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

Unified Diff: example/HelloWorld.cpp

Issue 1803763002: Finish conversion to sk_sp<SkShader> (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: 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 | « bench/TileBench.cpp ('k') | gyp/skia_for_android_framework_defines.gypi » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: example/HelloWorld.cpp
diff --git a/example/HelloWorld.cpp b/example/HelloWorld.cpp
index e13cb3b438045ef777ca711b471081b1981bdf4f..e30c4674e8d89a6e752fa96831fd07c90cf94cb7 100644
--- a/example/HelloWorld.cpp
+++ b/example/HelloWorld.cpp
@@ -93,10 +93,7 @@ void HelloWorldWindow::drawContents(SkCanvas* canvas) {
paint.setColor(SK_ColorRED);
// Draw a rectangle with red paint
- SkRect rect = {
- 10, 10,
- 128, 128
- };
+ SkRect rect = SkRect::MakeXYWH(10, 10, 128, 128);
canvas->drawRect(rect, paint);
// Set up a linear gradient and draw a circle
@@ -107,18 +104,15 @@ void HelloWorldWindow::drawContents(SkCanvas* canvas) {
};
SkColor linearColors[] = {SK_ColorGREEN, SK_ColorBLACK};
- SkShader* shader = SkGradientShader::CreateLinear(
- linearPoints, linearColors, NULL, 2,
- SkShader::kMirror_TileMode);
- SkAutoUnref shader_deleter(shader);
-
- paint.setShader(shader);
+ paint.setShader(SkGradientShader::MakeLinear(
+ linearPoints, linearColors, nullptr, 2,
+ SkShader::kMirror_TileMode));
paint.setFlags(SkPaint::kAntiAlias_Flag);
canvas->drawCircle(200, 200, 64, paint);
// Detach shader
- paint.setShader(NULL);
+ paint.setShader(nullptr);
}
// Draw a message with a nice black paint.
« no previous file with comments | « bench/TileBench.cpp ('k') | gyp/skia_for_android_framework_defines.gypi » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698