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

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

Issue 26190003: Potentially optimize some GrGLEffects for known input color values (Closed) Base URL: https://skia.googlecode.com/svn/trunk
Patch Set: Created 7 years, 2 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 | Annotate | Revision Log
« no previous file with comments | « src/effects/SkColorMatrixFilter.cpp ('k') | src/effects/SkLightingImageFilter.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 "SkDisplacementMapEffect.h" 8 #include "SkDisplacementMapEffect.h"
9 #include "SkFlattenableBuffers.h" 9 #include "SkFlattenableBuffers.h"
10 #include "SkUnPreMultiply.h" 10 #include "SkUnPreMultiply.h"
(...skipping 190 matching lines...) Expand 10 before | Expand all | Expand 10 after
201 class GrGLDisplacementMapEffect : public GrGLEffect { 201 class GrGLDisplacementMapEffect : public GrGLEffect {
202 public: 202 public:
203 GrGLDisplacementMapEffect(const GrBackendEffectFactory& factory, 203 GrGLDisplacementMapEffect(const GrBackendEffectFactory& factory,
204 const GrDrawEffect& drawEffect); 204 const GrDrawEffect& drawEffect);
205 virtual ~GrGLDisplacementMapEffect(); 205 virtual ~GrGLDisplacementMapEffect();
206 206
207 virtual void emitCode(GrGLShaderBuilder*, 207 virtual void emitCode(GrGLShaderBuilder*,
208 const GrDrawEffect&, 208 const GrDrawEffect&,
209 EffectKey, 209 EffectKey,
210 const char* outputColor, 210 const char* outputColor,
211 const char* inputColor, 211 const GrGLSLExpr4& inputColor,
212 const TransformedCoordsArray&, 212 const TransformedCoordsArray&,
213 const TextureSamplerArray&) SK_OVERRIDE; 213 const TextureSamplerArray&) SK_OVERRIDE;
214 214
215 static inline EffectKey GenKey(const GrDrawEffect&, const GrGLCaps&); 215 static inline EffectKey GenKey(const GrDrawEffect&, const GrGLCaps&);
216 216
217 virtual void setData(const GrGLUniformManager&, const GrDrawEffect&) SK_OVER RIDE; 217 virtual void setData(const GrGLUniformManager&, const GrDrawEffect&) SK_OVER RIDE;
218 218
219 private: 219 private:
220 SkDisplacementMapEffect::ChannelSelectorType fXChannelSelector; 220 SkDisplacementMapEffect::ChannelSelectorType fXChannelSelector;
221 SkDisplacementMapEffect::ChannelSelectorType fYChannelSelector; 221 SkDisplacementMapEffect::ChannelSelectorType fYChannelSelector;
(...skipping 178 matching lines...) Expand 10 before | Expand all | Expand 10 after
400 , fYChannelSelector(drawEffect.castEffect<GrDisplacementMapEffect>().yChanne lSelector()) { 400 , fYChannelSelector(drawEffect.castEffect<GrDisplacementMapEffect>().yChanne lSelector()) {
401 } 401 }
402 402
403 GrGLDisplacementMapEffect::~GrGLDisplacementMapEffect() { 403 GrGLDisplacementMapEffect::~GrGLDisplacementMapEffect() {
404 } 404 }
405 405
406 void GrGLDisplacementMapEffect::emitCode(GrGLShaderBuilder* builder, 406 void GrGLDisplacementMapEffect::emitCode(GrGLShaderBuilder* builder,
407 const GrDrawEffect&, 407 const GrDrawEffect&,
408 EffectKey key, 408 EffectKey key,
409 const char* outputColor, 409 const char* outputColor,
410 const char* inputColor, 410 const GrGLSLExpr4& inputColor,
411 const TransformedCoordsArray& coords, 411 const TransformedCoordsArray& coords,
412 const TextureSamplerArray& samplers) { 412 const TextureSamplerArray& samplers) {
413 sk_ignore_unused_variable(inputColor); 413 sk_ignore_unused_variable(inputColor);
414 414
415 fScaleUni = builder->addUniform(GrGLShaderBuilder::kFragment_Visibility, 415 fScaleUni = builder->addUniform(GrGLShaderBuilder::kFragment_Visibility,
416 kVec2f_GrSLType, "Scale"); 416 kVec2f_GrSLType, "Scale");
417 const char* scaleUni = builder->getUniformCStr(fScaleUni); 417 const char* scaleUni = builder->getUniformCStr(fScaleUni);
418 const char* dColor = "dColor"; 418 const char* dColor = "dColor";
419 const char* cCoords = "cCoords"; 419 const char* cCoords = "cCoords";
420 const char* outOfBounds = "outOfBounds"; 420 const char* outOfBounds = "outOfBounds";
(...skipping 75 matching lines...) Expand 10 before | Expand all | Expand 10 after
496 const GrGLCaps&) { 496 const GrGLCaps&) {
497 const GrDisplacementMapEffect& displacementMap = 497 const GrDisplacementMapEffect& displacementMap =
498 drawEffect.castEffect<GrDisplacementMapEffect>(); 498 drawEffect.castEffect<GrDisplacementMapEffect>();
499 499
500 EffectKey xKey = displacementMap.xChannelSelector(); 500 EffectKey xKey = displacementMap.xChannelSelector();
501 EffectKey yKey = displacementMap.yChannelSelector() << SkDisplacementMapEffe ct::kKeyBits; 501 EffectKey yKey = displacementMap.yChannelSelector() << SkDisplacementMapEffe ct::kKeyBits;
502 502
503 return xKey | yKey; 503 return xKey | yKey;
504 } 504 }
505 #endif 505 #endif
OLDNEW
« no previous file with comments | « src/effects/SkColorMatrixFilter.cpp ('k') | src/effects/SkLightingImageFilter.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698