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

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

Issue 1110033004: Make XPFragmentBuilder only Builder with access to DstCopy. (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: Created 5 years, 7 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 133 matching lines...) Expand 10 before | Expand all | Expand 10 after
144 kVec2f_GrSLType, kDefault_GrSLPrecision, "InvZoom"); 144 kVec2f_GrSLType, kDefault_GrSLPrecision, "InvZoom");
145 fInvInsetVar = builder->addUniform( 145 fInvInsetVar = builder->addUniform(
146 GrGLProgramBuilder::kFragment_Visibility | 146 GrGLProgramBuilder::kFragment_Visibility |
147 GrGLProgramBuilder::kVertex_Visibility, 147 GrGLProgramBuilder::kVertex_Visibility,
148 kVec2f_GrSLType, kDefault_GrSLPrecision, "InvInset"); 148 kVec2f_GrSLType, kDefault_GrSLPrecision, "InvInset");
149 fBoundsVar = builder->addUniform( 149 fBoundsVar = builder->addUniform(
150 GrGLProgramBuilder::kFragment_Visibility | 150 GrGLProgramBuilder::kFragment_Visibility |
151 GrGLProgramBuilder::kVertex_Visibility, 151 GrGLProgramBuilder::kVertex_Visibility,
152 kVec4f_GrSLType, kDefault_GrSLPrecision, "Bounds"); 152 kVec4f_GrSLType, kDefault_GrSLPrecision, "Bounds");
153 153
154 GrGLFPFragmentBuilder* fsBuilder = builder->getFragmentShaderBuilder(); 154 GrGLFragmentBuilder* fsBuilder = builder->getFragmentShaderBuilder();
155 SkString coords2D = fsBuilder->ensureFSCoords2D(coords, 0); 155 SkString coords2D = fsBuilder->ensureFSCoords2D(coords, 0);
156 fsBuilder->codeAppendf("\t\tvec2 coord = %s;\n", coords2D.c_str()); 156 fsBuilder->codeAppendf("\t\tvec2 coord = %s;\n", coords2D.c_str());
157 fsBuilder->codeAppendf("\t\tvec2 zoom_coord = %s + %s * %s;\n", 157 fsBuilder->codeAppendf("\t\tvec2 zoom_coord = %s + %s * %s;\n",
158 builder->getUniformCStr(fOffsetVar), 158 builder->getUniformCStr(fOffsetVar),
159 coords2D.c_str(), 159 coords2D.c_str(),
160 builder->getUniformCStr(fInvZoomVar)); 160 builder->getUniformCStr(fInvZoomVar));
161 const char* bounds = builder->getUniformCStr(fBoundsVar); 161 const char* bounds = builder->getUniformCStr(fBoundsVar);
162 fsBuilder->codeAppendf("\t\tvec2 delta = (coord - %s.xy) * %s.zw;\n", bounds , bounds); 162 fsBuilder->codeAppendf("\t\tvec2 delta = (coord - %s.xy) * %s.zw;\n", bounds , bounds);
163 fsBuilder->codeAppendf("\t\tdelta = min(delta, vec2(1.0, 1.0) - delta);\n"); 163 fsBuilder->codeAppendf("\t\tdelta = min(delta, vec2(1.0, 1.0) - delta);\n");
164 fsBuilder->codeAppendf("\t\tdelta = delta * %s;\n", builder->getUniformCStr( fInvInsetVar)); 164 fsBuilder->codeAppendf("\t\tdelta = delta * %s;\n", builder->getUniformCStr( fInvInsetVar));
(...skipping 220 matching lines...) Expand 10 before | Expand all | Expand 10 after
385 385
386 #ifndef SK_IGNORE_TO_STRING 386 #ifndef SK_IGNORE_TO_STRING
387 void SkMagnifierImageFilter::toString(SkString* str) const { 387 void SkMagnifierImageFilter::toString(SkString* str) const {
388 str->appendf("SkMagnifierImageFilter: ("); 388 str->appendf("SkMagnifierImageFilter: (");
389 str->appendf("src: (%f,%f,%f,%f) ", 389 str->appendf("src: (%f,%f,%f,%f) ",
390 fSrcRect.fLeft, fSrcRect.fTop, fSrcRect.fRight, fSrcRect.fBotto m); 390 fSrcRect.fLeft, fSrcRect.fTop, fSrcRect.fRight, fSrcRect.fBotto m);
391 str->appendf("inset: %f", fInset); 391 str->appendf("inset: %f", fInset);
392 str->append(")"); 392 str->append(")");
393 } 393 }
394 #endif 394 #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