fix 0.499999f rounding case for triangles
Bug: skia:7994
Change-Id: I83bb309a2c8fb0bddaf78ba32c0a07537e483900
Reviewed-on: https://skia-review.googlesource.com/129648
Commit-Queue: Mike Reed <reed@google.com>
Reviewed-by: Mike Klein <mtklein@google.com>
diff --git a/tests/PathTest.cpp b/tests/PathTest.cpp
index 9d8c18f..45ebd45 100644
--- a/tests/PathTest.cpp
+++ b/tests/PathTest.cpp
@@ -5051,3 +5051,18 @@
compare.set(&points53[1], 4);
REPORTER_ASSERT(reporter, rect == compare);
}
+
+#include "SkVertices.h"
+DEF_TEST(triangle_onehalf, reporter) {
+ auto surface(SkSurface::MakeRasterN32Premul(100, 100));
+
+ const SkPoint pts[] = {
+ { 0.499069244f, 9.63295173f },
+ { 0.499402374f, 7.88207579f },
+ { 10.2363272f, 0.49999997f }
+ };
+ const SkColor colors[] = { SK_ColorBLACK, SK_ColorBLACK, SK_ColorBLACK };
+
+ auto v = SkVertices::MakeCopy(SkVertices::kTriangles_VertexMode, 3, pts, nullptr, colors);
+ surface->getCanvas()->drawVertices(v, SkBlendMode::kSrcOver, SkPaint());
+}