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

Unified Diff: example/HelloWorld.cpp

Issue 1798133003: Revert of 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 e30c4674e8d89a6e752fa96831fd07c90cf94cb7..e13cb3b438045ef777ca711b471081b1981bdf4f 100644
--- a/example/HelloWorld.cpp
+++ b/example/HelloWorld.cpp
@@ -93,7 +93,10 @@
paint.setColor(SK_ColorRED);
// Draw a rectangle with red paint
- SkRect rect = SkRect::MakeXYWH(10, 10, 128, 128);
+ SkRect rect = {
+ 10, 10,
+ 128, 128
+ };
canvas->drawRect(rect, paint);
// Set up a linear gradient and draw a circle
@@ -104,15 +107,18 @@
};
SkColor linearColors[] = {SK_ColorGREEN, SK_ColorBLACK};
- paint.setShader(SkGradientShader::MakeLinear(
- linearPoints, linearColors, nullptr, 2,
- SkShader::kMirror_TileMode));
+ SkShader* shader = SkGradientShader::CreateLinear(
+ linearPoints, linearColors, NULL, 2,
+ SkShader::kMirror_TileMode);
+ SkAutoUnref shader_deleter(shader);
+
+ paint.setShader(shader);
paint.setFlags(SkPaint::kAntiAlias_Flag);
canvas->drawCircle(200, 200, 64, paint);
// Detach shader
- paint.setShader(nullptr);
+ paint.setShader(NULL);
}
// 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