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

Unified Diff: src/effects/SkMagnifierImageFilter.cpp

Issue 1490283004: Create GLSLUniformHandler class for gpu backend (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: clean up public api of uniformhandler Created 5 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « src/effects/SkLumaColorFilter.cpp ('k') | src/effects/SkMorphologyImageFilter.cpp » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/effects/SkMagnifierImageFilter.cpp
diff --git a/src/effects/SkMagnifierImageFilter.cpp b/src/effects/SkMagnifierImageFilter.cpp
index 911294444abadd37c11a36e512ea2b1d366410a6..45f630a0858b8f9745e3a47577fd7e46853eba06 100644
--- a/src/effects/SkMagnifierImageFilter.cpp
+++ b/src/effects/SkMagnifierImageFilter.cpp
@@ -19,8 +19,8 @@
#include "effects/GrSingleTextureEffect.h"
#include "glsl/GrGLSLFragmentProcessor.h"
#include "glsl/GrGLSLFragmentShaderBuilder.h"
-#include "glsl/GrGLSLProgramBuilder.h"
#include "glsl/GrGLSLProgramDataManager.h"
+#include "glsl/GrGLSLUniformHandler.h"
class GrMagnifierEffect : public GrSingleTextureEffect {
@@ -120,31 +120,32 @@ GrGLMagnifierEffect::GrGLMagnifierEffect(const GrProcessor&) {
}
void GrGLMagnifierEffect::emitCode(EmitArgs& args) {
- fOffsetVar = args.fBuilder->addUniform(
- GrGLSLProgramBuilder::kFragment_Visibility,
- kVec2f_GrSLType, kDefault_GrSLPrecision, "Offset");
- fInvZoomVar = args.fBuilder->addUniform(
- GrGLSLProgramBuilder::kFragment_Visibility,
- kVec2f_GrSLType, kDefault_GrSLPrecision, "InvZoom");
- fInvInsetVar = args.fBuilder->addUniform(
- GrGLSLProgramBuilder::kFragment_Visibility,
- kVec2f_GrSLType, kDefault_GrSLPrecision, "InvInset");
- fBoundsVar = args.fBuilder->addUniform(
- GrGLSLProgramBuilder::kFragment_Visibility,
- kVec4f_GrSLType, kDefault_GrSLPrecision, "Bounds");
+ GrGLSLUniformHandler* uniformHandler = args.fUniformHandler;
+ fOffsetVar = uniformHandler->addUniform(GrGLSLUniformHandler::kFragment_Visibility,
+ kVec2f_GrSLType, kDefault_GrSLPrecision,
+ "Offset");
+ fInvZoomVar = uniformHandler->addUniform(GrGLSLUniformHandler::kFragment_Visibility,
+ kVec2f_GrSLType, kDefault_GrSLPrecision,
+ "InvZoom");
+ fInvInsetVar = uniformHandler->addUniform(GrGLSLUniformHandler::kFragment_Visibility,
+ kVec2f_GrSLType, kDefault_GrSLPrecision,
+ "InvInset");
+ fBoundsVar = uniformHandler->addUniform(GrGLSLUniformHandler::kFragment_Visibility,
+ kVec4f_GrSLType, kDefault_GrSLPrecision,
+ "Bounds");
GrGLSLFragmentBuilder* fragBuilder = args.fFragBuilder;
SkString coords2D = fragBuilder->ensureFSCoords2D(args.fCoords, 0);
fragBuilder->codeAppendf("\t\tvec2 coord = %s;\n", coords2D.c_str());
fragBuilder->codeAppendf("\t\tvec2 zoom_coord = %s + %s * %s;\n",
- args.fBuilder->getUniformCStr(fOffsetVar),
+ uniformHandler->getUniformCStr(fOffsetVar),
coords2D.c_str(),
- args.fBuilder->getUniformCStr(fInvZoomVar));
- const char* bounds = args.fBuilder->getUniformCStr(fBoundsVar);
+ uniformHandler->getUniformCStr(fInvZoomVar));
+ const char* bounds = uniformHandler->getUniformCStr(fBoundsVar);
fragBuilder->codeAppendf("\t\tvec2 delta = (coord - %s.xy) * %s.zw;\n", bounds, bounds);
fragBuilder->codeAppendf("\t\tdelta = min(delta, vec2(1.0, 1.0) - delta);\n");
fragBuilder->codeAppendf("\t\tdelta = delta * %s;\n",
- args.fBuilder->getUniformCStr(fInvInsetVar));
+ uniformHandler->getUniformCStr(fInvInsetVar));
fragBuilder->codeAppend("\t\tfloat weight = 0.0;\n");
fragBuilder->codeAppend("\t\tif (delta.s < 2.0 && delta.t < 2.0) {\n");
« 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