// still be monotonic in Y. Since we can't trust the numerics of
// the chopper, we force those conditions now
tmp[3].fY = clip.fTop;
- tmp[4].fY = SkMaxScalar(tmp[4].fY, clip.fTop);
- tmp[5].fY = SkMaxScalar(tmp[5].fY, tmp[4].fY);
+ clamp_ge(tmp[4].fY, clip.fTop);
+ clamp_ge(tmp[5].fY, tmp[4].fY);
pts[0] = tmp[3];
pts[1] = tmp[4];
if (chopMonoCubicAtY(pts, clip.fBottom, &t)) {
SkPoint tmp[7];
SkChopCubicAt(pts, tmp, t);
- clamp_le(tmp[1].fY, clip.fBottom);
+ tmp[3].fY = clip.fBottom;
clamp_le(tmp[2].fY, clip.fBottom);
- clamp_le(tmp[3].fY, clip.fBottom);
+ clamp_le(tmp[1].fY, tmp[2].fY);
+
pts[1] = tmp[1];
pts[2] = tmp[2];
pts[3] = tmp[3];
// still be monotonic in X. Since we can't trust the numerics of
// the chopper, we force those conditions now
tmp[3].fX = clip.fLeft;
- tmp[4].fX = SkMaxScalar(tmp[4].fX, clip.fLeft);
- tmp[5].fX = SkMaxScalar(tmp[5].fX, tmp[4].fX);
+ clamp_ge(tmp[4].fX, clip.fLeft);
+ clamp_ge(tmp[5].fX, tmp[4].fX);
pts[0] = tmp[3];
pts[1] = tmp[4];
if (chopMonoCubicAtX(pts, clip.fRight, &t)) {
SkPoint tmp[7];
SkChopCubicAt(pts, tmp, t);
- clamp_le(tmp[1].fX, clip.fRight);
+ tmp[3].fX = clip.fRight;
clamp_le(tmp[2].fX, clip.fRight);
- clamp_le(tmp[3].fX, clip.fRight);
+ clamp_le(tmp[1].fX, tmp[2].fX);
+
this->appendCubic(tmp, reverse);
this->appendVLine(clip.fRight, tmp[3].fY, tmp[6].fY, reverse);
} else {
return create(SkBitmap::kARGB_8888_Config, w, h, 0, NULL);
}
+///////////////////////////////////////////////////////////////////////////////
+
static void test_bug533(skiatest::Reporter* reporter) {
#ifdef SK_SCALAR_IS_FLOAT
/*
#endif
}
+static void test_bigcubic(skiatest::Reporter* reporter) {
+#ifdef SK_SCALAR_IS_FLOAT
+ SkPath path;
+ path.moveTo(64, 3);
+ path.cubicTo(-329936, -100000000, -329936, 100000000, 1153, 330003);
+
+ SkPaint paint;
+ paint.setAntiAlias(true);
+
+ SkAutoTUnref<SkCanvas> canvas(new_canvas(640, 480));
+ canvas.get()->drawPath(path, paint);
+#endif
+}
+
// we used to assert if the bounds of the device (clip) was larger than 32K
// even when the path itself was smaller. We just draw and hope in the debug
// version to not assert.
static void TestDrawPath(skiatest::Reporter* reporter) {
test_giantaa(reporter);
test_bug533(reporter);
+ test_bigcubic(reporter);
}
#include "TestClassDef.h"