| 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 "SkBlitRow.h" | 8 #include "SkBlitRow.h" |
| 9 #include "SkColorFilter.h" | 9 #include "SkColorFilter.h" |
| 10 #include "SkColorPriv.h" | 10 #include "SkColorPriv.h" |
| (...skipping 56 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 67 #include "GrBlend.h" | 67 #include "GrBlend.h" |
| 68 #include "GrInvariantOutput.h" | 68 #include "GrInvariantOutput.h" |
| 69 #include "effects/GrXfermodeFragmentProcessor.h" | 69 #include "effects/GrXfermodeFragmentProcessor.h" |
| 70 #include "effects/GrConstColorProcessor.h" | 70 #include "effects/GrConstColorProcessor.h" |
| 71 #include "SkGr.h" | 71 #include "SkGr.h" |
| 72 | 72 |
| 73 bool SkModeColorFilter::asFragmentProcessors(GrContext*, GrProcessorDataManager*
, | 73 bool SkModeColorFilter::asFragmentProcessors(GrContext*, GrProcessorDataManager*
, |
| 74 SkTDArray<const GrFragmentProcessor
*>* array) const { | 74 SkTDArray<const GrFragmentProcessor
*>* array) const { |
| 75 if (SkXfermode::kDst_Mode != fMode) { | 75 if (SkXfermode::kDst_Mode != fMode) { |
| 76 SkAutoTUnref<const GrFragmentProcessor> constFP( | 76 SkAutoTUnref<const GrFragmentProcessor> constFP( |
| 77 GrConstColorProcessor::Create(SkColor2GrColor(fColor), | 77 GrConstColorProcessor::Create(SkColorToPremulGrColor(fColor), |
| 78 GrConstColorProcessor::kIgnore_InputMo
de)); | 78 GrConstColorProcessor::kIgnore_InputMo
de)); |
| 79 const GrFragmentProcessor* fp = | 79 const GrFragmentProcessor* fp = |
| 80 GrXfermodeFragmentProcessor::CreateFromSrcProcessor(constFP, fMode); | 80 GrXfermodeFragmentProcessor::CreateFromSrcProcessor(constFP, fMode); |
| 81 if (fp) { | 81 if (fp) { |
| 82 #ifdef SK_DEBUG | 82 #ifdef SK_DEBUG |
| 83 // With a solid color input this should always be able to compute th
e blended color | 83 // With a solid color input this should always be able to compute th
e blended color |
| 84 // (at least for coeff modes) | 84 // (at least for coeff modes) |
| 85 if (fMode <= SkXfermode::kLastCoeffMode) { | 85 if (fMode <= SkXfermode::kLastCoeffMode) { |
| 86 static SkRandom gRand; | 86 static SkRandom gRand; |
| 87 GrInvariantOutput io(GrPremulColor(gRand.nextU()), kRGBA_GrColor
ComponentFlags, | 87 GrInvariantOutput io(GrPremulColor(gRand.nextU()), kRGBA_GrColor
ComponentFlags, |
| (...skipping 104 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 192 byte_to_scale(SkColorGetG(mul)), | 192 byte_to_scale(SkColorGetG(mul)), |
| 193 byte_to_scale(SkColorGetB(mul)), | 193 byte_to_scale(SkColorGetB(mul)), |
| 194 1); | 194 1); |
| 195 matrix.postTranslate(SkIntToScalar(SkColorGetR(add)), | 195 matrix.postTranslate(SkIntToScalar(SkColorGetR(add)), |
| 196 SkIntToScalar(SkColorGetG(add)), | 196 SkIntToScalar(SkColorGetG(add)), |
| 197 SkIntToScalar(SkColorGetB(add)), | 197 SkIntToScalar(SkColorGetB(add)), |
| 198 0); | 198 0); |
| 199 return SkColorMatrixFilter::Create(matrix); | 199 return SkColorMatrixFilter::Create(matrix); |
| 200 } | 200 } |
| 201 | 201 |
| OLD | NEW |