summaryrefslogtreecommitdiffstats
path: root/libs
diff options
context:
space:
mode:
authorChris Craik <ccraik@google.com>2014-09-08 18:43:30 -0700
committerChris Craik <ccraik@google.com>2014-09-08 18:43:30 -0700
commit21bcfc4ff8642771bf42b264e1524ef47b00ae22 (patch)
tree72087e4f69f99e45a8706d70c9abc40dbbc891a0 /libs
parent95e71085e2d6f9482679a2a5c34d3d7fbc7d39c6 (diff)
downloadframeworks_base-21bcfc4ff8642771bf42b264e1524ef47b00ae22.zip
frameworks_base-21bcfc4ff8642771bf42b264e1524ef47b00ae22.tar.gz
frameworks_base-21bcfc4ff8642771bf42b264e1524ef47b00ae22.tar.bz2
Fix tessellation bounds computation
bug:17401066 Now correctly accounts for scale, both in hairline case (where scale needs to be accounted for), and in standard case (where scale shouldn't be applied, since bounds are in local space) Change-Id: I597a20834dce42ddb741b46e4c1a4f3169a48ccc
Diffstat (limited to 'libs')
-rw-r--r--libs/hwui/PathTessellator.cpp17
1 files changed, 12 insertions, 5 deletions
diff --git a/libs/hwui/PathTessellator.cpp b/libs/hwui/PathTessellator.cpp
index e30ac19..281ca02 100644
--- a/libs/hwui/PathTessellator.cpp
+++ b/libs/hwui/PathTessellator.cpp
@@ -162,14 +162,21 @@ public:
}
/**
- * Outset the bounds of point data (for line endpoints or points) to account for AA stroke
+ * Outset the bounds of point data (for line endpoints or points) to account for stroke
* geometry.
+ *
+ * bounds are in pre-scaled space.
*/
void expandBoundsForStroke(Rect* bounds) const {
- float outset = halfStrokeWidth;
- if (outset == 0) outset = 0.5f;
- bounds->outset(outset * inverseScaleX + Vertex::GeometryFudgeFactor(),
- outset * inverseScaleY + Vertex::GeometryFudgeFactor());
+ if (halfStrokeWidth == 0) {
+ // hairline, outset by (0.5f + fudge factor) in post-scaling space
+ bounds->outset(fabs(inverseScaleX) * (0.5f + Vertex::GeometryFudgeFactor()),
+ fabs(inverseScaleY) * (0.5f + Vertex::GeometryFudgeFactor()));
+ } else {
+ // non hairline, outset by half stroke width pre-scaled, and fudge factor post scaled
+ bounds->outset(halfStrokeWidth + fabs(inverseScaleX) * Vertex::GeometryFudgeFactor(),
+ halfStrokeWidth + fabs(inverseScaleY) * Vertex::GeometryFudgeFactor());
+ }
}
};