diff options
author | Yuqian Li <liyuqian@google.com> | 2018-04-17 15:46:02 +0000 |
---|---|---|
committer | Skia Commit-Bot <skia-commit-bot@chromium.org> | 2018-04-17 15:46:14 +0000 |
commit | 1b637615144604a2d50cf983ac9aa5aab71cf73b (patch) | |
tree | d74da2285e69fb79807fc4c93bb09cbab42864ab | |
parent | 963781a985a777c21987f432dc4a1b766d1db23b (diff) |
Revert "Fix the fat rect bug in the threaded backend"
This reverts commit c41569a29fde10c6fec43cc4593334e9a4b34b76.
Reason for revert: maybe break the Chrome layout tests
Original change's description:
> Fix the fat rect bug in the threaded backend
>
> Bug: skia:7813
> Change-Id: I954232be1dccc63ce412ccde92c4f0e4617317b9
> Reviewed-on: https://skia-review.googlesource.com/121641
> Reviewed-by: Cary Clark <caryclark@google.com>
> Commit-Queue: Yuqian Li <liyuqian@google.com>
TBR=caryclark@google.com,liyuqian@google.com,reed@google.com
Change-Id: If35617a9774b3367561981e39a2fa89a972684b9
No-Presubmit: true
No-Tree-Checks: true
No-Try: true
Bug: skia:7813
Reviewed-on: https://skia-review.googlesource.com/121820
Reviewed-by: Yuqian Li <liyuqian@google.com>
Commit-Queue: Yuqian Li <liyuqian@google.com>
-rw-r--r-- | gm/aaa.cpp | 11 | ||||
-rw-r--r-- | src/core/SkBlitter.cpp | 33 | ||||
-rw-r--r-- | src/core/SkScanPriv.h | 2 |
3 files changed, 8 insertions, 38 deletions
diff --git a/gm/aaa.cpp b/gm/aaa.cpp index b2fc6337d9..910ce19988 100644 --- a/gm/aaa.cpp +++ b/gm/aaa.cpp @@ -44,7 +44,6 @@ protected: y += 200; - canvas->save(); canvas->translate(0, y); canvas->rotate(1); canvas->drawRect({ 20, 20, 20.2f, 200 }, p); @@ -79,7 +78,6 @@ protected: // skbug.com/7573 y += 200; - canvas->save(); canvas->translate(0, y); p.setAntiAlias(true); path.reset(); @@ -89,15 +87,6 @@ protected: path.lineTo(1.93990216f, 10.5837256f); canvas->drawPath(path, p); canvas->restore(); - - // skbug.com/7813 - // t8888 splits the 800-high canvas into 3 pieces; the boundary is close to 266 and 534 - path.reset(); - path.moveTo(700, 266); - path.lineTo(710, 266); - path.lineTo(710, 534); - path.lineTo(700, 534); - canvas->drawPath(path, p); } private: diff --git a/src/core/SkBlitter.cpp b/src/core/SkBlitter.cpp index d8cea8f17b..572150a173 100644 --- a/src/core/SkBlitter.cpp +++ b/src/core/SkBlitter.cpp @@ -49,18 +49,7 @@ inline static SkAlpha ScalarToAlpha(SkScalar a) { void SkBlitter::blitFatAntiRect(const SkRect& rect) { SkIRect bounds = rect.roundOut(); - SkASSERT(bounds.width() >= 3); - - // skbug.com/7813 - // To ensure consistency of the threaded backend (a rect that's considered fat in the init-once - // phase must also be considered fat in the draw phase), we have to deal with rects with small - // heights because the horizontal tiling in the threaded backend may change the height. - // - // This also implies that we cannot do vertical tiling unless we can blit any rect (not just the - // fat one.) - if (bounds.height() == 0) { - return; - } + SkASSERT(bounds.width() >= 3 && bounds.height() >= 3); int runSize = bounds.width() + 1; // +1 so we can set runs[bounds.width()] = 0 void* storage = this->allocBlitMemory(runSize * (sizeof(int16_t) + sizeof(SkAlpha))); @@ -77,26 +66,18 @@ void SkBlitter::blitFatAntiRect(const SkRect& rect) { SkScalar partialT = bounds.fTop + 1 - rect.fTop; SkScalar partialB = rect.fBottom - (bounds.fBottom - 1); - if (bounds.height() == 1) { - partialT = rect.fBottom - rect.fTop; - } - alphas[0] = ScalarToAlpha(partialL * partialT); alphas[1] = ScalarToAlpha(partialT); alphas[bounds.width() - 1] = ScalarToAlpha(partialR * partialT); this->blitAntiH(bounds.fLeft, bounds.fTop, alphas, runs); - if (bounds.height() > 2) { - this->blitAntiRect(bounds.fLeft, bounds.fTop + 1, bounds.width() - 2, bounds.height() - 2, - ScalarToAlpha(partialL), ScalarToAlpha(partialR)); - } + this->blitAntiRect(bounds.fLeft, bounds.fTop + 1, bounds.width() - 2, bounds.height() - 2, + ScalarToAlpha(partialL), ScalarToAlpha(partialR)); - if (bounds.height() > 1) { - alphas[0] = ScalarToAlpha(partialL * partialB); - alphas[1] = ScalarToAlpha(partialB); - alphas[bounds.width() - 1] = ScalarToAlpha(partialR * partialB); - this->blitAntiH(bounds.fLeft, bounds.fBottom - 1, alphas, runs); - } + alphas[0] = ScalarToAlpha(partialL * partialB); + alphas[1] = ScalarToAlpha(partialB); + alphas[bounds.width() - 1] = ScalarToAlpha(partialR * partialB); + this->blitAntiH(bounds.fLeft, bounds.fBottom - 1, alphas, runs); } void SkBlitter::blitCoverageDeltas(SkCoverageDeltaList* deltas, const SkIRect& clip, diff --git a/src/core/SkScanPriv.h b/src/core/SkScanPriv.h index a1fddb24d7..3d364988db 100644 --- a/src/core/SkScanPriv.h +++ b/src/core/SkScanPriv.h @@ -90,7 +90,7 @@ static inline bool TryBlitFatAntiRect(SkBlitter* blitter, const SkPath& path, co return true; // The intersection is empty. Hence consider it done. } SkIRect bounds = rect.roundOut(); - if (bounds.width() < 3) { + if (bounds.width() < 3 || bounds.height() < 3) { return false; // not fat } blitter->blitFatAntiRect(rect); |