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 89 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
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(SkRandom* random, |
109 GrContext*, | 109 GrContext*, |
110 const GrDrawTargetCaps&, | 110 const GrCaps&, |
111 GrTexture*[]) { | 111 GrTexture*[]) { |
112 GrColor color; | 112 GrColor color; |
113 int colorPicker = random->nextULessThan(3); | 113 int colorPicker = random->nextULessThan(3); |
114 switch (colorPicker) { | 114 switch (colorPicker) { |
115 case 0: { | 115 case 0: { |
116 uint32_t a = random->nextULessThan(0x100); | 116 uint32_t a = random->nextULessThan(0x100); |
117 uint32_t r = random->nextULessThan(a+1); | 117 uint32_t r = random->nextULessThan(a+1); |
118 uint32_t g = random->nextULessThan(a+1); | 118 uint32_t g = random->nextULessThan(a+1); |
119 uint32_t b = random->nextULessThan(a+1); | 119 uint32_t b = random->nextULessThan(a+1); |
120 color = GrColorPackRGBA(r, g, b, a); | 120 color = GrColorPackRGBA(r, g, b, a); |
121 break; | 121 break; |
122 } | 122 } |
123 case 1: | 123 case 1: |
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 |