OLD | NEW |
1 /* | 1 /* |
2 * Copyright 2012 The Android Open Source Project | 2 * Copyright 2012 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 "SkColorFilterImageFilter.h" | 8 #include "SkColorFilterImageFilter.h" |
9 | 9 |
10 #include "SkCanvas.h" | 10 #include "SkCanvas.h" |
(...skipping 71 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
82 sk_sp<SkSpecialSurface> surf(source->makeSurface(ctx.outputProperties(), bou
nds.size())); | 82 sk_sp<SkSpecialSurface> surf(source->makeSurface(ctx.outputProperties(), bou
nds.size())); |
83 if (!surf) { | 83 if (!surf) { |
84 return nullptr; | 84 return nullptr; |
85 } | 85 } |
86 | 86 |
87 SkCanvas* canvas = surf->getCanvas(); | 87 SkCanvas* canvas = surf->getCanvas(); |
88 SkASSERT(canvas); | 88 SkASSERT(canvas); |
89 | 89 |
90 SkPaint paint; | 90 SkPaint paint; |
91 | 91 |
92 paint.setXfermodeMode(SkXfermode::kSrc_Mode); | 92 paint.setBlendMode(SkBlendMode::kSrc); |
93 paint.setColorFilter(fColorFilter); | 93 paint.setColorFilter(fColorFilter); |
94 | 94 |
95 // TODO: it may not be necessary to clear or drawPaint inside the input boun
ds | 95 // TODO: it may not be necessary to clear or drawPaint inside the input boun
ds |
96 // (see skbug.com/5075) | 96 // (see skbug.com/5075) |
97 if (fColorFilter->affectsTransparentBlack()) { | 97 if (fColorFilter->affectsTransparentBlack()) { |
98 // The subsequent input->draw() call may not fill the entire canvas. For
filters which | 98 // The subsequent input->draw() call may not fill the entire canvas. For
filters which |
99 // affect transparent black, ensure that the filter is applied everywher
e. | 99 // affect transparent black, ensure that the filter is applied everywher
e. |
100 paint.setColor(SK_ColorTRANSPARENT); | 100 paint.setColor(SK_ColorTRANSPARENT); |
101 canvas->drawPaint(paint); | 101 canvas->drawPaint(paint); |
102 paint.setColor(SK_ColorBLACK); | 102 paint.setColor(SK_ColorBLACK); |
(...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
140 if (this->getInput(0)) { | 140 if (this->getInput(0)) { |
141 this->getInput(0)->toString(str); | 141 this->getInput(0)->toString(str); |
142 } | 142 } |
143 | 143 |
144 str->appendf(") color filter: "); | 144 str->appendf(") color filter: "); |
145 fColorFilter->toString(str); | 145 fColorFilter->toString(str); |
146 | 146 |
147 str->append(")"); | 147 str->append(")"); |
148 } | 148 } |
149 #endif | 149 #endif |
OLD | NEW |