OLD | NEW |
1 | 1 |
2 /* | 2 /* |
3 * Copyright 2006 The Android Open Source Project | 3 * Copyright 2006 The Android Open Source Project |
4 * | 4 * |
5 * Use of this source code is governed by a BSD-style license that can be | 5 * Use of this source code is governed by a BSD-style license that can be |
6 * found in the LICENSE file. | 6 * found in the LICENSE file. |
7 */ | 7 */ |
8 | 8 |
9 | 9 |
10 #include "SkComposeShader.h" | 10 #include "SkComposeShader.h" |
(...skipping 189 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
200 #include "effects/GrXfermodeFragmentProcessor.h" | 200 #include "effects/GrXfermodeFragmentProcessor.h" |
201 | 201 |
202 ///////////////////////////////////////////////////////////////////// | 202 ///////////////////////////////////////////////////////////////////// |
203 | 203 |
204 const GrFragmentProcessor* SkComposeShader::asFragmentProcessor(GrContext* conte
xt, | 204 const GrFragmentProcessor* SkComposeShader::asFragmentProcessor(GrContext* conte
xt, |
205 const SkMatrix& view
M, | 205 const SkMatrix& view
M, |
206 const SkMatrix* loca
lMatrix, | 206 const SkMatrix* loca
lMatrix, |
207 SkFilterQuality fq, | 207 SkFilterQuality fq, |
208 GrProcessorDataManag
er* procDataManager | 208 GrProcessorDataManag
er* procDataManager |
209 ) const { | 209 ) const { |
210 // Fragment processor will only support coefficient modes. This is because | 210 // Fragment processor will only support SkXfermode::Mode modes currently. |
211 // GrGLBlend::AppendPorterDuffBlend(), which emits the blend code in the sha
der, | |
212 // only supports those modes. | |
213 SkXfermode::Mode mode; | 211 SkXfermode::Mode mode; |
214 if (!(SkXfermode::AsMode(fMode, &mode) && SkXfermode::kLastCoeffMode >= mode
)) { | 212 if (!(SkXfermode::AsMode(fMode, &mode))) { |
215 return nullptr; | 213 return nullptr; |
216 } | 214 } |
217 | 215 |
218 switch (mode) { | 216 switch (mode) { |
219 case SkXfermode::kClear_Mode: | 217 case SkXfermode::kClear_Mode: |
220 return GrConstColorProcessor::Create(GrColor_TRANS_BLACK, | 218 return GrConstColorProcessor::Create(GrColor_TRANSPARENT_BLACK, |
221 GrConstColorProcessor::kIgnore_
InputMode); | 219 GrConstColorProcessor::kIgnore_
InputMode); |
222 break; | 220 break; |
223 case SkXfermode::kSrc_Mode: | 221 case SkXfermode::kSrc_Mode: |
224 return fShaderB->asFragmentProcessor(context, viewM, localMatrix, fq
, procDataManager); | 222 return fShaderB->asFragmentProcessor(context, viewM, localMatrix, fq
, procDataManager); |
225 break; | 223 break; |
226 case SkXfermode::kDst_Mode: | 224 case SkXfermode::kDst_Mode: |
227 return fShaderA->asFragmentProcessor(context, viewM, localMatrix, fq
, procDataManager); | 225 return fShaderA->asFragmentProcessor(context, viewM, localMatrix, fq
, procDataManager); |
228 break; | 226 break; |
229 default: | 227 default: |
230 SkAutoTUnref<const GrFragmentProcessor> fpA(fShaderA->asFragmentProc
essor(context, | 228 SkAutoTUnref<const GrFragmentProcessor> fpA(fShaderA->asFragmentProc
essor(context, |
(...skipping 22 matching lines...) Expand all Loading... |
253 if (fMode) { | 251 if (fMode) { |
254 str->append(" Xfermode: "); | 252 str->append(" Xfermode: "); |
255 fMode->toString(str); | 253 fMode->toString(str); |
256 } | 254 } |
257 | 255 |
258 this->INHERITED::toString(str); | 256 this->INHERITED::toString(str); |
259 | 257 |
260 str->append(")"); | 258 str->append(")"); |
261 } | 259 } |
262 #endif | 260 #endif |
OLD | NEW |