Check the boundary while cumulating deltas in a mask

Without the fix,

./out/Debug/dm --config t8888 -m complexclip_bw

will trigger the assert.

Note that this boundary check is already in place when deltas are
cumulated without using a mask.

Bug: skia:
Change-Id: I68bfe2b7196d440743d3a7535d097bb8ec7689c3
Reviewed-on: https://skia-review.googlesource.com/113210
Commit-Queue: Yuqian Li <liyuqian@google.com>
Reviewed-by: Cary Clark <caryclark@skia.org>
This commit is contained in:
Yuqian Li 2018-03-09 15:22:06 -05:00 committed by Skia Commit-Bot
parent 429a540673
commit d9779bcf93

View File

@ -113,7 +113,12 @@ void SkBlitter::blitCoverageDeltas(SkCoverageDeltaList* deltas, const SkIRect& c
SkIRect rowIR = SkIRect::MakeLTRB(clip.fLeft, y, clip.fRight, y + 1);
SkSTArenaAlloc<SkCoverageDeltaMask::MAX_SIZE> alloc;
SkCoverageDeltaMask mask(&alloc, rowIR);
for(int i = 0; i < deltas->count(y); ++i) {
int i = 0;
// skip deltas with x less than clip.fLeft; they must be precision errors
for(; i < deltas->count(y) && deltas->getDelta(y, i).fX < clip.fLeft; ++i)
;
for(; i < deltas->count(y) && deltas->getDelta(y, i).fX < clip.fRight; ++i) {
const SkCoverageDelta& delta = deltas->getDelta(y, i);
mask.addDelta(delta.fX, y, delta.fDelta);
}
@ -130,7 +135,8 @@ void SkBlitter::blitCoverageDeltas(SkCoverageDeltaList* deltas, const SkIRect& c
SkFixed coverage = 0; // init coverage to 0
// skip deltas with x less than clip.fLeft; they must be precision errors
for(; i < deltas->count(y) && deltas->getDelta(y, i).fX < clip.fLeft; ++i);
for(; i < deltas->count(y) && deltas->getDelta(y, i).fX < clip.fLeft; ++i)
;
for(; i < deltas->count(y) && deltas->getDelta(y, i).fX < clip.fRight; ++i) {
const SkCoverageDelta& delta = deltas->getDelta(y, i);
SkASSERT(delta.fX >= lastX); // delta must be x sorted