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

Side by Side Diff: src/effects/SkAlphaThresholdFilter.cpp

Issue 365853002: Rename GrGLUniformManager to GrGLProgramResourceManager (Closed) Base URL: https://skia.googlesource.com/skia.git@02-path-program-fragment
Patch Set: rebase Created 6 years, 4 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 | « gyp/gpu.gypi ('k') | src/effects/SkArithmeticMode.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 2013 Google Inc. 2 * Copyright 2013 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 "SkAlphaThresholdFilter.h" 8 #include "SkAlphaThresholdFilter.h"
9 #include "SkBitmap.h" 9 #include "SkBitmap.h"
10 #include "SkReadBuffer.h" 10 #include "SkReadBuffer.h"
(...skipping 106 matching lines...) Expand 10 before | Expand all | Expand 10 after
117 GrGLAlphaThresholdEffect(const GrBackendEffectFactory&, const GrDrawEffect&) ; 117 GrGLAlphaThresholdEffect(const GrBackendEffectFactory&, const GrDrawEffect&) ;
118 118
119 virtual void emitCode(GrGLShaderBuilder*, 119 virtual void emitCode(GrGLShaderBuilder*,
120 const GrDrawEffect&, 120 const GrDrawEffect&,
121 const GrEffectKey&, 121 const GrEffectKey&,
122 const char* outputColor, 122 const char* outputColor,
123 const char* inputColor, 123 const char* inputColor,
124 const TransformedCoordsArray&, 124 const TransformedCoordsArray&,
125 const TextureSamplerArray&) SK_OVERRIDE; 125 const TextureSamplerArray&) SK_OVERRIDE;
126 126
127 virtual void setData(const GrGLUniformManager&, const GrDrawEffect&) SK_OVER RIDE; 127 virtual void setData(const GrGLProgramDataManager&, const GrDrawEffect&) SK_ OVERRIDE;
128 128
129 private: 129 private:
130 130
131 GrGLUniformManager::UniformHandle fInnerThresholdVar; 131 GrGLProgramDataManager::UniformHandle fInnerThresholdVar;
132 GrGLUniformManager::UniformHandle fOuterThresholdVar; 132 GrGLProgramDataManager::UniformHandle fOuterThresholdVar;
133 133
134 typedef GrGLEffect INHERITED; 134 typedef GrGLEffect INHERITED;
135 }; 135 };
136 136
137 GrGLAlphaThresholdEffect::GrGLAlphaThresholdEffect(const GrBackendEffectFactory& factory, const GrDrawEffect&) 137 GrGLAlphaThresholdEffect::GrGLAlphaThresholdEffect(const GrBackendEffectFactory& factory, const GrDrawEffect&)
138 : INHERITED(factory) { 138 : INHERITED(factory) {
139 } 139 }
140 140
141 void GrGLAlphaThresholdEffect::emitCode(GrGLShaderBuilder* builder, 141 void GrGLAlphaThresholdEffect::emitCode(GrGLShaderBuilder* builder,
142 const GrDrawEffect&, 142 const GrDrawEffect&,
(...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after
179 "\t\t} else if (color.a < inner_thresh) {\n" 179 "\t\t} else if (color.a < inner_thresh) {\n"
180 "\t\t\tfloat scale = inner_thresh / max(0.001, color.a );\n" 180 "\t\t\tfloat scale = inner_thresh / max(0.001, color.a );\n"
181 "\t\t\tcolor.rgb *= scale;\n" 181 "\t\t\tcolor.rgb *= scale;\n"
182 "\t\t\tcolor.a = inner_thresh;\n" 182 "\t\t\tcolor.a = inner_thresh;\n"
183 "\t\t}\n"); 183 "\t\t}\n");
184 184
185 builder->fsCodeAppendf("%s = %s;\n", outputColor, 185 builder->fsCodeAppendf("%s = %s;\n", outputColor,
186 (GrGLSLExpr4(inputColor) * GrGLSLExpr4("color")).c_st r()); 186 (GrGLSLExpr4(inputColor) * GrGLSLExpr4("color")).c_st r());
187 } 187 }
188 188
189 void GrGLAlphaThresholdEffect::setData(const GrGLUniformManager& uman, 189 void GrGLAlphaThresholdEffect::setData(const GrGLProgramDataManager& pdman,
190 const GrDrawEffect& drawEffect) { 190 const GrDrawEffect& drawEffect) {
191 const AlphaThresholdEffect& alpha_threshold = 191 const AlphaThresholdEffect& alpha_threshold =
192 drawEffect.castEffect<AlphaThresholdEffect>(); 192 drawEffect.castEffect<AlphaThresholdEffect>();
193 uman.set1f(fInnerThresholdVar, alpha_threshold.innerThreshold()); 193 pdman.set1f(fInnerThresholdVar, alpha_threshold.innerThreshold());
194 uman.set1f(fOuterThresholdVar, alpha_threshold.outerThreshold()); 194 pdman.set1f(fOuterThresholdVar, alpha_threshold.outerThreshold());
195 } 195 }
196 196
197 ///////////////////////////////////////////////////////////////////// 197 /////////////////////////////////////////////////////////////////////
198 198
199 GR_DEFINE_EFFECT_TEST(AlphaThresholdEffect); 199 GR_DEFINE_EFFECT_TEST(AlphaThresholdEffect);
200 200
201 GrEffect* AlphaThresholdEffect::TestCreate(SkRandom* random, 201 GrEffect* AlphaThresholdEffect::TestCreate(SkRandom* random,
202 GrContext* context, 202 GrContext* context,
203 const GrDrawTargetCaps&, 203 const GrDrawTargetCaps&,
204 GrTexture** textures) { 204 GrTexture** textures) {
(...skipping 155 matching lines...) Expand 10 before | Expand all | Expand 10 after
360 (U8CPU)(SkColorGetG(source) * scale), 360 (U8CPU)(SkColorGetG(source) * scale),
361 (U8CPU)(SkColorGetB(source) * scale)); 361 (U8CPU)(SkColorGetB(source) * scale));
362 } 362 }
363 } 363 }
364 dptr[y * dst->width() + x] = output_color; 364 dptr[y * dst->width() + x] = output_color;
365 } 365 }
366 } 366 }
367 367
368 return true; 368 return true;
369 } 369 }
OLDNEW
« no previous file with comments | « gyp/gpu.gypi ('k') | src/effects/SkArithmeticMode.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698