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

Unified Diff: src/core/SkBlitter.cpp

Issue 1829303002: move setshader to sk_sp (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: addressing comments from #8 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 | « src/c/sk_paint.cpp ('k') | src/core/SkLightingShader.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/core/SkBlitter.cpp
diff --git a/src/core/SkBlitter.cpp b/src/core/SkBlitter.cpp
index 15562168e990a5bbb5eb5fef9b1f1da4c03b8d8e..d8e81d59b8018be1395b28b640d2236e64f08ad1 100644
--- a/src/core/SkBlitter.cpp
+++ b/src/core/SkBlitter.cpp
@@ -809,16 +809,16 @@ SkBlitter* SkBlitter::Choose(const SkPixmap& device,
SkShader* shader = origPaint.getShader();
SkColorFilter* cf = origPaint.getColorFilter();
SkXfermode* mode = origPaint.getXfermode();
- Sk3DShader* shader3D = nullptr;
+ sk_sp<Sk3DShader> shader3D;
SkTCopyOnFirstWrite<SkPaint> paint(origPaint);
if (origPaint.getMaskFilter() != nullptr &&
origPaint.getMaskFilter()->getFormat() == SkMask::k3D_Format) {
- shader3D = new Sk3DShader(sk_sp<SkShader>(SkSafeRef(shader)));
+ shader3D = sk_make_sp<Sk3DShader>(sk_ref_sp(shader));
// we know we haven't initialized lazyPaint yet, so just do it
- paint.writable()->setShader(shader3D)->unref();
- shader = shader3D;
+ paint.writable()->setShader(shader3D);
+ shader = shader3D.get();
}
if (mode) {
@@ -843,7 +843,8 @@ SkBlitter* SkBlitter::Choose(const SkPixmap& device,
*/
if (SkXfermode::IsMode(mode, SkXfermode::kClear_Mode)) {
SkPaint* p = paint.writable();
- shader = p->setShader(nullptr);
+ p->setShader(nullptr);
+ shader = nullptr;
p->setColorFilter(nullptr);
cf = nullptr;
mode = p->setXfermodeMode(SkXfermode::kSrc_Mode);
@@ -853,9 +854,9 @@ SkBlitter* SkBlitter::Choose(const SkPixmap& device,
if (nullptr == shader) {
if (mode) {
// xfermodes (and filters) require shaders for our current blitters
- shader = new SkColorShader(paint->getColor());
- paint.writable()->setShader(shader)->unref();
+ paint.writable()->setShader(SkShader::MakeColorShader(paint->getColor()));
paint.writable()->setAlpha(0xFF);
+ shader = paint->getShader();
} else if (cf) {
// if no shader && no xfermode, we just apply the colorfilter to
// our color and move on.
« no previous file with comments | « src/c/sk_paint.cpp ('k') | src/core/SkLightingShader.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698