don't close a contour with a line if nothing's there

R=kjlubick@google.com
BUG=skia:5789
GOLD_TRYBOT_URL= https://gold.skia.org/search?issue=2360083006

Review-Url: https://codereview.chromium.org/2360083006
This commit is contained in:
caryclark 2016-09-22 12:52:20 -07:00 committed by Commit bot
parent c5850e9fdb
commit 1c10607244
2 changed files with 39 additions and 0 deletions

View File

@ -81,6 +81,9 @@ void SkPathWriter::deferredMove(const SkOpPtT* pt) {
void SkPathWriter::finishContour() {
if (!this->matchedLast(fDefer[0])) {
if (!fDefer[1]) {
return;
}
this->lineTo();
}
if (fCurrent.isEmpty()) {

View File

@ -7858,7 +7858,43 @@ path.quadTo(SkBits2Float(0x7a057272), SkBits2Float(0x72727272), SkBits2Float(0xf
testPathOpFuzz(reporter, path1, path2, (SkPathOp) 4, filename);
}
static void fuzz763_43(skiatest::Reporter* reporter, const char* filename) {
SkPath path;
path.setFillType((SkPath::FillType) 1);
SkPath path1(path);
path.reset();
path.setFillType((SkPath::FillType) 0);
path.moveTo(SkBits2Float(0x5c386c3a), SkBits2Float(0x4e691a3e)); // 2.07642e+17f, 9.77703e+08f
path.cubicTo(SkBits2Float(0x6f69f9f5), SkBits2Float(0x18ff8791), SkBits2Float(0x2492263c), SkBits2Float(0xbc6fdb48), SkBits2Float(0xc2f82107), SkBits2Float(0x729a18e1)); // 7.24122e+28f, 6.60528e-24f, 6.33822e-17f, -0.0146397f, -124.065f, 6.10442e+30f
path.cubicTo(SkBits2Float(0x07d729d1), SkBits2Float(0xdea6db48), SkBits2Float(0xcd1dfb88), SkBits2Float(0x90826769), SkBits2Float(0x1c20e5a4), SkBits2Float(0xa4c3ba9b)); // 3.23742e-34f, -6.01164e+18f, -1.65657e+08f, -5.14353e-29f, 5.32364e-22f, -8.48839e-17f
path.moveTo(SkBits2Float(0xcc2084b7), SkBits2Float(0x19f68bdb)); // -4.20789e+07f, 2.54923e-23f
path.close();
path.moveTo(SkBits2Float(0xcc2084b7), SkBits2Float(0x19f68bdb)); // -4.20789e+07f, 2.54923e-23f
path.cubicTo(SkBits2Float(0xdeea1d6e), SkBits2Float(0xc7774804), SkBits2Float(0x27cf0dcf), SkBits2Float(0x6ae8b99f), SkBits2Float(0x24ac3260), SkBits2Float(0x062fa93c)); // -8.43488e+18f, -63304, 5.7469e-15f, 1.40674e+26f, 7.46784e-17f, 3.30382e-35f
path.lineTo(SkBits2Float(0x438a0b9c), SkBits2Float(0x60a1d2c8)); // 276.091f, 9.32848e+19f
path.quadTo(SkBits2Float(0xe13fb902), SkBits2Float(0x07ee536f), SkBits2Float(0x971d8ac1), SkBits2Float(0x2f9f174b)); // -2.21041e+20f, 3.58593e-34f, -5.09046e-25f, 2.89385e-10f
path.lineTo(SkBits2Float(0x0f2cf5d8), SkBits2Float(0xe271654c)); // 8.5276e-30f, -1.11324e+21f
path.lineTo(SkBits2Float(0xe6cf24d2), SkBits2Float(0xd9537742)); // -4.89105e+23f, -3.72015e+15f
path.cubicTo(SkBits2Float(0x1aaaee04), SkBits2Float(0x9e3b804c), SkBits2Float(0x84cba87d), SkBits2Float(0x4e0e8ccc), SkBits2Float(0x2aec611a), SkBits2Float(0x7ae4b639)); // 7.06949e-23f, -9.92623e-21f, -4.78798e-36f, 5.97898e+08f, 4.19894e-13f, 5.9377e+35f
path.conicTo(SkBits2Float(0x73357921), SkBits2Float(0x6f163021), SkBits2Float(0x70ea542c), SkBits2Float(0xe008f404), SkBits2Float(0x1f6c5e52)); // 1.43778e+31f, 4.64809e+28f, 5.8017e+29f, -3.94741e+19f, 5.0053e-20f
path.lineTo(SkBits2Float(0xda45ad4e), SkBits2Float(0xedce4a04)); // -1.39103e+16f, -7.98042e+27f
path.lineTo(SkBits2Float(0xac0e45da), SkBits2Float(0x8f632841)); // -2.02182e-12f, -1.11997e-29f
path.lineTo(SkBits2Float(0xcc2084b7), SkBits2Float(0x19f68bdb)); // -4.20789e+07f, 2.54923e-23f
path.close();
path.moveTo(SkBits2Float(0xcc2084b7), SkBits2Float(0x19f68bdb)); // -4.20789e+07f, 2.54923e-23f
path.quadTo(SkBits2Float(0xf35c4ad5), SkBits2Float(0x0692f251), SkBits2Float(0x69632126), SkBits2Float(0xb927af67)); // -1.74534e+31f, 5.52751e-35f, 1.71614e+25f, -0.000159917f
path.moveTo(SkBits2Float(0x6534bff9), SkBits2Float(0x434a9986)); // 5.3348e+22f, 202.6f
path.quadTo(SkBits2Float(0x37c603e5), SkBits2Float(0xa0683953), SkBits2Float(0x751915e4), SkBits2Float(0x831c911a)); // 2.36053e-05f, -1.96701e-19f, 1.94059e+32f, -4.60108e-37f
path.cubicTo(SkBits2Float(0xba4f10f1), SkBits2Float(0x5a7571df), SkBits2Float(0x4ec67459), SkBits2Float(0x33c58827), SkBits2Float(0x10b78ccb), SkBits2Float(0xedbd2748)); // -0.000789895f, 1.72716e+16f, 1.66476e+09f, 9.19829e-08f, 7.23977e-29f, -7.31752e+27f
path.cubicTo(SkBits2Float(0x6d06f06a), SkBits2Float(0xe30465cf), SkBits2Float(0xc5458fe7), SkBits2Float(0xca488dc4), SkBits2Float(0x38f9021c), SkBits2Float(0x3e8d58db)); // 2.6101e+27f, -2.44231e+21f, -3160.99f, -3.28587e+06f, 0.000118736f, 0.276069f
SkPath path2(path);
testPathOpFuzz(reporter, path1, path2, (SkPathOp) 4, filename);
}
static struct TestDesc failTests[] = {
TEST(fuzz763_43),
TEST(fuzz763_42),
TEST(fuzz763_41),
TEST(fuzz763_40),