Use AdditiveBlitter for partial rows

Previously, we forgot to use AdditiveBlitter in two places where partial
rows are blitterred. That causes SkAAClip to complain as in skia:6003.

BUG=skia:6003

Change-Id: I4f4a896072448bdb3f287a2eb61cb64b1256ea78
Reviewed-on: https://skia-review.googlesource.com/5273
Reviewed-by: Cary Clark <caryclark@google.com>
Commit-Queue: Yuqian Li <liyuqian@google.com>
This commit is contained in:
Yuqian Li 2016-11-29 10:29:22 -05:00 committed by Skia Commit-Bot
parent 32ac83ebdc
commit db13a093be
2 changed files with 34 additions and 0 deletions

View File

@ -1017,8 +1017,13 @@ static inline void aaa_walk_convex_edges(SkAnalyticEdge* prevHead, AdditiveBlitt
}
} else { // left and rite are within the same pixel
if (partialTop > 0) {
#ifdef SK_ANALYTIC_AA_GUARD
blitter->getRealBlitter()->blitV(fullLeft - 1, fullTop - 1, 1,
f2a(SkFixedMul(partialTop, rite - left)));
#else
blitter->blitAntiH(fullLeft - 1, fullTop - 1, 1,
f2a(SkFixedMul(partialTop, rite - left)));
#endif
blitter->flush_if_y_changed(y, y + partialTop);
}
if (fullBot > fullTop) {
@ -1026,8 +1031,13 @@ static inline void aaa_walk_convex_edges(SkAnalyticEdge* prevHead, AdditiveBlitt
f2a(rite - left));
}
if (partialBot > 0) {
#ifdef SK_ANALYTIC_AA_GUARD
blitter->getRealBlitter()->blitV(fullLeft - 1, fullBot, 1,
f2a(SkFixedMul(partialBot, rite - left)));
#else
blitter->blitAntiH(fullLeft - 1, fullBot, 1,
f2a(SkFixedMul(partialBot, rite - left)));
#endif
}
}

View File

@ -4319,6 +4319,29 @@ static void test_fuzz_crbug_662952(skiatest::Reporter* reporter) {
surface->getCanvas()->drawRectCoords(0, 0, 100, 100, paint);
}
static void test_path_crbugskia6003() {
auto surface(SkSurface::MakeRasterN32Premul(500, 500));
SkCanvas* canvas = surface->getCanvas();
SkPaint paint;
paint.setAntiAlias(true);
SkPath path;
path.moveTo(SkBits2Float(0x4325e666), SkBits2Float(0x42a1999a)); // 165.9f, 80.8f
path.lineTo(SkBits2Float(0x4325e666), SkBits2Float(0x42a2999a)); // 165.9f, 81.3f
path.lineTo(SkBits2Float(0x4325b333), SkBits2Float(0x42a2999a)); // 165.7f, 81.3f
path.lineTo(SkBits2Float(0x4325b333), SkBits2Float(0x42a16666)); // 165.7f, 80.7f
path.lineTo(SkBits2Float(0x4325b333), SkBits2Float(0x429f6666)); // 165.7f, 79.7f
// 165.7f, 79.7f, 165.8f, 79.7f, 165.8f, 79.7f
path.cubicTo(SkBits2Float(0x4325b333), SkBits2Float(0x429f6666), SkBits2Float(0x4325cccc),
SkBits2Float(0x429f6666), SkBits2Float(0x4325cccc), SkBits2Float(0x429f6666));
// 165.8f, 79.7f, 165.8f, 79.7f, 165.9f, 79.7f
path.cubicTo(SkBits2Float(0x4325cccc), SkBits2Float(0x429f6666), SkBits2Float(0x4325cccc),
SkBits2Float(0x429f6666), SkBits2Float(0x4325e666), SkBits2Float(0x429f6666));
path.lineTo(SkBits2Float(0x4325e666), SkBits2Float(0x42a1999a)); // 165.9f, 80.8f
path.close();
canvas->clipPath(path, true);
canvas->drawRectCoords(0, 0, 500, 500, paint);
}
static void test_fuzz_crbug_662730(skiatest::Reporter* reporter) {
SkPath path;
path.moveTo(SkBits2Float(0x00000000), SkBits2Float(0x00000000)); // 0, 0
@ -4391,6 +4414,7 @@ DEF_TEST(Paths, reporter) {
test_fuzz_crbug_662730(reporter);
test_fuzz_crbug_662780();
test_mask_overflow();
test_path_crbugskia6003();
SkTSize<SkScalar>::Make(3,4);