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

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

Issue 648463003: FPs now use the correct builder types(just a rename) (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: Created 6 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
« no previous file with comments | « src/effects/SkLumaColorFilter.cpp ('k') | src/effects/SkMorphologyImageFilter.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 77 matching lines...) Expand 10 before | Expand all | Expand 10 after
88 typedef GrSingleTextureEffect INHERITED; 88 typedef GrSingleTextureEffect INHERITED;
89 }; 89 };
90 90
91 // For brevity 91 // For brevity
92 typedef GrGLProgramDataManager::UniformHandle UniformHandle; 92 typedef GrGLProgramDataManager::UniformHandle UniformHandle;
93 93
94 class GrGLMagnifierEffect : public GrGLFragmentProcessor { 94 class GrGLMagnifierEffect : public GrGLFragmentProcessor {
95 public: 95 public:
96 GrGLMagnifierEffect(const GrBackendProcessorFactory&, const GrProcessor&); 96 GrGLMagnifierEffect(const GrBackendProcessorFactory&, const GrProcessor&);
97 97
98 virtual void emitCode(GrGLProgramBuilder*, 98 virtual void emitCode(GrGLFPBuilder*,
99 const GrFragmentProcessor&, 99 const GrFragmentProcessor&,
100 const GrProcessorKey&, 100 const GrProcessorKey&,
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 GrGLProgramDataManager&, const GrProcessor&) SK_O VERRIDE; 106 virtual void setData(const GrGLProgramDataManager&, const GrProcessor&) SK_O VERRIDE;
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 GrGLFragmentProcessor INHERITED; 113 typedef GrGLFragmentProcessor INHERITED;
114 }; 114 };
115 115
116 GrGLMagnifierEffect::GrGLMagnifierEffect(const GrBackendProcessorFactory& factor y, 116 GrGLMagnifierEffect::GrGLMagnifierEffect(const GrBackendProcessorFactory& factor y,
117 const GrProcessor&) 117 const GrProcessor&)
118 : INHERITED(factory) { 118 : INHERITED(factory) {
119 } 119 }
120 120
121 void GrGLMagnifierEffect::emitCode(GrGLProgramBuilder* builder, 121 void GrGLMagnifierEffect::emitCode(GrGLFPBuilder* builder,
122 const GrFragmentProcessor&, 122 const GrFragmentProcessor&,
123 const GrProcessorKey& key, 123 const GrProcessorKey& key,
124 const char* outputColor, 124 const char* outputColor,
125 const char* inputColor, 125 const char* inputColor,
126 const TransformedCoordsArray& coords, 126 const TransformedCoordsArray& coords,
127 const TextureSamplerArray& samplers) { 127 const TextureSamplerArray& samplers) {
128 fOffsetVar = builder->addUniform( 128 fOffsetVar = builder->addUniform(
129 GrGLProgramBuilder::kFragment_Visibility | 129 GrGLProgramBuilder::kFragment_Visibility |
130 GrGLProgramBuilder::kVertex_Visibility, 130 GrGLProgramBuilder::kVertex_Visibility,
131 kVec2f_GrSLType, "Offset"); 131 kVec2f_GrSLType, "Offset");
132 fInvZoomVar = builder->addUniform( 132 fInvZoomVar = builder->addUniform(
133 GrGLProgramBuilder::kFragment_Visibility | 133 GrGLProgramBuilder::kFragment_Visibility |
134 GrGLProgramBuilder::kVertex_Visibility, 134 GrGLProgramBuilder::kVertex_Visibility,
135 kVec2f_GrSLType, "InvZoom"); 135 kVec2f_GrSLType, "InvZoom");
136 fInvInsetVar = builder->addUniform( 136 fInvInsetVar = builder->addUniform(
137 GrGLProgramBuilder::kFragment_Visibility | 137 GrGLProgramBuilder::kFragment_Visibility |
138 GrGLProgramBuilder::kVertex_Visibility, 138 GrGLProgramBuilder::kVertex_Visibility,
139 kVec2f_GrSLType, "InvInset"); 139 kVec2f_GrSLType, "InvInset");
140 140
141 GrGLFragmentShaderBuilder* fsBuilder = builder->getFragmentShaderBuilder(); 141 GrGLFPFragmentBuilder* fsBuilder = builder->getFragmentShaderBuilder();
142 SkString coords2D = fsBuilder->ensureFSCoords2D(coords, 0); 142 SkString coords2D = fsBuilder->ensureFSCoords2D(coords, 0);
143 fsBuilder->codeAppendf("\t\tvec2 coord = %s;\n", coords2D.c_str()); 143 fsBuilder->codeAppendf("\t\tvec2 coord = %s;\n", coords2D.c_str());
144 fsBuilder->codeAppendf("\t\tvec2 zoom_coord = %s + %s * %s;\n", 144 fsBuilder->codeAppendf("\t\tvec2 zoom_coord = %s + %s * %s;\n",
145 builder->getUniformCStr(fOffsetVar), 145 builder->getUniformCStr(fOffsetVar),
146 coords2D.c_str(), 146 coords2D.c_str(),
147 builder->getUniformCStr(fInvZoomVar)); 147 builder->getUniformCStr(fInvZoomVar));
148 148
149 fsBuilder->codeAppend("\t\tvec2 delta = min(coord, vec2(1.0, 1.0) - coord);\ n"); 149 fsBuilder->codeAppend("\t\tvec2 delta = min(coord, vec2(1.0, 1.0) - coord);\ n");
150 150
151 fsBuilder->codeAppendf("\t\tdelta = delta * %s;\n", builder->getUniformCStr( fInvInsetVar)); 151 fsBuilder->codeAppendf("\t\tdelta = delta * %s;\n", builder->getUniformCStr( fInvInsetVar));
(...skipping 214 matching lines...) Expand 10 before | Expand all | Expand 10 after
366 366
367 int x_val = SkPin32(SkScalarFloorToInt(x_interp), 0, width - 1); 367 int x_val = SkPin32(SkScalarFloorToInt(x_interp), 0, width - 1);
368 int y_val = SkPin32(SkScalarFloorToInt(y_interp), 0, height - 1); 368 int y_val = SkPin32(SkScalarFloorToInt(y_interp), 0, height - 1);
369 369
370 *dptr = sptr[y_val * width + x_val]; 370 *dptr = sptr[y_val * width + x_val];
371 dptr++; 371 dptr++;
372 } 372 }
373 } 373 }
374 return true; 374 return true;
375 } 375 }
OLDNEW
« no previous file with comments | « src/effects/SkLumaColorFilter.cpp ('k') | src/effects/SkMorphologyImageFilter.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698