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 "gl/GrGLProcessor.h" | 9 #include "gl/GrGLProcessor.h" |
10 #include "gl/GrGLSL.h" | 10 #include "gl/GrGLSL.h" |
(...skipping 70 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
81 } else { | 81 } else { |
82 if (colorIsSingleChannel) { | 82 if (colorIsSingleChannel) { |
83 inout->mulAlphaByKnownSingleComponent(r); | 83 inout->mulAlphaByKnownSingleComponent(r); |
84 } else { | 84 } else { |
85 inout->mulAlphaByKnownFourComponents(fColor); | 85 inout->mulAlphaByKnownFourComponents(fColor); |
86 } | 86 } |
87 } | 87 } |
88 } | 88 } |
89 } | 89 } |
90 | 90 |
91 void GrConstColorProcessor::getGLProcessorKey(const GrGLCaps&, GrProcessorKeyBui
lder* b) const { | 91 void GrConstColorProcessor::getGLProcessorKey(const GrGLSLCaps&, GrProcessorKeyB
uilder* b) const { |
92 b->add32(fMode); | 92 b->add32(fMode); |
93 } | 93 } |
94 | 94 |
95 GrGLFragmentProcessor* GrConstColorProcessor::createGLInstance() const { | 95 GrGLFragmentProcessor* GrConstColorProcessor::createGLInstance() const { |
96 return SkNEW(GLConstColorProcessor); | 96 return SkNEW(GLConstColorProcessor); |
97 } | 97 } |
98 | 98 |
99 bool GrConstColorProcessor::onIsEqual(const GrFragmentProcessor& other) const { | 99 bool GrConstColorProcessor::onIsEqual(const GrFragmentProcessor& other) const { |
100 const GrConstColorProcessor& that = other.cast<GrConstColorProcessor>(); | 100 const GrConstColorProcessor& that = other.cast<GrConstColorProcessor>(); |
101 return fMode == that.fMode && fColor == that.fColor; | 101 return fMode == that.fMode && fColor == that.fColor; |
(...skipping 22 matching lines...) Expand all Loading... |
124 color = 0; | 124 color = 0; |
125 break; | 125 break; |
126 case 2: | 126 case 2: |
127 color = random->nextULessThan(0x100); | 127 color = random->nextULessThan(0x100); |
128 color = color | (color << 8) | (color << 16) | (color << 24); | 128 color = color | (color << 8) | (color << 16) | (color << 24); |
129 break; | 129 break; |
130 } | 130 } |
131 InputMode mode = static_cast<InputMode>(random->nextULessThan(kInputModeCnt)
); | 131 InputMode mode = static_cast<InputMode>(random->nextULessThan(kInputModeCnt)
); |
132 return GrConstColorProcessor::Create(color, mode); | 132 return GrConstColorProcessor::Create(color, mode); |
133 } | 133 } |
OLD | NEW |