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

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

Issue 1709153002: Add more specialized fragment builders (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: Make MSVC happy Created 4 years, 10 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 111 matching lines...) Expand 10 before | Expand all | Expand 10 after
122 fInvZoomVar = uniformHandler->addUniform(kFragment_GrShaderFlag, 122 fInvZoomVar = uniformHandler->addUniform(kFragment_GrShaderFlag,
123 kVec2f_GrSLType, kDefault_GrSLPreci sion, 123 kVec2f_GrSLType, kDefault_GrSLPreci sion,
124 "InvZoom"); 124 "InvZoom");
125 fInvInsetVar = uniformHandler->addUniform(kFragment_GrShaderFlag, 125 fInvInsetVar = uniformHandler->addUniform(kFragment_GrShaderFlag,
126 kVec2f_GrSLType, kDefault_GrSLPrec ision, 126 kVec2f_GrSLType, kDefault_GrSLPrec ision,
127 "InvInset"); 127 "InvInset");
128 fBoundsVar = uniformHandler->addUniform(kFragment_GrShaderFlag, 128 fBoundsVar = uniformHandler->addUniform(kFragment_GrShaderFlag,
129 kVec4f_GrSLType, kDefault_GrSLPrecis ion, 129 kVec4f_GrSLType, kDefault_GrSLPrecis ion,
130 "Bounds"); 130 "Bounds");
131 131
132 GrGLSLFragmentBuilder* fragBuilder = args.fFragBuilder; 132 GrGLSLFPFragmentBuilder* fragBuilder = args.fFragBuilder;
133 SkString coords2D = fragBuilder->ensureFSCoords2D(args.fCoords, 0); 133 SkString coords2D = fragBuilder->ensureFSCoords2D(args.fCoords, 0);
134 fragBuilder->codeAppendf("\t\tvec2 coord = %s;\n", coords2D.c_str()); 134 fragBuilder->codeAppendf("\t\tvec2 coord = %s;\n", coords2D.c_str());
135 fragBuilder->codeAppendf("\t\tvec2 zoom_coord = %s + %s * %s;\n", 135 fragBuilder->codeAppendf("\t\tvec2 zoom_coord = %s + %s * %s;\n",
136 uniformHandler->getUniformCStr(fOffsetVar), 136 uniformHandler->getUniformCStr(fOffsetVar),
137 coords2D.c_str(), 137 coords2D.c_str(),
138 uniformHandler->getUniformCStr(fInvZoomVar)); 138 uniformHandler->getUniformCStr(fInvZoomVar));
139 const char* bounds = uniformHandler->getUniformCStr(fBoundsVar); 139 const char* bounds = uniformHandler->getUniformCStr(fBoundsVar);
140 fragBuilder->codeAppendf("\t\tvec2 delta = (coord - %s.xy) * %s.zw;\n", boun ds, bounds); 140 fragBuilder->codeAppendf("\t\tvec2 delta = (coord - %s.xy) * %s.zw;\n", boun ds, bounds);
141 fragBuilder->codeAppendf("\t\tdelta = min(delta, vec2(1.0, 1.0) - delta);\n" ); 141 fragBuilder->codeAppendf("\t\tdelta = min(delta, vec2(1.0, 1.0) - delta);\n" );
142 fragBuilder->codeAppendf("\t\tdelta = delta * %s;\n", 142 fragBuilder->codeAppendf("\t\tdelta = delta * %s;\n",
(...skipping 222 matching lines...) Expand 10 before | Expand all | Expand 10 after
365 365
366 #ifndef SK_IGNORE_TO_STRING 366 #ifndef SK_IGNORE_TO_STRING
367 void SkMagnifierImageFilter::toString(SkString* str) const { 367 void SkMagnifierImageFilter::toString(SkString* str) const {
368 str->appendf("SkMagnifierImageFilter: ("); 368 str->appendf("SkMagnifierImageFilter: (");
369 str->appendf("src: (%f,%f,%f,%f) ", 369 str->appendf("src: (%f,%f,%f,%f) ",
370 fSrcRect.fLeft, fSrcRect.fTop, fSrcRect.fRight, fSrcRect.fBotto m); 370 fSrcRect.fLeft, fSrcRect.fTop, fSrcRect.fRight, fSrcRect.fBotto m);
371 str->appendf("inset: %f", fInset); 371 str->appendf("inset: %f", fInset);
372 str->append(")"); 372 str->append(")");
373 } 373 }
374 #endif 374 #endif
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