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

Unified Diff: samplecode/SampleAll.cpp

Issue 1832223002: switch xfermodes over to sk_sp (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: rebase 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
Index: samplecode/SampleAll.cpp
diff --git a/samplecode/SampleAll.cpp b/samplecode/SampleAll.cpp
index d3be968ee7af39e0bc260bf58f5ecd5b7d6fe7e6..aa0826120038ef20f26560608c3bf5c8f1936f8c 100644
--- a/samplecode/SampleAll.cpp
+++ b/samplecode/SampleAll.cpp
@@ -382,7 +382,6 @@ protected:
SkScalar sigma = SkBlurMask::ConvertRadiusToSigma(SkIntToScalar(12)/5);
SkMaskFilter* embossFilter = SkEmbossMaskFilter::Create(sigma, light);
- SkXfermode* xfermode = SkXfermode::Create(SkXfermode::kXor_Mode);
auto lightingFilter = SkColorMatrixFilter::MakeLightingFilter(
0xff89bc45, 0xff112233);
@@ -404,7 +403,7 @@ protected:
paint.setColor(SK_ColorGREEN);
paint.setStrokeWidth(SkIntToScalar(10));
paint.setStyle(SkPaint::kStroke_Style);
- paint.setXfermode(xfermode)->unref();
+ paint.setXfermode(SkXfermode::Make(SkXfermode::kXor_Mode));
paint.setColorFilter(lightingFilter);
canvas->drawLine(start.fX, start.fY, stop.fX, stop.fY, paint); // should not be green
paint.setXfermode(nullptr);
@@ -505,8 +504,8 @@ protected:
SkColor colors2[] = {SK_ColorBLACK, SkColorSetARGB(0x80, 0, 0, 0)};
auto shaderB = SkGradientShader::MakeLinear(pts, colors2, nullptr,
2, SkShader::kClamp_TileMode);
- SkAutoTUnref<SkXfermode> mode(SkXfermode::Create(SkXfermode::kDstIn_Mode));
- return SkShader::MakeComposeShader(shaderA, shaderB, mode);
+ return SkShader::MakeComposeShader(std::move(shaderA), std::move(shaderB),
+ SkXfermode::Make(SkXfermode::kDstIn_Mode));
}
virtual void startTest() {

Powered by Google App Engine
This is Rietveld 408576698