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

Unified Diff: src/effects/SkArithmeticMode.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: src/effects/SkArithmeticMode.cpp
diff --git a/src/effects/SkArithmeticMode.cpp b/src/effects/SkArithmeticMode.cpp
index 32238f1f9eeea584bd298858e47110a1dfd30a03..b225e6d4c1147a4f726804ec572a6d693799ec31 100644
--- a/src/effects/SkArithmeticMode.cpp
+++ b/src/effects/SkArithmeticMode.cpp
@@ -60,7 +60,7 @@ SkFlattenable* SkArithmeticMode_scalar::CreateProc(SkReadBuffer& buffer) {
const SkScalar k3 = buffer.readScalar();
const SkScalar k4 = buffer.readScalar();
const bool enforcePMColor = buffer.readBool();
- return SkArithmeticMode::Create(k1, k2, k3, k4, enforcePMColor);
+ return SkArithmeticMode::Make(k1, k2, k3, k4, enforcePMColor).release();
}
static int pinToByte(int value) {
@@ -137,18 +137,16 @@ void SkArithmeticMode_scalar::toString(SkString* str) const {
///////////////////////////////////////////////////////////////////////////////
-SkXfermode* SkArithmeticMode::Create(SkScalar k1, SkScalar k2,
- SkScalar k3, SkScalar k4,
- bool enforcePMColor) {
+sk_sp<SkXfermode> SkArithmeticMode::Make(SkScalar k1, SkScalar k2, SkScalar k3, SkScalar k4,
+ bool enforcePMColor) {
if (SkScalarNearlyZero(k1) && SkScalarNearlyEqual(k2, SK_Scalar1) &&
SkScalarNearlyZero(k3) && SkScalarNearlyZero(k4)) {
- return SkXfermode::Create(SkXfermode::kSrc_Mode);
+ return SkXfermode::Make(SkXfermode::kSrc_Mode);
} else if (SkScalarNearlyZero(k1) && SkScalarNearlyZero(k2) &&
SkScalarNearlyEqual(k3, SK_Scalar1) && SkScalarNearlyZero(k4)) {
- return SkXfermode::Create(SkXfermode::kDst_Mode);
+ return SkXfermode::Make(SkXfermode::kDst_Mode);
}
-
- return new SkArithmeticMode_scalar(k1, k2, k3, k4, enforcePMColor);
+ return sk_make_sp<SkArithmeticMode_scalar>(k1, k2, k3, k4, enforcePMColor);
}

Powered by Google App Engine
This is Rietveld 408576698