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

Unified Diff: src/gpu/GrOvalRenderer.cpp

Issue 205343008: Distance field fixes for Android (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: Fix int->float conversion issues Created 6 years, 9 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « src/gpu/GrDistanceFieldTextContext.cpp ('k') | src/gpu/GrTextStrike.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/gpu/GrOvalRenderer.cpp
diff --git a/src/gpu/GrOvalRenderer.cpp b/src/gpu/GrOvalRenderer.cpp
index ac33a5cc5d9e7665283f5c5bd27f51ee54088d5e..23ce230bfa8ffa6008b29774d283b323cc2c0632 100644
--- a/src/gpu/GrOvalRenderer.cpp
+++ b/src/gpu/GrOvalRenderer.cpp
@@ -232,8 +232,9 @@ public:
builder->fsCodeAppend("\tfloat grad_dot = dot(grad, grad);\n");
// we need to clamp the length^2 of the gradiant vector to a non-zero value, because
// on the Nexus 4 the undefined result of inversesqrt(0) drops out an entire tile
- // TODO: restrict this to Adreno-only
- builder->fsCodeAppend("\tgrad_dot = max(grad_dot, 1.0e-4);\n");
+ if (builder->ctxInfo().caps()->dropsTileOnZeroDivide()) {
+ builder->fsCodeAppend("\tgrad_dot = max(grad_dot, 1.0e-4);\n");
+ }
builder->fsCodeAppend("\tfloat invlen = inversesqrt(grad_dot);\n");
builder->fsCodeAppend("\tfloat edgeAlpha = clamp(0.5-test*invlen, 0.0, 1.0);\n");
@@ -380,8 +381,9 @@ public:
builder->fsCodeAppend("\tfloat grad_dot = dot(grad, grad);\n");
// we need to clamp the length^2 of the gradiant vector to a non-zero value, because
// on the Nexus 4 the undefined result of inversesqrt(0) drops out an entire tile
- // TODO: restrict this to Adreno-only
- builder->fsCodeAppend("\tgrad_dot = max(grad_dot, 1.0e-4);\n");
+ if (builder->ctxInfo().caps()->dropsTileOnZeroDivide()) {
+ builder->fsCodeAppend("\tgrad_dot = max(grad_dot, 1.0e-4);\n");
+ }
builder->fsCodeAppend("\tfloat invlen = inversesqrt(grad_dot);\n");
if (kHairline == ellipseEffect.getMode()) {
// can probably do this with one step
« no previous file with comments | « src/gpu/GrDistanceFieldTextContext.cpp ('k') | src/gpu/GrTextStrike.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698