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

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

Issue 385713005: Allow GrGLEffects to produce variable length keys. (Closed) Base URL: https://skia.googlesource.com/skia.git@key
Patch Set: rebase Created 6 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/effects/SkLumaColorFilter.cpp ('k') | src/effects/SkMatrixConvolutionImageFilter.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 2012 The Android Open Source Project 2 * Copyright 2012 The Android Open Source Project
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 "SkBitmap.h" 8 #include "SkBitmap.h"
9 #include "SkMagnifierImageFilter.h" 9 #include "SkMagnifierImageFilter.h"
10 #include "SkColorPriv.h" 10 #include "SkColorPriv.h"
(...skipping 79 matching lines...) Expand 10 before | Expand all | Expand 10 after
90 90
91 // For brevity 91 // For brevity
92 typedef GrGLUniformManager::UniformHandle UniformHandle; 92 typedef GrGLUniformManager::UniformHandle UniformHandle;
93 93
94 class GrGLMagnifierEffect : public GrGLEffect { 94 class GrGLMagnifierEffect : public GrGLEffect {
95 public: 95 public:
96 GrGLMagnifierEffect(const GrBackendEffectFactory&, const GrDrawEffect&); 96 GrGLMagnifierEffect(const GrBackendEffectFactory&, const GrDrawEffect&);
97 97
98 virtual void emitCode(GrGLShaderBuilder*, 98 virtual void emitCode(GrGLShaderBuilder*,
99 const GrDrawEffect&, 99 const GrDrawEffect&,
100 EffectKey, 100 const GrEffectKey&,
101 const char* outputColor, 101 const char* outputColor,
102 const char* inputColor, 102 const char* inputColor,
103 const TransformedCoordsArray&, 103 const TransformedCoordsArray&,
104 const TextureSamplerArray&) SK_OVERRIDE; 104 const TextureSamplerArray&) SK_OVERRIDE;
105 105
106 virtual void setData(const GrGLUniformManager&, const GrDrawEffect&) SK_OVER RIDE; 106 virtual void setData(const GrGLUniformManager&, const GrDrawEffect&) SK_OVER RIDE;
107 107
108 private: 108 private:
109 UniformHandle fOffsetVar; 109 UniformHandle fOffsetVar;
110 UniformHandle fInvZoomVar; 110 UniformHandle fInvZoomVar;
111 UniformHandle fInvInsetVar; 111 UniformHandle fInvInsetVar;
112 112
113 typedef GrGLEffect INHERITED; 113 typedef GrGLEffect INHERITED;
114 }; 114 };
115 115
116 GrGLMagnifierEffect::GrGLMagnifierEffect(const GrBackendEffectFactory& factory, const GrDrawEffect&) 116 GrGLMagnifierEffect::GrGLMagnifierEffect(const GrBackendEffectFactory& factory, const GrDrawEffect&)
117 : INHERITED(factory) { 117 : INHERITED(factory) {
118 } 118 }
119 119
120 void GrGLMagnifierEffect::emitCode(GrGLShaderBuilder* builder, 120 void GrGLMagnifierEffect::emitCode(GrGLShaderBuilder* builder,
121 const GrDrawEffect&, 121 const GrDrawEffect&,
122 EffectKey key, 122 const GrEffectKey& key,
123 const char* outputColor, 123 const char* outputColor,
124 const char* inputColor, 124 const char* inputColor,
125 const TransformedCoordsArray& coords, 125 const TransformedCoordsArray& coords,
126 const TextureSamplerArray& samplers) { 126 const TextureSamplerArray& samplers) {
127 SkString coords2D = builder->ensureFSCoords2D(coords, 0); 127 SkString coords2D = builder->ensureFSCoords2D(coords, 0);
128 fOffsetVar = builder->addUniform( 128 fOffsetVar = builder->addUniform(
129 GrGLShaderBuilder::kFragment_Visibility | 129 GrGLShaderBuilder::kFragment_Visibility |
130 GrGLShaderBuilder::kVertex_Visibility, 130 GrGLShaderBuilder::kVertex_Visibility,
131 kVec2f_GrSLType, "Offset"); 131 kVec2f_GrSLType, "Offset");
132 fInvZoomVar = builder->addUniform( 132 fInvZoomVar = builder->addUniform(
(...skipping 209 matching lines...) Expand 10 before | Expand all | Expand 10 after
342 342
343 int x_val = SkPin32(SkScalarFloorToInt(x_interp), 0, width - 1); 343 int x_val = SkPin32(SkScalarFloorToInt(x_interp), 0, width - 1);
344 int y_val = SkPin32(SkScalarFloorToInt(y_interp), 0, height - 1); 344 int y_val = SkPin32(SkScalarFloorToInt(y_interp), 0, height - 1);
345 345
346 *dptr = sptr[y_val * width + x_val]; 346 *dptr = sptr[y_val * width + x_val];
347 dptr++; 347 dptr++;
348 } 348 }
349 } 349 }
350 return true; 350 return true;
351 } 351 }
OLDNEW
« no previous file with comments | « src/effects/SkLumaColorFilter.cpp ('k') | src/effects/SkMatrixConvolutionImageFilter.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698