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" |
11 #include "SkColorFilter.h" | 11 #include "SkColorFilter.h" |
12 #include "SkFilterShader.h" | |
13 #include "SkReadBuffer.h" | 12 #include "SkReadBuffer.h" |
14 #include "SkWriteBuffer.h" | 13 #include "SkWriteBuffer.h" |
15 #include "SkMask.h" | 14 #include "SkMask.h" |
16 #include "SkMaskFilter.h" | 15 #include "SkMaskFilter.h" |
17 #include "SkString.h" | 16 #include "SkString.h" |
18 #include "SkTLazy.h" | 17 #include "SkTLazy.h" |
19 #include "SkUtils.h" | 18 #include "SkUtils.h" |
20 #include "SkXfermode.h" | 19 #include "SkXfermode.h" |
21 #include "SkXfermodeInterpretation.h" | 20 #include "SkXfermodeInterpretation.h" |
22 | 21 |
(...skipping 828 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
851 // our color and move on. | 850 // our color and move on. |
852 SkPaint* writablePaint = paint.writable(); | 851 SkPaint* writablePaint = paint.writable(); |
853 writablePaint->setColor(cf->filterColor(paint->getColor())); | 852 writablePaint->setColor(cf->filterColor(paint->getColor())); |
854 writablePaint->setColorFilter(nullptr); | 853 writablePaint->setColorFilter(nullptr); |
855 cf = nullptr; | 854 cf = nullptr; |
856 } | 855 } |
857 } | 856 } |
858 | 857 |
859 if (cf) { | 858 if (cf) { |
860 SkASSERT(shader); | 859 SkASSERT(shader); |
861 shader = new SkFilterShader(shader, cf); | 860 shader = shader->newWithColorFilter(cf); |
862 paint.writable()->setShader(shader)->unref(); | 861 paint.writable()->setShader(shader)->unref(); |
863 // blitters should ignore the presence/absence of a filter, since | 862 // blitters should ignore the presence/absence of a filter, since |
864 // if there is one, the shader will take care of it. | 863 // if there is one, the shader will take care of it. |
865 } | 864 } |
866 | 865 |
867 /* | 866 /* |
868 * We create a SkShader::Context object, and store it on the blitter. | 867 * We create a SkShader::Context object, and store it on the blitter. |
869 */ | 868 */ |
870 SkShader::Context* shaderContext = nullptr; | 869 SkShader::Context* shaderContext = nullptr; |
871 if (shader) { | 870 if (shader) { |
(...skipping 102 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
974 fShaderContext->~Context(); | 973 fShaderContext->~Context(); |
975 SkShader::Context* ctx = fShader->createContext(rec, (void*)fShaderContext); | 974 SkShader::Context* ctx = fShader->createContext(rec, (void*)fShaderContext); |
976 if (nullptr == ctx) { | 975 if (nullptr == ctx) { |
977 // Need a valid context in fShaderContext's storage, so we can later (or
our caller) call | 976 // Need a valid context in fShaderContext's storage, so we can later (or
our caller) call |
978 // the in-place destructor. | 977 // the in-place destructor. |
979 new (fShaderContext) SkZeroShaderContext(*fShader, rec); | 978 new (fShaderContext) SkZeroShaderContext(*fShader, rec); |
980 return false; | 979 return false; |
981 } | 980 } |
982 return true; | 981 return true; |
983 } | 982 } |
OLD | NEW |