Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(208)

Side by Side Diff: src/gpu/effects/GrConstColorProcessor.cpp

Issue 1213623022: fix up test create functions (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: more cleanup Created 5 years, 5 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « src/gpu/effects/GrConfigConversionEffect.cpp ('k') | src/gpu/effects/GrConvexPolyEffect.cpp » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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
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 }
OLDNEW
« no previous file with comments | « src/gpu/effects/GrConfigConversionEffect.cpp ('k') | src/gpu/effects/GrConvexPolyEffect.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698