Set SkDAARecord to empty type if the scan converter returns early
Otherwise, ./out/Debug/dm --config t8888 -m bug583299 will crash at SkASSERT(record->fType != SkDAARecord::Type::kToBeComputed) Bug: skia: Change-Id: Ie93221bd6ea7ab9bc9f3d79fd7fe02b315e6a089 Reviewed-on: https://skia-review.googlesource.com/111680 Reviewed-by: Herb Derby <herb@google.com> Commit-Queue: Yuqian Li <liyuqian@google.com>
This commit is contained in:
parent
4be123fb6c
commit
a445fdd6e9
@ -186,7 +186,8 @@ struct SkDAARecord {
|
||||
enum class Type {
|
||||
kToBeComputed,
|
||||
kMask,
|
||||
kList
|
||||
kList,
|
||||
kEmpty
|
||||
} fType;
|
||||
|
||||
SkMask fMask;
|
||||
@ -194,6 +195,19 @@ struct SkDAARecord {
|
||||
SkArenaAlloc* fAlloc;
|
||||
|
||||
SkDAARecord(SkArenaAlloc* alloc) : fType(Type::kToBeComputed), fAlloc(alloc) {}
|
||||
|
||||
// When the scan converter returns early (e.g., the path is completely out of the clip), we set
|
||||
// the type to empty to signal that the record has been computed and it's empty. This is
|
||||
// required only for DEBUG where we check that the type must not be kToBeComputed after
|
||||
// init-once.
|
||||
void setEmpty() { fType = Type::kEmpty; }
|
||||
static inline void SetEmpty(SkDAARecord* record) { // record may be nullptr
|
||||
#ifdef SK_DEBUG
|
||||
if (record) {
|
||||
record->setEmpty();
|
||||
}
|
||||
#endif
|
||||
}
|
||||
};
|
||||
|
||||
template<typename T>
|
||||
|
@ -669,6 +669,7 @@ static SkIRect safeRoundOut(const SkRect& src) {
|
||||
void SkScan::AntiFillPath(const SkPath& path, const SkRegion& origClip,
|
||||
SkBlitter* blitter, bool forceRLE, SkDAARecord* daaRecord) {
|
||||
if (origClip.isEmpty()) {
|
||||
SkDAARecord::SetEmpty(daaRecord);
|
||||
return;
|
||||
}
|
||||
|
||||
@ -678,6 +679,7 @@ void SkScan::AntiFillPath(const SkPath& path, const SkRegion& origClip,
|
||||
if (isInverse) {
|
||||
blitter->blitRegion(origClip);
|
||||
}
|
||||
SkDAARecord::SetEmpty(daaRecord);
|
||||
return;
|
||||
}
|
||||
|
||||
@ -691,10 +693,11 @@ void SkScan::AntiFillPath(const SkPath& path, const SkRegion& origClip,
|
||||
clippedIR = origClip.getBounds();
|
||||
} else {
|
||||
if (!clippedIR.intersect(ir, origClip.getBounds())) {
|
||||
SkDAARecord::SetEmpty(daaRecord);
|
||||
return;
|
||||
}
|
||||
}
|
||||
if (rect_overflows_short_shift(clippedIR, SHIFT)) {
|
||||
if (!daaRecord && rect_overflows_short_shift(clippedIR, SHIFT)) {
|
||||
SkScan::FillPath(path, origClip, blitter);
|
||||
return;
|
||||
}
|
||||
@ -724,6 +727,7 @@ void SkScan::AntiFillPath(const SkPath& path, const SkRegion& origClip,
|
||||
if (isInverse) {
|
||||
blitter->blitRegion(*clipRgn);
|
||||
}
|
||||
SkDAARecord::SetEmpty(daaRecord);
|
||||
return;
|
||||
}
|
||||
|
||||
@ -776,6 +780,7 @@ void SkScan::FillPath(const SkPath& path, const SkRasterClip& clip, SkBlitter* b
|
||||
void SkScan::AntiFillPath(const SkPath& path, const SkRasterClip& clip,
|
||||
SkBlitter* blitter, SkDAARecord* daaRecord) {
|
||||
if (clip.isEmpty() || !path.isFinite()) {
|
||||
SkDAARecord::SetEmpty(daaRecord);
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -330,6 +330,7 @@ void SkScan::DAAFillPath(const SkPath& path, SkBlitter* blitter, const SkIRect&
|
||||
// The overhead of even constructing SkCoverageDeltaList/Mask is too big.
|
||||
// So TryBlitFatAntiRect and return if it's successful.
|
||||
if (!isInverse && TryBlitFatAntiRect(blitter, path, clipBounds)) {
|
||||
SkDAARecord::SetEmpty(record);
|
||||
return;
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user