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 "GrInvariantOutput.h" | 9 #include "GrInvariantOutput.h" |
10 #include "glsl/GrGLSLFragmentProcessor.h" | 10 #include "glsl/GrGLSLFragmentProcessor.h" |
(...skipping 94 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
105 | 105 |
106 bool GrConstColorProcessor::onIsEqual(const GrFragmentProcessor& other) const { | 106 bool GrConstColorProcessor::onIsEqual(const GrFragmentProcessor& other) const { |
107 const GrConstColorProcessor& that = other.cast<GrConstColorProcessor>(); | 107 const GrConstColorProcessor& that = other.cast<GrConstColorProcessor>(); |
108 return fMode == that.fMode && fColor == that.fColor; | 108 return fMode == that.fMode && fColor == that.fColor; |
109 } | 109 } |
110 | 110 |
111 /////////////////////////////////////////////////////////////////////////////// | 111 /////////////////////////////////////////////////////////////////////////////// |
112 | 112 |
113 GR_DEFINE_FRAGMENT_PROCESSOR_TEST(GrConstColorProcessor); | 113 GR_DEFINE_FRAGMENT_PROCESSOR_TEST(GrConstColorProcessor); |
114 | 114 |
115 const GrFragmentProcessor* GrConstColorProcessor::TestCreate(GrProcessorTestData
* d) { | 115 sk_sp<GrFragmentProcessor> GrConstColorProcessor::TestCreate(GrProcessorTestData
* d) { |
116 GrColor color SK_INIT_TO_AVOID_WARNING; | 116 GrColor color SK_INIT_TO_AVOID_WARNING; |
117 int colorPicker = d->fRandom->nextULessThan(3); | 117 int colorPicker = d->fRandom->nextULessThan(3); |
118 switch (colorPicker) { | 118 switch (colorPicker) { |
119 case 0: { | 119 case 0: { |
120 uint32_t a = d->fRandom->nextULessThan(0x100); | 120 uint32_t a = d->fRandom->nextULessThan(0x100); |
121 uint32_t r = d->fRandom->nextULessThan(a+1); | 121 uint32_t r = d->fRandom->nextULessThan(a+1); |
122 uint32_t g = d->fRandom->nextULessThan(a+1); | 122 uint32_t g = d->fRandom->nextULessThan(a+1); |
123 uint32_t b = d->fRandom->nextULessThan(a+1); | 123 uint32_t b = d->fRandom->nextULessThan(a+1); |
124 color = GrColorPackRGBA(r, g, b, a); | 124 color = GrColorPackRGBA(r, g, b, a); |
125 break; | 125 break; |
126 } | 126 } |
127 case 1: | 127 case 1: |
128 color = 0; | 128 color = 0; |
129 break; | 129 break; |
130 case 2: | 130 case 2: |
131 color = d->fRandom->nextULessThan(0x100); | 131 color = d->fRandom->nextULessThan(0x100); |
132 color = color | (color << 8) | (color << 16) | (color << 24); | 132 color = color | (color << 8) | (color << 16) | (color << 24); |
133 break; | 133 break; |
134 } | 134 } |
135 InputMode mode = static_cast<InputMode>(d->fRandom->nextULessThan(kInputMode
Cnt)); | 135 InputMode mode = static_cast<InputMode>(d->fRandom->nextULessThan(kInputMode
Cnt)); |
136 return GrConstColorProcessor::Create(color, mode); | 136 return GrConstColorProcessor::Make(color, mode); |
137 } | 137 } |
OLD | NEW |