Add the missing shift to the dy
This is identical to https://skia-review.googlesource.com/c/5266/ except for the SK_ANALYTIC_AA_GUARD flag. BUG=chromium:668907 GOLD_TRYBOT_URL= https://gold.skia.org/search?issue=5302 Change-Id: I3fc225a925d21fe615c46a4a0be7fe33c5790766 Reviewed-on: https://skia-review.googlesource.com/5302 Commit-Queue: Yuqian Li <liyuqian@google.com> Reviewed-by: Cary Clark <caryclark@google.com>
This commit is contained in:
parent
1edc5b92fe
commit
79252f7997
@ -109,14 +109,18 @@ bool SkAnalyticQuadraticEdge::updateQuadratic() {
|
||||
slope = diffY ? QuickSkFDot6Div((newx - fSnappedX) >> 10, diffY) : SK_MaxS32;
|
||||
#ifdef SK_ANALYTIC_AA_GUARD
|
||||
slope = dy >> 10 > 0 ? QuickSkFDot6Div(dx >> 10, dy >> 10) : SK_MaxS32;
|
||||
shift = 0;
|
||||
#endif
|
||||
if (SkAbs32(dy) >= SK_Fixed1 * 2) { // only snap when dy is large enough
|
||||
if (SkAbs32(dy >> shift) >= SK_Fixed1 * 2) { // only snap when dy is large enough
|
||||
newSnappedY = SkTMin<SkFixed>(fQEdge.fQLastY, SkFixedRoundToFixed(newy));
|
||||
newSnappedX = newx - SkFixedMul(slope, newy - newSnappedY);
|
||||
} else {
|
||||
newSnappedY = SkTMin(fQEdge.fQLastY, snapY(newy));
|
||||
newSnappedX = newx;
|
||||
}
|
||||
#ifdef SK_ANALYTIC_AA_GUARD
|
||||
shift = fCurveShift;
|
||||
#endif
|
||||
dx += fQEdge.fQDDx;
|
||||
dy += fQEdge.fQDDy;
|
||||
}
|
||||
|
@ -216,6 +216,20 @@ static void test_mask_overflow() {
|
||||
canvas->drawPath(path, paint);
|
||||
}
|
||||
|
||||
static void test_fuzz_crbug_668907() {
|
||||
auto surface(SkSurface::MakeRasterN32Premul(400, 500));
|
||||
SkCanvas* canvas = surface->getCanvas();
|
||||
SkPaint paint;
|
||||
paint.setAntiAlias(true);
|
||||
SkPath path;
|
||||
path.moveTo(SkBits2Float(0x46313741), SkBits2Float(0x3b00e540)); // 11341.8f, 0.00196679f
|
||||
path.quadTo(SkBits2Float(0x41410041), SkBits2Float(0xc1414141), SkBits2Float(0x41414141),
|
||||
SkBits2Float(0x414100ff)); // 12.0626f, -12.0784f, 12.0784f, 12.0627f
|
||||
path.lineTo(SkBits2Float(0x46313741), SkBits2Float(0x3b00e540)); // 11341.8f, 0.00196679f
|
||||
path.close();
|
||||
canvas->drawPath(path, paint);
|
||||
}
|
||||
|
||||
/**
|
||||
* In debug mode, this path was causing an assertion to fail in
|
||||
* SkPathStroker::preJoinTo() and, in Release, the use of an unitialized value.
|
||||
@ -4415,6 +4429,7 @@ DEF_TEST(Paths, reporter) {
|
||||
test_fuzz_crbug_662780();
|
||||
test_mask_overflow();
|
||||
test_path_crbugskia6003();
|
||||
test_fuzz_crbug_668907();
|
||||
|
||||
SkTSize<SkScalar>::Make(3,4);
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user