aboutsummaryrefslogtreecommitdiffhomepage
path: root/tests/DrawPathTest.cpp
diff options
context:
space:
mode:
authorGravatar reed@google.com <reed@google.com@2bbb7eff-a529-9590-31e7-b0007b416f81>2012-06-15 18:26:04 +0000
committerGravatar reed@google.com <reed@google.com@2bbb7eff-a529-9590-31e7-b0007b416f81>2012-06-15 18:26:04 +0000
commitb59ed515644331a12c779e8051c582aa3afd625c (patch)
tree446179dd4bf9f7630520b30f2a7187f95bcee24a /tests/DrawPathTest.cpp
parent945bbe1456cb703be2a8c2f2f8ee6624e0d69ad9 (diff)
git-svn-id: http://skia.googlecode.com/svn/trunk@4266 2bbb7eff-a529-9590-31e7-b0007b416f81
Diffstat (limited to 'tests/DrawPathTest.cpp')
-rw-r--r--tests/DrawPathTest.cpp49
1 files changed, 49 insertions, 0 deletions
diff --git a/tests/DrawPathTest.cpp b/tests/DrawPathTest.cpp
index 6c7f0b5ffc..947bf88029 100644
--- a/tests/DrawPathTest.cpp
+++ b/tests/DrawPathTest.cpp
@@ -28,6 +28,54 @@ static SkCanvas* new_canvas(int w, int h) {
///////////////////////////////////////////////////////////////////////////////
+static void moveToH(SkPath* path, const uint32_t raw[]) {
+ const float* fptr = (const float*)raw;
+ path->moveTo(fptr[0], fptr[1]);
+}
+
+static void cubicToH(SkPath* path, const uint32_t raw[]) {
+ const float* fptr = (const float*)raw;
+ path->cubicTo(fptr[0], fptr[1], fptr[2], fptr[3], fptr[4], fptr[5]);
+}
+
+// This used to assert, because we performed a cast (int)(pt[0].fX * scale) to
+// arrive at an int (SkFDot6) rather than calling sk_float_round2int. The assert
+// was that the initial line-segment produced by the cubic was not monotonically
+// going down (i.e. the initial DY was negative). By rounding the floats, we get
+// the more proper result.
+//
+// http://code.google.com/p/chromium/issues/detail?id=131181
+//
+static void test_crbug131181(skiatest::Reporter*) {
+ /*
+ fX = 18.8943768,
+ fY = 129.121277
+ }, {
+ fX = 18.8937435,
+ fY = 129.121689
+ }, {
+ fX = 18.8950119,
+ fY = 129.120422
+ }, {
+ fX = 18.5030727,
+ fY = 129.13121
+ */
+ uint32_t data[] = {
+ 0x419727af, 0x43011f0c, 0x41972663, 0x43011f27,
+ 0x419728fc, 0x43011ed4, 0x4194064b, 0x43012197
+ };
+
+ SkPath path;
+ moveToH(&path, &data[0]);
+ cubicToH(&path, &data[2]);
+
+ SkAutoTUnref<SkCanvas> canvas(new_canvas(640, 480));
+
+ SkPaint paint;
+ paint.setAntiAlias(true);
+ canvas->drawPath(path, paint);
+}
+
// Need to exercise drawing an inverse-path whose bounds intersect the clip,
// but whose edges do not (since its a quad which draws only in the bottom half
// of its bounds).
@@ -138,6 +186,7 @@ static void TestDrawPath(skiatest::Reporter* reporter) {
test_bigcubic(reporter);
test_crbug_124652(reporter);
test_inversepathwithclip(reporter);
+// test_crbug131181(reporter);
}
#include "TestClassDef.h"