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

Side by Side Diff: src/core/SkBlitter.cpp

Issue 1822623002: switch colorfilters to sk_sp (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: manual 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 unified diff | Download patch
OLDNEW
1 /* 1 /*
2 * Copyright 2006 The Android Open Source Project 2 * Copyright 2006 The Android Open Source Project
3 * 3 *
4 * Use of this source code is governed by a BSD-style license that can be 4 * Use of this source code is governed by a BSD-style license that can be
5 * found in the LICENSE file. 5 * found in the LICENSE file.
6 */ 6 */
7 7
8 #include "SkBlitter.h" 8 #include "SkBlitter.h"
9 #include "SkAntiRun.h" 9 #include "SkAntiRun.h"
10 #include "SkColor.h" 10 #include "SkColor.h"
(...skipping 826 matching lines...) Expand 10 before | Expand all | Expand 10 after
837 } 837 }
838 838
839 /* 839 /*
840 * If the xfermode is CLEAR, then we can completely ignore the installed 840 * If the xfermode is CLEAR, then we can completely ignore the installed
841 * color/shader/colorfilter, and just pretend we're SRC + color==0. This 841 * color/shader/colorfilter, and just pretend we're SRC + color==0. This
842 * will fall into our optimizations for SRC mode. 842 * will fall into our optimizations for SRC mode.
843 */ 843 */
844 if (SkXfermode::IsMode(mode, SkXfermode::kClear_Mode)) { 844 if (SkXfermode::IsMode(mode, SkXfermode::kClear_Mode)) {
845 SkPaint* p = paint.writable(); 845 SkPaint* p = paint.writable();
846 shader = p->setShader(nullptr); 846 shader = p->setShader(nullptr);
847 cf = p->setColorFilter(nullptr); 847 p->setColorFilter(nullptr);
848 cf = nullptr;
848 mode = p->setXfermodeMode(SkXfermode::kSrc_Mode); 849 mode = p->setXfermodeMode(SkXfermode::kSrc_Mode);
849 p->setColor(0); 850 p->setColor(0);
850 } 851 }
851 852
852 if (nullptr == shader) { 853 if (nullptr == shader) {
853 if (mode) { 854 if (mode) {
854 // xfermodes (and filters) require shaders for our current blitters 855 // xfermodes (and filters) require shaders for our current blitters
855 shader = new SkColorShader(paint->getColor()); 856 shader = new SkColorShader(paint->getColor());
856 paint.writable()->setShader(shader)->unref(); 857 paint.writable()->setShader(shader)->unref();
857 paint.writable()->setAlpha(0xFF); 858 paint.writable()->setAlpha(0xFF);
(...skipping 144 matching lines...) Expand 10 before | Expand all | Expand 10 after
1002 fShaderContext->~Context(); 1003 fShaderContext->~Context();
1003 SkShader::Context* ctx = fShader->createContext(rec, (void*)fShaderContext); 1004 SkShader::Context* ctx = fShader->createContext(rec, (void*)fShaderContext);
1004 if (nullptr == ctx) { 1005 if (nullptr == ctx) {
1005 // Need a valid context in fShaderContext's storage, so we can later (or our caller) call 1006 // Need a valid context in fShaderContext's storage, so we can later (or our caller) call
1006 // the in-place destructor. 1007 // the in-place destructor.
1007 new (fShaderContext) SkZeroShaderContext(*fShader, rec); 1008 new (fShaderContext) SkZeroShaderContext(*fShader, rec);
1008 return false; 1009 return false;
1009 } 1010 }
1010 return true; 1011 return true;
1011 } 1012 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698