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

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

Issue 890433002: Revert of Remove 'f' from 0.05f in shader code (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: Created 5 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 | « no previous file | no next file » | 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 "SkPath.h" 10 #include "SkPath.h"
(...skipping 212 matching lines...) Expand 10 before | Expand all | Expand 10 after
223 cpe.getEdgeCount(), 223 cpe.getEdgeCount(),
224 &edgeArrayName); 224 &edgeArrayName);
225 GrGLFPFragmentBuilder* fsBuilder = builder->getFragmentShaderBuilder(); 225 GrGLFPFragmentBuilder* fsBuilder = builder->getFragmentShaderBuilder();
226 fsBuilder->codeAppend("\t\tfloat alpha = 1.0;\n"); 226 fsBuilder->codeAppend("\t\tfloat alpha = 1.0;\n");
227 fsBuilder->codeAppend("\t\tfloat edge;\n"); 227 fsBuilder->codeAppend("\t\tfloat edge;\n");
228 const char* fragmentPos = fsBuilder->fragmentPosition(); 228 const char* fragmentPos = fsBuilder->fragmentPosition();
229 for (int i = 0; i < cpe.getEdgeCount(); ++i) { 229 for (int i = 0; i < cpe.getEdgeCount(); ++i) {
230 // Add a device space "nudge" of 0.05f, 0.05f to match raster's rounding behavior for 230 // Add a device space "nudge" of 0.05f, 0.05f to match raster's rounding behavior for
231 // BW clipping/drawing. Since we are "nudging" fragment positions we hav e to go in 231 // BW clipping/drawing. Since we are "nudging" fragment positions we hav e to go in
232 // the opposite direction. 232 // the opposite direction.
233 fsBuilder->codeAppendf("\t\tedge = dot(%s[%d], vec3(%s.x - 0.05, %s.y - 0.05, 1));\n", 233 fsBuilder->codeAppendf("\t\tedge = dot(%s[%d], vec3(%s.x - 0.05f, %s.y - 0.05f, 1));\n",
234 edgeArrayName, i, fragmentPos, fragmentPos); 234 edgeArrayName, i, fragmentPos, fragmentPos);
235 if (GrProcessorEdgeTypeIsAA(cpe.getEdgeType())) { 235 if (GrProcessorEdgeTypeIsAA(cpe.getEdgeType())) {
236 fsBuilder->codeAppend("\t\tedge = clamp(edge, 0.0, 1.0);\n"); 236 fsBuilder->codeAppend("\t\tedge = clamp(edge, 0.0, 1.0);\n");
237 } else { 237 } else {
238 fsBuilder->codeAppend("\t\tedge = edge >= 0.5 ? 1.0 : 0.0;\n"); 238 fsBuilder->codeAppend("\t\tedge = edge >= 0.5 ? 1.0 : 0.0;\n");
239 } 239 }
240 fsBuilder->codeAppend("\t\talpha *= edge;\n"); 240 fsBuilder->codeAppend("\t\talpha *= edge;\n");
241 } 241 }
242 242
243 // Woe is me. See skbug.com/2149. 243 // Woe is me. See skbug.com/2149.
(...skipping 137 matching lines...) Expand 10 before | Expand all | Expand 10 after
381 } 381 }
382 382
383 GrFragmentProcessor* fp; 383 GrFragmentProcessor* fp;
384 do { 384 do {
385 GrPrimitiveEdgeType edgeType = static_cast<GrPrimitiveEdgeType>( 385 GrPrimitiveEdgeType edgeType = static_cast<GrPrimitiveEdgeType>(
386 random->nextULessThan(kGrProcessorEdgeTy peCnt)); 386 random->nextULessThan(kGrProcessorEdgeTy peCnt));
387 fp = GrConvexPolyEffect::Create(edgeType, count, edges); 387 fp = GrConvexPolyEffect::Create(edgeType, count, edges);
388 } while (NULL == fp); 388 } while (NULL == fp);
389 return fp; 389 return fp;
390 } 390 }
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698