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/builders/GrGLProgramBuilder.h" | 10 #include "gl/builders/GrGLProgramBuilder.h" |
(...skipping 87 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
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; |
102 } | 102 } |
103 | 103 |
104 /////////////////////////////////////////////////////////////////////////////// | 104 /////////////////////////////////////////////////////////////////////////////// |
105 | 105 |
106 GR_DEFINE_FRAGMENT_PROCESSOR_TEST(GrConstColorProcessor); | 106 GR_DEFINE_FRAGMENT_PROCESSOR_TEST(GrConstColorProcessor); |
107 | 107 |
108 GrFragmentProcessor* GrConstColorProcessor::TestCreate(SkRandom* random, | 108 GrFragmentProcessor* GrConstColorProcessor::TestCreate(GrProcessorTestData* d) { |
109 GrContext*, | |
110 const GrCaps&, | |
111 GrTexture*[]) { | |
112 GrColor color; | 109 GrColor color; |
113 int colorPicker = random->nextULessThan(3); | 110 int colorPicker = d->fRandom->nextULessThan(3); |
114 switch (colorPicker) { | 111 switch (colorPicker) { |
115 case 0: { | 112 case 0: { |
116 uint32_t a = random->nextULessThan(0x100); | 113 uint32_t a = d->fRandom->nextULessThan(0x100); |
117 uint32_t r = random->nextULessThan(a+1); | 114 uint32_t r = d->fRandom->nextULessThan(a+1); |
118 uint32_t g = random->nextULessThan(a+1); | 115 uint32_t g = d->fRandom->nextULessThan(a+1); |
119 uint32_t b = random->nextULessThan(a+1); | 116 uint32_t b = d->fRandom->nextULessThan(a+1); |
120 color = GrColorPackRGBA(r, g, b, a); | 117 color = GrColorPackRGBA(r, g, b, a); |
121 break; | 118 break; |
122 } | 119 } |
123 case 1: | 120 case 1: |
124 color = 0; | 121 color = 0; |
125 break; | 122 break; |
126 case 2: | 123 case 2: |
127 color = random->nextULessThan(0x100); | 124 color = d->fRandom->nextULessThan(0x100); |
128 color = color | (color << 8) | (color << 16) | (color << 24); | 125 color = color | (color << 8) | (color << 16) | (color << 24); |
129 break; | 126 break; |
130 } | 127 } |
131 InputMode mode = static_cast<InputMode>(random->nextULessThan(kInputModeCnt)
); | 128 InputMode mode = static_cast<InputMode>(d->fRandom->nextULessThan(kInputMode
Cnt)); |
132 return GrConstColorProcessor::Create(color, mode); | 129 return GrConstColorProcessor::Create(color, mode); |
133 } | 130 } |
OLD | NEW |