Index: src/gpu/GrAARectRenderer.cpp |
diff --git a/src/gpu/GrAARectRenderer.cpp b/src/gpu/GrAARectRenderer.cpp |
index f28d91456308143206a0f77310df60cd8a24f263..4a0be98661053715069c41f0e01d072cb5df4491 100644 |
--- a/src/gpu/GrAARectRenderer.cpp |
+++ b/src/gpu/GrAARectRenderer.cpp |
@@ -61,21 +61,22 @@ public: |
robertphillips
2013/06/13 17:45:52
This comment is now orphaned
egdaniel
2013/06/13 19:17:46
What do you mean by orphaned? Both the TODO and th
robertphillips
2013/06/13 19:55:24
It isn't as relevant in this iteration but in an e
|
// TODO: compute these scale factors in the VS |
// These scale factors adjust the coverage for < 1 pixel wide/high rects |
- builder->fsCodeAppendf("\tfloat wScale = max(1.0, 2.0/(0.5+%s.z));\n", |
- fsRectName); |
- builder->fsCodeAppendf("\tfloat hScale = max(1.0, 2.0/(0.5+%s.w));\n", |
- fsRectName); |
+ builder->fsCodeAppendf("\tfloat insetW = min(1.0, %s.z) - 0.5;\n", fsRectName); |
+ builder->fsCodeAppendf("\tfloat insetH = min(1.0, %s.w) - 0.5;\n", fsRectName); |
+ builder->fsCodeAppend("\tfloat outset = 0.5;\n"); |
bsalomon
2013/06/13 14:27:51
static const?
I'm not sure, but I think windows m
egdaniel
2013/06/13 14:52:18
On 2013/06/13 14:27:51, bsalomon wrote:
I will mak
bsalomon
2013/06/13 14:55:45
I'm a moron... I was reading this as c code. ignor
|
+ builder->fsCodeAppend("\tfloat spanW = insetW + outset;\n"); |
+ builder->fsCodeAppend("\tfloat spanH = insetH + outset;\n"); |
+ builder->fsCodeAppend("\tfloat scaleW = min(1.0, 2*insetW/(spanW));\n"); |
bsalomon
2013/06/13 14:27:51
need the parens in the divisor?
|
+ builder->fsCodeAppend("\tfloat scaleH = min(1.0, 2*insetH/(spanH));\n"); |
// Compute the coverage for the rect's width |
- builder->fsCodeAppendf("\tfloat coverage = clamp(wScale*(%s.z-abs(%s.x)), 0.0, 1.0);\n", |
- fsRectName, |
- fsRectName); |
- |
+ builder->fsCodeAppendf( |
+ "\tfloat coverage = scaleW*clamp((%s.z-abs(%s.x))/spanW, 0.0, 1.0);\n", fsRectName, |
+ fsRectName); |
// Compute the coverage for the rect's height and merge with the width |
builder->fsCodeAppendf( |
- "\tcoverage = min(coverage, clamp(hScale*(%s.w-abs(%s.y)), 0.0, 1.0));\n", |
- fsRectName, |
- fsRectName); |
+ "\tcoverage = coverage*scaleH*clamp((%s.w-abs(%s.y))/spanH, 0.0, 1.0);\n",fsRectName, |
+ fsRectName); |
SkString modulate; |
GrGLSLModulatef<4>(&modulate, inputColor, "coverage"); |