diff options
author | Chris Craik <ccraik@google.com> | 2013-11-19 18:00:46 -0800 |
---|---|---|
committer | Chris Craik <ccraik@google.com> | 2013-11-22 11:36:12 -0800 |
commit | f0a590781b2c3e34132b2011d3956135add73ae0 (patch) | |
tree | 336c6ca241497181743671e2f6e1af4405ab0237 /libs/hwui/DisplayListOp.h | |
parent | e6a408ed31a7d1fb8ace6b80487d179b2f085fd3 (diff) | |
download | frameworks_base-f0a590781b2c3e34132b2011d3956135add73ae0.zip frameworks_base-f0a590781b2c3e34132b2011d3956135add73ae0.tar.gz frameworks_base-f0a590781b2c3e34132b2011d3956135add73ae0.tar.bz2 |
Clean up quick rejection, especially surrounding points + lines.
bug:4351353
quickReject and quickRejectNoScissor have been renamed and refactored:
- to make the scissor side effect clear and explicit
- dangerous methods no longer public
- to make the simple quick reject check logic const
- simple quick reject is now conservative
This CL also fixes several issues with line and point quickRejection -
sub-pixel and hairline lines are much less likely to be incorrectly
rejected, especially at small canvas scale.
Additionally, alpha modulation for AA points < 1px in size is now
correct, dumplicating SW behavior (similar to lines and stroked
shapes work).
Change-Id: Ibb0710c721b9fb415d05acf54dd3d2b4d602156a
Diffstat (limited to 'libs/hwui/DisplayListOp.h')
-rw-r--r-- | libs/hwui/DisplayListOp.h | 9 |
1 files changed, 6 insertions, 3 deletions
diff --git a/libs/hwui/DisplayListOp.h b/libs/hwui/DisplayListOp.h index 5816872..88077d4 100644 --- a/libs/hwui/DisplayListOp.h +++ b/libs/hwui/DisplayListOp.h @@ -182,9 +182,12 @@ public: } inline float strokeWidthOutset() { - float width = mPaint->getStrokeWidth(); - if (width == 0) return 0.5f; // account for hairline - return width * 0.5f; + // since anything AA stroke with less than 1.0 pixel width is drawn with an alpha-reduced + // 1.0 stroke, treat 1.0 as minimum. + + // TODO: it would be nice if this could take scale into account, but scale isn't stable + // since higher levels of the view hierarchy can change scale out from underneath it. + return fmaxf(mPaint->getStrokeWidth(), 1) * 0.5f; } protected: |