diff options
Diffstat (limited to 'src/core')
-rw-r--r-- | src/core/SkCoverageDelta.h | 16 | ||||
-rw-r--r-- | src/core/SkScan_AntiPath.cpp | 7 | ||||
-rw-r--r-- | src/core/SkScan_DAAPath.cpp | 1 |
3 files changed, 22 insertions, 2 deletions
diff --git a/src/core/SkCoverageDelta.h b/src/core/SkCoverageDelta.h index cfbee5ed3e..e0a50f4f3b 100644 --- a/src/core/SkCoverageDelta.h +++ b/src/core/SkCoverageDelta.h @@ -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> diff --git a/src/core/SkScan_AntiPath.cpp b/src/core/SkScan_AntiPath.cpp index 43ef09abbf..4be24efd6e 100644 --- a/src/core/SkScan_AntiPath.cpp +++ b/src/core/SkScan_AntiPath.cpp @@ -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; } diff --git a/src/core/SkScan_DAAPath.cpp b/src/core/SkScan_DAAPath.cpp index 9eb7c14cfa..343c4c73f1 100644 --- a/src/core/SkScan_DAAPath.cpp +++ b/src/core/SkScan_DAAPath.cpp @@ -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; } |