| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright 2015 Google Inc. | 2 * Copyright 2015 Google Inc. |
| 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 "effects/GrConstColorProcessor.h" | 8 #include "effects/GrConstColorProcessor.h" |
| 9 #include "glsl/GrGLSLFragmentProcessor.h" | 9 #include "glsl/GrGLSLFragmentProcessor.h" |
| 10 #include "glsl/GrGLSLFragmentShaderBuilder.h" | 10 #include "glsl/GrGLSLFragmentShaderBuilder.h" |
| (...skipping 74 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 85 } else { | 85 } else { |
| 86 if (colorIsSingleChannel) { | 86 if (colorIsSingleChannel) { |
| 87 inout->mulAlphaByKnownSingleComponent(r); | 87 inout->mulAlphaByKnownSingleComponent(r); |
| 88 } else { | 88 } else { |
| 89 inout->mulAlphaByKnownFourComponents(fColor); | 89 inout->mulAlphaByKnownFourComponents(fColor); |
| 90 } | 90 } |
| 91 } | 91 } |
| 92 } | 92 } |
| 93 } | 93 } |
| 94 | 94 |
| 95 void GrConstColorProcessor::onGetGLProcessorKey(const GrGLSLCaps&, GrProcessorKe
yBuilder* b) const { | 95 void GrConstColorProcessor::onGetGLSLProcessorKey(const GrGLSLCaps&, |
| 96 GrProcessorKeyBuilder* b) cons
t { |
| 96 b->add32(fMode); | 97 b->add32(fMode); |
| 97 } | 98 } |
| 98 | 99 |
| 99 GrGLSLFragmentProcessor* GrConstColorProcessor::onCreateGLInstance() const { | 100 GrGLSLFragmentProcessor* GrConstColorProcessor::onCreateGLSLInstance() const { |
| 100 return new GLConstColorProcessor; | 101 return new GLConstColorProcessor; |
| 101 } | 102 } |
| 102 | 103 |
| 103 bool GrConstColorProcessor::onIsEqual(const GrFragmentProcessor& other) const { | 104 bool GrConstColorProcessor::onIsEqual(const GrFragmentProcessor& other) const { |
| 104 const GrConstColorProcessor& that = other.cast<GrConstColorProcessor>(); | 105 const GrConstColorProcessor& that = other.cast<GrConstColorProcessor>(); |
| 105 return fMode == that.fMode && fColor == that.fColor; | 106 return fMode == that.fMode && fColor == that.fColor; |
| 106 } | 107 } |
| 107 | 108 |
| 108 /////////////////////////////////////////////////////////////////////////////// | 109 /////////////////////////////////////////////////////////////////////////////// |
| 109 | 110 |
| (...skipping 15 matching lines...) Expand all Loading... |
| 125 color = 0; | 126 color = 0; |
| 126 break; | 127 break; |
| 127 case 2: | 128 case 2: |
| 128 color = d->fRandom->nextULessThan(0x100); | 129 color = d->fRandom->nextULessThan(0x100); |
| 129 color = color | (color << 8) | (color << 16) | (color << 24); | 130 color = color | (color << 8) | (color << 16) | (color << 24); |
| 130 break; | 131 break; |
| 131 } | 132 } |
| 132 InputMode mode = static_cast<InputMode>(d->fRandom->nextULessThan(kInputMode
Cnt)); | 133 InputMode mode = static_cast<InputMode>(d->fRandom->nextULessThan(kInputMode
Cnt)); |
| 133 return GrConstColorProcessor::Create(color, mode); | 134 return GrConstColorProcessor::Create(color, mode); |
| 134 } | 135 } |
| OLD | NEW |