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

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

Issue 788733003: Make addUniform take a precision (Closed) Base URL: https://skia.googlesource.com/skia.git@move_prec
Patch Set: rebase Created 6 years 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/SkLightingImageFilter.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 107 matching lines...) Expand 10 before | Expand all | Expand 10 after
118 118
119 void GrGLMagnifierEffect::emitCode(GrGLFPBuilder* builder, 119 void GrGLMagnifierEffect::emitCode(GrGLFPBuilder* builder,
120 const GrFragmentProcessor&, 120 const GrFragmentProcessor&,
121 const char* outputColor, 121 const char* outputColor,
122 const char* inputColor, 122 const char* inputColor,
123 const TransformedCoordsArray& coords, 123 const TransformedCoordsArray& coords,
124 const TextureSamplerArray& samplers) { 124 const TextureSamplerArray& samplers) {
125 fOffsetVar = builder->addUniform( 125 fOffsetVar = builder->addUniform(
126 GrGLProgramBuilder::kFragment_Visibility | 126 GrGLProgramBuilder::kFragment_Visibility |
127 GrGLProgramBuilder::kVertex_Visibility, 127 GrGLProgramBuilder::kVertex_Visibility,
128 kVec2f_GrSLType, "Offset"); 128 kVec2f_GrSLType, kDefault_GrSLPrecision, "Offset");
129 fInvZoomVar = builder->addUniform( 129 fInvZoomVar = builder->addUniform(
130 GrGLProgramBuilder::kFragment_Visibility | 130 GrGLProgramBuilder::kFragment_Visibility |
131 GrGLProgramBuilder::kVertex_Visibility, 131 GrGLProgramBuilder::kVertex_Visibility,
132 kVec2f_GrSLType, "InvZoom"); 132 kVec2f_GrSLType, kDefault_GrSLPrecision, "InvZoom");
133 fInvInsetVar = builder->addUniform( 133 fInvInsetVar = builder->addUniform(
134 GrGLProgramBuilder::kFragment_Visibility | 134 GrGLProgramBuilder::kFragment_Visibility |
135 GrGLProgramBuilder::kVertex_Visibility, 135 GrGLProgramBuilder::kVertex_Visibility,
136 kVec2f_GrSLType, "InvInset"); 136 kVec2f_GrSLType, kDefault_GrSLPrecision, "InvInset");
137 137
138 GrGLFPFragmentBuilder* fsBuilder = builder->getFragmentShaderBuilder(); 138 GrGLFPFragmentBuilder* fsBuilder = builder->getFragmentShaderBuilder();
139 SkString coords2D = fsBuilder->ensureFSCoords2D(coords, 0); 139 SkString coords2D = fsBuilder->ensureFSCoords2D(coords, 0);
140 fsBuilder->codeAppendf("\t\tvec2 coord = %s;\n", coords2D.c_str()); 140 fsBuilder->codeAppendf("\t\tvec2 coord = %s;\n", coords2D.c_str());
141 fsBuilder->codeAppendf("\t\tvec2 zoom_coord = %s + %s * %s;\n", 141 fsBuilder->codeAppendf("\t\tvec2 zoom_coord = %s + %s * %s;\n",
142 builder->getUniformCStr(fOffsetVar), 142 builder->getUniformCStr(fOffsetVar),
143 coords2D.c_str(), 143 coords2D.c_str(),
144 builder->getUniformCStr(fInvZoomVar)); 144 builder->getUniformCStr(fInvZoomVar));
145 145
146 fsBuilder->codeAppend("\t\tvec2 delta = min(coord, vec2(1.0, 1.0) - coord);\ n"); 146 fsBuilder->codeAppend("\t\tvec2 delta = min(coord, vec2(1.0, 1.0) - coord);\ n");
(...skipping 203 matching lines...) Expand 10 before | Expand all | Expand 10 after
350 350
351 int x_val = SkPin32(SkScalarFloorToInt(x_interp), 0, width - 1); 351 int x_val = SkPin32(SkScalarFloorToInt(x_interp), 0, width - 1);
352 int y_val = SkPin32(SkScalarFloorToInt(y_interp), 0, height - 1); 352 int y_val = SkPin32(SkScalarFloorToInt(y_interp), 0, height - 1);
353 353
354 *dptr = sptr[y_val * width + x_val]; 354 *dptr = sptr[y_val * width + x_val];
355 dptr++; 355 dptr++;
356 } 356 }
357 } 357 }
358 return true; 358 return true;
359 } 359 }
OLDNEW
« no previous file with comments | « src/effects/SkLightingImageFilter.cpp ('k') | src/effects/SkMorphologyImageFilter.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698