diff options
author | Chris Craik <ccraik@google.com> | 2013-07-30 19:05:20 -0700 |
---|---|---|
committer | Chris Craik <ccraik@google.com> | 2013-08-02 11:29:22 -0700 |
commit | 5e49b307eb99269db2db257760508b8efd7bb97d (patch) | |
tree | 18c9f02b947e99fe8aa5b27074725b11fc6df2ba /libs/hwui/Rect.h | |
parent | cb9accefb19ba6ae6fd449dc9ab62e972b51335c (diff) | |
download | frameworks_base-5e49b307eb99269db2db257760508b8efd7bb97d.zip frameworks_base-5e49b307eb99269db2db257760508b8efd7bb97d.tar.gz frameworks_base-5e49b307eb99269db2db257760508b8efd7bb97d.tar.bz2 |
Fix quickReject's handling of AA ramp geometry
By having quickReject round out the window-space geometry bounds, we
prevent the AA perimeter (which falls outside the local bounds passed
in) from drawing outside the clip.
Change-Id: I8ee36be9039a9c47906815ee2f0dbaa5eb910b82
Diffstat (limited to 'libs/hwui/Rect.h')
-rw-r--r-- | libs/hwui/Rect.h | 14 |
1 files changed, 14 insertions, 0 deletions
diff --git a/libs/hwui/Rect.h b/libs/hwui/Rect.h index 7531769..7605307 100644 --- a/libs/hwui/Rect.h +++ b/libs/hwui/Rect.h @@ -170,6 +170,20 @@ public: bottom += delta; } + /** + * Similar to snapToPixelBoundaries, but used for AA geometry with a ramp perimeter. + * + * We inset the data by a fudge factor of slightly over 1/16 (similar to when drawing non-AA + * lines) before rounding out so that insignificant amounts of ramp geometry (esp. from rounding + * errors) are ignored. + */ + void snapOutToPixelBoundaries() { + left = floorf(left + 0.065f); + top = floorf(top + 0.065f); + right = ceilf(right - 0.065f); + bottom = ceilf(bottom - 0.065f); + } + void snapToPixelBoundaries() { left = floorf(left + 0.5f); top = floorf(top + 0.5f); |