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

Unified Diff: src/core/SkDraw.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/core/SkDraw.cpp
diff --git a/src/core/SkDraw.cpp b/src/core/SkDraw.cpp
index b4bcc2ea4d8104b4c8c0632aac8269a06cbe3e2f..c63c90fb8ac8825e0e36949aeb2af1af72968490 100644
--- a/src/core/SkDraw.cpp
+++ b/src/core/SkDraw.cpp
@@ -32,6 +32,7 @@
#include "SkTLazy.h"
#include "SkUtils.h"
#include "SkVertState.h"
+#include "SkXfermode.h"
#include "SkBitmapProcShader.h"
#include "SkDrawProcs.h"
@@ -1900,15 +1901,9 @@ void SkDraw::drawVertices(SkCanvas::VertexMode vmode, int count,
} else {
// colors * texture
SkASSERT(shader);
- bool releaseMode = false;
- if (nullptr == xmode) {
- xmode = SkXfermode::Create(SkXfermode::kModulate_Mode);
- releaseMode = true;
- }
- p.setShader(sk_make_sp<SkComposeShader>(triShader, sk_ref_sp(shader), xmode));
- if (releaseMode) {
- xmode->unref();
- }
+ sk_sp<SkXfermode> xfer = xmode ? sk_ref_sp(xmode)
+ : SkXfermode::Make(SkXfermode::kModulate_Mode);
+ p.setShader(SkShader::MakeComposeShader(triShader, sk_ref_sp(shader), std::move(xfer)));
}
}

Powered by Google App Engine
This is Rietveld 408576698