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

Side by Side Diff: src/gpu/effects/GrConvexPolyEffect.cpp

Issue 1416423003: Make GrGLSLProgramBuilder base class for ProgramBuilder (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: nit Created 5 years, 1 month 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/gpu/effects/GrBitmapTextGeoProc.cpp ('k') | src/gpu/effects/GrCustomXfermode.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 2014 Google Inc. 2 * Copyright 2014 Google Inc.
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 "GrConvexPolyEffect.h" 8 #include "GrConvexPolyEffect.h"
9 #include "GrInvariantOutput.h" 9 #include "GrInvariantOutput.h"
10 #include "SkPathPriv.h" 10 #include "SkPathPriv.h"
(...skipping 194 matching lines...) Expand 10 before | Expand all | Expand 10 after
205 fsBuilder->codeAppendf("\t\tedge = dot(%s[%d], vec3(%s.x, %s.y, 1));\n", 205 fsBuilder->codeAppendf("\t\tedge = dot(%s[%d], vec3(%s.x, %s.y, 1));\n",
206 edgeArrayName, i, fragmentPos, fragmentPos); 206 edgeArrayName, i, fragmentPos, fragmentPos);
207 if (GrProcessorEdgeTypeIsAA(cpe.getEdgeType())) { 207 if (GrProcessorEdgeTypeIsAA(cpe.getEdgeType())) {
208 fsBuilder->codeAppend("\t\tedge = clamp(edge, 0.0, 1.0);\n"); 208 fsBuilder->codeAppend("\t\tedge = clamp(edge, 0.0, 1.0);\n");
209 } else { 209 } else {
210 fsBuilder->codeAppend("\t\tedge = edge >= 0.5 ? 1.0 : 0.0;\n"); 210 fsBuilder->codeAppend("\t\tedge = edge >= 0.5 ? 1.0 : 0.0;\n");
211 } 211 }
212 fsBuilder->codeAppend("\t\talpha *= edge;\n"); 212 fsBuilder->codeAppend("\t\talpha *= edge;\n");
213 } 213 }
214 214
215 // Woe is me. See https://bug.skia.org/2149 .
216 if (kTegra2_GrGLRenderer == args.fBuilder->ctxInfo().renderer()) {
217 fsBuilder->codeAppend("\t\tif (-1.0 == alpha) {\n\t\t\tdiscard;\n\t\t}\n ");
218 }
219
220 if (GrProcessorEdgeTypeIsInverseFill(cpe.getEdgeType())) { 215 if (GrProcessorEdgeTypeIsInverseFill(cpe.getEdgeType())) {
221 fsBuilder->codeAppend("\talpha = 1.0 - alpha;\n"); 216 fsBuilder->codeAppend("\talpha = 1.0 - alpha;\n");
222 } 217 }
223 fsBuilder->codeAppendf("\t%s = %s;\n", args.fOutputColor, 218 fsBuilder->codeAppendf("\t%s = %s;\n", args.fOutputColor,
224 (GrGLSLExpr4(args.fInputColor) * GrGLSLExpr1("alpha") ).c_str()); 219 (GrGLSLExpr4(args.fInputColor) * GrGLSLExpr1("alpha") ).c_str());
225 } 220 }
226 221
227 void GrGLConvexPolyEffect::onSetData(const GrGLSLProgramDataManager& pdman, 222 void GrGLConvexPolyEffect::onSetData(const GrGLSLProgramDataManager& pdman,
228 const GrProcessor& effect) { 223 const GrProcessor& effect) {
229 const GrConvexPolyEffect& cpe = effect.cast<GrConvexPolyEffect>(); 224 const GrConvexPolyEffect& cpe = effect.cast<GrConvexPolyEffect>();
(...skipping 121 matching lines...) Expand 10 before | Expand all | Expand 10 after
351 } 346 }
352 347
353 GrFragmentProcessor* fp; 348 GrFragmentProcessor* fp;
354 do { 349 do {
355 GrPrimitiveEdgeType edgeType = static_cast<GrPrimitiveEdgeType>( 350 GrPrimitiveEdgeType edgeType = static_cast<GrPrimitiveEdgeType>(
356 d->fRandom->nextULessThan(kGrProcessorEdgeTypeCnt)); 351 d->fRandom->nextULessThan(kGrProcessorEdgeTypeCnt));
357 fp = GrConvexPolyEffect::Create(edgeType, count, edges); 352 fp = GrConvexPolyEffect::Create(edgeType, count, edges);
358 } while (nullptr == fp); 353 } while (nullptr == fp);
359 return fp; 354 return fp;
360 } 355 }
OLDNEW
« no previous file with comments | « src/gpu/effects/GrBitmapTextGeoProc.cpp ('k') | src/gpu/effects/GrCustomXfermode.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698