summaryrefslogtreecommitdiff
path: root/libs/hwui/Vertex.h
diff options
context:
space:
mode:
authorChris Craik <ccraik@google.com>2013-09-17 16:20:29 -0700
committerChris Craik <ccraik@google.com>2013-09-17 17:48:14 -0700
commit32f05e343c5ffb17f3235942bcda651bd3b9f1d6 (patch)
treef3c0ed7a1a252728c21bd5b178ff69d625bf74d5 /libs/hwui/Vertex.h
parent0f3e1487b26a822697f70747290809081c2072cc (diff)
Conservatively estimate geometry bounds
bug:10761696 Avoids a case where a rect with top coordinate of (e.g.) 0.51f is assumed to not draw in the first row of pixels, which leads to it not being clipped. Since rounding can cause it to render in this first pixel anyway, we very slightly expand geometry bounds. Now, in ambiguous cases, the geometry bounds are expanded so clipping is more likely to happen. Change-Id: I119b7c7720de07bac1634549724ffb63935567fc
Diffstat (limited to 'libs/hwui/Vertex.h')
-rw-r--r--libs/hwui/Vertex.h9
1 files changed, 9 insertions, 0 deletions
diff --git a/libs/hwui/Vertex.h b/libs/hwui/Vertex.h
index c06762f7609a..790d4fcb1c61 100644
--- a/libs/hwui/Vertex.h
+++ b/libs/hwui/Vertex.h
@@ -26,6 +26,15 @@ namespace uirenderer {
* Simple structure to describe a vertex with a position and a texture.
*/
struct Vertex {
+ /**
+ * Fudge-factor used to disambiguate geometry pixel positioning.
+ *
+ * Used to offset lines and points to avoid ambiguous intersection with pixel centers (see
+ * Program::set()), and used to make geometry damage rect calculation conservative (see
+ * Rect::snapGeometryToPixelBoundaries())
+ */
+ static const float gGeometryFudgeFactor = 0.0656f;
+
float position[2];
static inline void set(Vertex* vertex, float x, float y) {