diff options
author | Yuqian Li <liyuqian@google.com> | 2017-11-06 16:21:06 -0500 |
---|---|---|
committer | Skia Commit-Bot <skia-commit-bot@chromium.org> | 2017-11-07 02:01:40 +0000 |
commit | b49d7b0118789dbd8c54b95d40f6163e0a134ef3 (patch) | |
tree | 506f0ad720eddd8b65eed6309403b9311b9ad9b8 /src/core/SkScan_AAAPath.cpp | |
parent | 080baa44c50091d4e1a15550ded245c502a9ae3a (diff) |
This is a reland of 67340. This CL fixes the broken layout tests by
preserving the containedInClip boolean. We will eventually remove it
and rebaseline the layout tests.
Bug: skia:7271
Change-Id: I20e7220340d561ea2c50d30cd5d6ac6d2b4b3743
Reviewed-on: https://skia-review.googlesource.com/68100
Reviewed-by: Mike Reed <reed@google.com>
Commit-Queue: Yuqian Li <liyuqian@google.com>
Diffstat (limited to 'src/core/SkScan_AAAPath.cpp')
-rw-r--r-- | src/core/SkScan_AAAPath.cpp | 75 |
1 files changed, 36 insertions, 39 deletions
diff --git a/src/core/SkScan_AAAPath.cpp b/src/core/SkScan_AAAPath.cpp index d62b151e59..f9445d24f2 100644 --- a/src/core/SkScan_AAAPath.cpp +++ b/src/core/SkScan_AAAPath.cpp @@ -1672,48 +1672,45 @@ static SK_ALWAYS_INLINE void aaa_fill_path(const SkPath& path, const SkIRect& cl /////////////////////////////////////////////////////////////////////////////// -void SkScan::AAAFillPath(const SkPath& path, const SkRegion& origClip, SkBlitter* blitter, - bool forceRLE) { - FillPathFunc fillPathFunc = [](const SkPath& path, SkBlitter* blitter, bool isInverse, - const SkIRect& ir, const SkIRect& clipBounds, bool containedInClip, bool forceRLE){ - // The mask blitter (where we store intermediate alpha values directly in a mask, and then - // call the real blitter once in the end to blit the whole mask) is faster than the RLE - // blitter when the blit region is small enough (i.e., canHandleRect(ir)). - // When isInverse is true, the blit region is no longer ir so we won't use the mask blitter. - // The caller may also use the forceRLE flag to force not using the mask blitter. - // Also, when the path is a simple rect, preparing a mask and blitting it might have too - // much overhead. Hence we'll use blitFatAntiRect to avoid the mask and its overhead. - if (MaskAdditiveBlitter::canHandleRect(ir) && !isInverse && !forceRLE) { +void SkScan::AAAFillPath(const SkPath& path, SkBlitter* blitter, const SkIRect& ir, + const SkIRect& clipBounds, bool containedInClip, bool forceRLE) { + bool isInverse = path.isInverseFillType(); + + // The mask blitter (where we store intermediate alpha values directly in a mask, and then call + // the real blitter once in the end to blit the whole mask) is faster than the RLE blitter when + // the blit region is small enough (i.e., canHandleRect(ir)). When isInverse is true, the blit + // region is no longer the rectangle ir so we won't use the mask blitter. The caller may also + // use the forceRLE flag to force not using the mask blitter. Also, when the path is a simple + // rect, preparing a mask and blitting it might have too much overhead. Hence we'll use + // blitFatAntiRect to avoid the mask and its overhead. + if (MaskAdditiveBlitter::canHandleRect(ir) && !isInverse && !forceRLE) { #ifdef SK_SUPPORT_LEGACY_SMALLRECT_AA + MaskAdditiveBlitter additiveBlitter(blitter, ir, clipBounds, isInverse); + aaa_fill_path(path, clipBounds, &additiveBlitter, ir.fTop, ir.fBottom, + containedInClip, true, forceRLE); +#else + // blitFatAntiRect is slower than the normal AAA flow without MaskAdditiveBlitter. + // Hence only tryBlitFatAntiRect when MaskAdditiveBlitter would have been used. + if (!TryBlitFatAntiRect(blitter, path, clipBounds)) { MaskAdditiveBlitter additiveBlitter(blitter, ir, clipBounds, isInverse); aaa_fill_path(path, clipBounds, &additiveBlitter, ir.fTop, ir.fBottom, containedInClip, true, forceRLE); -#else - // blitFatAntiRect is slower than the normal AAA flow without MaskAdditiveBlitter. - // Hence only tryBlitFatAntiRect when MaskAdditiveBlitter would have been used. - if (!TryBlitFatAntiRect(blitter, path, clipBounds)) { - MaskAdditiveBlitter additiveBlitter(blitter, ir, clipBounds, isInverse); - aaa_fill_path(path, clipBounds, &additiveBlitter, ir.fTop, ir.fBottom, - containedInClip, true, forceRLE); - } -#endif - } else if (!isInverse && path.isConvex()) { - // If the filling area is convex (i.e., path.isConvex && !isInverse), our simpler - // aaa_walk_convex_edges won't generate alphas above 255. Hence we don't need - // SafeRLEAdditiveBlitter (which is slow due to clamping). The basic RLE blitter - // RunBasedAdditiveBlitter would suffice. - RunBasedAdditiveBlitter additiveBlitter(blitter, ir, clipBounds, isInverse); - aaa_fill_path(path, clipBounds, &additiveBlitter, ir.fTop, ir.fBottom, - containedInClip, false, forceRLE); - } else { - // If the filling area might not be convex, the more involved aaa_walk_edges would - // be called and we have to clamp the alpha downto 255. The SafeRLEAdditiveBlitter - // does that at a cost of performance. - SafeRLEAdditiveBlitter additiveBlitter(blitter, ir, clipBounds, isInverse); - aaa_fill_path(path, clipBounds, &additiveBlitter, ir.fTop, ir.fBottom, - containedInClip, false, forceRLE); } - }; - - do_fill_path(path, origClip, blitter, forceRLE, 2, std::move(fillPathFunc)); +#endif + } else if (!isInverse && path.isConvex()) { + // If the filling area is convex (i.e., path.isConvex && !isInverse), our simpler + // aaa_walk_convex_edges won't generate alphas above 255. Hence we don't need + // SafeRLEAdditiveBlitter (which is slow due to clamping). The basic RLE blitter + // RunBasedAdditiveBlitter would suffice. + RunBasedAdditiveBlitter additiveBlitter(blitter, ir, clipBounds, isInverse); + aaa_fill_path(path, clipBounds, &additiveBlitter, ir.fTop, ir.fBottom, + containedInClip, false, forceRLE); + } else { + // If the filling area might not be convex, the more involved aaa_walk_edges would + // be called and we have to clamp the alpha downto 255. The SafeRLEAdditiveBlitter + // does that at a cost of performance. + SafeRLEAdditiveBlitter additiveBlitter(blitter, ir, clipBounds, isInverse); + aaa_fill_path(path, clipBounds, &additiveBlitter, ir.fTop, ir.fBottom, + containedInClip, false, forceRLE); + } } |