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

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

Issue 1256353004: Fix elliptical rrect clip shaders for large radii on devices with mediump (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: rename file Created 5 years, 4 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 | « gm/bigrrectaaeffect.cpp ('k') | src/gpu/effects/GrRRectEffect.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 "GrOvalEffect.h" 8 #include "GrOvalEffect.h"
9 9
10 #include "GrFragmentProcessor.h" 10 #include "GrFragmentProcessor.h"
(...skipping 267 matching lines...) Expand 10 before | Expand all | Expand 10 after
278 }; 278 };
279 279
280 GLEllipseEffect::GLEllipseEffect(const GrProcessor& effect) { 280 GLEllipseEffect::GLEllipseEffect(const GrProcessor& effect) {
281 fPrevRadii.fX = -1.f; 281 fPrevRadii.fX = -1.f;
282 } 282 }
283 283
284 void GLEllipseEffect::emitCode(EmitArgs& args) { 284 void GLEllipseEffect::emitCode(EmitArgs& args) {
285 const EllipseEffect& ee = args.fFp.cast<EllipseEffect>(); 285 const EllipseEffect& ee = args.fFp.cast<EllipseEffect>();
286 const char *ellipseName; 286 const char *ellipseName;
287 // The ellipse uniform is (center.x, center.y, 1 / rx^2, 1 / ry^2) 287 // The ellipse uniform is (center.x, center.y, 1 / rx^2, 1 / ry^2)
288 // The last two terms can underflow on mediump, so we use highp.
288 fEllipseUniform = args.fBuilder->addUniform(GrGLProgramBuilder::kFragment_Vi sibility, 289 fEllipseUniform = args.fBuilder->addUniform(GrGLProgramBuilder::kFragment_Vi sibility,
289 kVec4f_GrSLType, kDefault_GrSLPrecision , 290 kVec4f_GrSLType, kHigh_GrSLPrecision,
290 "ellipse", 291 "ellipse",
291 &ellipseName); 292 &ellipseName);
292 293
293 GrGLFragmentBuilder* fsBuilder = args.fBuilder->getFragmentShaderBuilder(); 294 GrGLFragmentBuilder* fsBuilder = args.fBuilder->getFragmentShaderBuilder();
294 const char* fragmentPos = fsBuilder->fragmentPosition(); 295 const char* fragmentPos = fsBuilder->fragmentPosition();
295 296
296 // d is the offset to the ellipse center 297 // d is the offset to the ellipse center
297 fsBuilder->codeAppendf("\t\tvec2 d = %s.xy - %s.xy;\n", fragmentPos, ellipse Name); 298 fsBuilder->codeAppendf("\t\tvec2 d = %s.xy - %s.xy;\n", fragmentPos, ellipse Name);
298 fsBuilder->codeAppendf("\t\tvec2 Z = d * %s.zw;\n", ellipseName); 299 fsBuilder->codeAppendf("\t\tvec2 Z = d * %s.zw;\n", ellipseName);
299 // implicit is the evaluation of (x/rx)^2 + (y/ry)^2 - 1. 300 // implicit is the evaluation of (x/rx)^2 + (y/ry)^2 - 1.
(...skipping 65 matching lines...) Expand 10 before | Expand all | Expand 10 after
365 w /= 2; 366 w /= 2;
366 return CircleEffect::Create(edgeType, SkPoint::Make(oval.fLeft + w, oval .fTop + w), w); 367 return CircleEffect::Create(edgeType, SkPoint::Make(oval.fLeft + w, oval .fTop + w), w);
367 } else { 368 } else {
368 w /= 2; 369 w /= 2;
369 h /= 2; 370 h /= 2;
370 return EllipseEffect::Create(edgeType, SkPoint::Make(oval.fLeft + w, ova l.fTop + h), w, h); 371 return EllipseEffect::Create(edgeType, SkPoint::Make(oval.fLeft + w, ova l.fTop + h), w, h);
371 } 372 }
372 373
373 return NULL; 374 return NULL;
374 } 375 }
OLDNEW
« no previous file with comments | « gm/bigrrectaaeffect.cpp ('k') | src/gpu/effects/GrRRectEffect.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698