| OLD | NEW |
| 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 835 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 846 if (SkXfermode::IsMode(mode, SkXfermode::kClear_Mode)) { | 846 if (SkXfermode::IsMode(mode, SkXfermode::kClear_Mode)) { |
| 847 SkPaint* p = paint.writable(); | 847 SkPaint* p = paint.writable(); |
| 848 p->setShader(nullptr); | 848 p->setShader(nullptr); |
| 849 shader = nullptr; | 849 shader = nullptr; |
| 850 p->setColorFilter(nullptr); | 850 p->setColorFilter(nullptr); |
| 851 cf = nullptr; | 851 cf = nullptr; |
| 852 mode = p->setXfermodeMode(SkXfermode::kSrc_Mode); | 852 mode = p->setXfermodeMode(SkXfermode::kSrc_Mode); |
| 853 p->setColor(0); | 853 p->setColor(0); |
| 854 } | 854 } |
| 855 | 855 |
| 856 if (auto blitter = SkCreateRasterPipelineBlitter(device, *paint)) { | |
| 857 return blitter.release(); | |
| 858 } | |
| 859 | |
| 860 if (nullptr == shader) { | 856 if (nullptr == shader) { |
| 861 if (mode) { | 857 if (mode) { |
| 862 // xfermodes (and filters) require shaders for our current blitters | 858 // xfermodes (and filters) require shaders for our current blitters |
| 863 paint.writable()->setShader(SkShader::MakeColorShader(paint->getColo
r())); | 859 paint.writable()->setShader(SkShader::MakeColorShader(paint->getColo
r())); |
| 864 paint.writable()->setAlpha(0xFF); | 860 paint.writable()->setAlpha(0xFF); |
| 865 shader = paint->getShader(); | 861 shader = paint->getShader(); |
| 866 } else if (cf) { | 862 } else if (cf) { |
| 867 // if no shader && no xfermode, we just apply the colorfilter to | 863 // if no shader && no xfermode, we just apply the colorfilter to |
| 868 // our color and move on. | 864 // our color and move on. |
| 869 SkPaint* writablePaint = paint.writable(); | 865 SkPaint* writablePaint = paint.writable(); |
| (...skipping 139 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1009 fShaderContext->~Context(); | 1005 fShaderContext->~Context(); |
| 1010 SkShader::Context* ctx = fShader->createContext(rec, (void*)fShaderContext); | 1006 SkShader::Context* ctx = fShader->createContext(rec, (void*)fShaderContext); |
| 1011 if (nullptr == ctx) { | 1007 if (nullptr == ctx) { |
| 1012 // Need a valid context in fShaderContext's storage, so we can later (or
our caller) call | 1008 // Need a valid context in fShaderContext's storage, so we can later (or
our caller) call |
| 1013 // the in-place destructor. | 1009 // the in-place destructor. |
| 1014 new (fShaderContext) SkZeroShaderContext(*fShader, rec); | 1010 new (fShaderContext) SkZeroShaderContext(*fShader, rec); |
| 1015 return false; | 1011 return false; |
| 1016 } | 1012 } |
| 1017 return true; | 1013 return true; |
| 1018 } | 1014 } |
| OLD | NEW |