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/GrGLFragmentProcessor.h" | 9 #include "gl/GrGLFragmentProcessor.h" |
10 #include "gl/builders/GrGLProgramBuilder.h" | 10 #include "gl/builders/GrGLProgramBuilder.h" |
(...skipping 85 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
96 | 96 |
97 bool GrConstColorProcessor::onIsEqual(const GrFragmentProcessor& other) const { | 97 bool GrConstColorProcessor::onIsEqual(const GrFragmentProcessor& other) const { |
98 const GrConstColorProcessor& that = other.cast<GrConstColorProcessor>(); | 98 const GrConstColorProcessor& that = other.cast<GrConstColorProcessor>(); |
99 return fMode == that.fMode && fColor == that.fColor; | 99 return fMode == that.fMode && fColor == that.fColor; |
100 } | 100 } |
101 | 101 |
102 /////////////////////////////////////////////////////////////////////////////// | 102 /////////////////////////////////////////////////////////////////////////////// |
103 | 103 |
104 GR_DEFINE_FRAGMENT_PROCESSOR_TEST(GrConstColorProcessor); | 104 GR_DEFINE_FRAGMENT_PROCESSOR_TEST(GrConstColorProcessor); |
105 | 105 |
106 GrFragmentProcessor* GrConstColorProcessor::TestCreate(GrProcessorTestData* d) { | 106 const GrFragmentProcessor* GrConstColorProcessor::TestCreate(GrProcessorTestData
* d) { |
107 GrColor color; | 107 GrColor color; |
108 int colorPicker = d->fRandom->nextULessThan(3); | 108 int colorPicker = d->fRandom->nextULessThan(3); |
109 switch (colorPicker) { | 109 switch (colorPicker) { |
110 case 0: { | 110 case 0: { |
111 uint32_t a = d->fRandom->nextULessThan(0x100); | 111 uint32_t a = d->fRandom->nextULessThan(0x100); |
112 uint32_t r = d->fRandom->nextULessThan(a+1); | 112 uint32_t r = d->fRandom->nextULessThan(a+1); |
113 uint32_t g = d->fRandom->nextULessThan(a+1); | 113 uint32_t g = d->fRandom->nextULessThan(a+1); |
114 uint32_t b = d->fRandom->nextULessThan(a+1); | 114 uint32_t b = d->fRandom->nextULessThan(a+1); |
115 color = GrColorPackRGBA(r, g, b, a); | 115 color = GrColorPackRGBA(r, g, b, a); |
116 break; | 116 break; |
117 } | 117 } |
118 case 1: | 118 case 1: |
119 color = 0; | 119 color = 0; |
120 break; | 120 break; |
121 case 2: | 121 case 2: |
122 color = d->fRandom->nextULessThan(0x100); | 122 color = d->fRandom->nextULessThan(0x100); |
123 color = color | (color << 8) | (color << 16) | (color << 24); | 123 color = color | (color << 8) | (color << 16) | (color << 24); |
124 break; | 124 break; |
125 } | 125 } |
126 InputMode mode = static_cast<InputMode>(d->fRandom->nextULessThan(kInputMode
Cnt)); | 126 InputMode mode = static_cast<InputMode>(d->fRandom->nextULessThan(kInputMode
Cnt)); |
127 return GrConstColorProcessor::Create(color, mode); | 127 return GrConstColorProcessor::Create(color, mode); |
128 } | 128 } |
OLD | NEW |