tweak conservative bounds value to save aberrant cubic

Bug: 844457
Change-Id: Ia3c7c0592df59022cf04f6747b1fe30975431ea4
Reviewed-on: https://skia-review.googlesource.com/129200
Reviewed-by: Cary Clark <caryclark@google.com>
Commit-Queue: Mike Reed <reed@google.com>
This commit is contained in:
Mike Reed 2018-05-18 14:07:57 -04:00 committed by Skia Commit-Bot
parent ee84fe1e64
commit 861b52ea98
2 changed files with 15 additions and 1 deletions

View File

@ -564,7 +564,10 @@ static bool clip_to_limit(const SkRegion& orig, SkRegion* reduced) {
// Bias used for conservative rounding of float rects to int rects, to nudge the irects a little
// larger, so we don't "think" a path's bounds are inside a clip, when (due to numeric drift in
// the scan-converter) we might walk beyond the predicted limits.
static const double kConservativeRoundBias = 0.5 + 0.5 / SK_FDot6One;
//
// This value has been determined trial and error: pick the smallest value (after the 0.5) that
// fixes any problematic cases (e.g. crbug.com/844457)
static const double kConservativeRoundBias = 0.5 + 1.0 / SK_FDot6One;
/**
* Round the value down. This is used to round the top and left of a rectangle,

View File

@ -211,3 +211,14 @@ DEF_TEST(test_fuzz_crbug_698714, reporter) {
canvas->clipRect({0, 0, 65, 202});
canvas->drawPath(path, paint);
}
DEF_TEST(cubic_scan_error_crbug_844457, reporter) {
auto surface(SkSurface::MakeRasterN32Premul(100, 100));
SkPath path;
path.moveTo(-30/64.0, -31/64.0);
path.cubicTo(-31/64.0, -31/64,-31/64.0, -31/64,-31/64.0, 100);
path.lineTo(100,100);
surface->getCanvas()->drawPath(path, SkPaint());
}