Account for hairlines in quick rejection logic
bug:8531373
Change-Id: I35444014f23fc61da687694fccc0d13bce718793
diff --git a/libs/hwui/DisplayListOp.h b/libs/hwui/DisplayListOp.h
index 9c3d058..a5dee9f 100644
--- a/libs/hwui/DisplayListOp.h
+++ b/libs/hwui/DisplayListOp.h
@@ -165,7 +165,11 @@
return DeferredDisplayList::kOpBatch_None;
}
- float strokeWidthOutset() { return mPaint->getStrokeWidth() * 0.5f; }
+ float strokeWidthOutset() {
+ float width = mPaint->getStrokeWidth();
+ if (width == 0) return 0.5f; // account for hairline
+ return width * 0.5f;
+ }
protected:
SkPaint* getPaint(OpenGLRenderer& renderer) {
diff --git a/libs/hwui/PathTessellator.cpp b/libs/hwui/PathTessellator.cpp
index 395bbf6..0879b1b 100644
--- a/libs/hwui/PathTessellator.cpp
+++ b/libs/hwui/PathTessellator.cpp
@@ -61,6 +61,7 @@
bool forceExpand) {
if (forceExpand || paint->getStyle() != SkPaint::kFill_Style) {
float outset = paint->getStrokeWidth() * 0.5f;
+ if (outset == 0) outset = 0.5f; // account for hairline
bounds.outset(outset, outset);
}
}