diff options
author | jcgregorio <jcgregorio@google.com> | 2015-04-15 06:17:10 -0700 |
---|---|---|
committer | Commit bot <commit-bot@chromium.org> | 2015-04-15 06:17:10 -0700 |
commit | f91e676f941c7e9ec91ac298eaa32e4bf8f52762 (patch) | |
tree | 484750ff00d2efbb0f4754ff54e54a5d44c0bded /src/core/SkScan_Antihair.cpp | |
parent | 7f00acbda6d35d2ba445a1e2909bb599b156cc5c (diff) |
Revert of add new blit2 methods in support of antialiased hairlines guard flag SK_SUPPORT_LEGACY_BLITANTIH2V2 (patchset #2 id:20001 of https://codereview.chromium.org/1060153003/)
Reason for revert:
DEPS roll is failing, one such example:
http://build.chromium.org/p/tryserver.chromium.win/builders/win8_chromium_rel/builds/73847/steps/ash_unittests%20%28with%20patch%29/logs/stdio
More here:
https://codereview.chromium.org/1091483003
This CL was the only CL in the roll when things started to fail.
Original issue's description:
> add new blit2 methods in support of antialiased hairlines
>
> before:
> 9M 1 528µs 530µs 539µs 607µs 5% ▁▁▁▁▁▁▁▁█▂ 8888 path_hairline_small_AA_quad
>
> after:
> 9M 1 355µs 356µs 358µs 375µs 2% ▂▁▁▁▁▁▁▁▁█ 8888 path_hairline_small_AA_quad
>
> BUG=skia:
>
> does require new baselines (bug chrome is guarded)
>
> Committed: https://skia.googlesource.com/skia/+/dd83031b98db4c6d3d0de2353bf115152a7d1464
TBR=caryclark@google.com,reed@chromium.org,reed@google.com
NOPRESUBMIT=true
NOTREECHECKS=true
NOTRY=true
BUG=skia:
Review URL: https://codereview.chromium.org/1085013003
Diffstat (limited to 'src/core/SkScan_Antihair.cpp')
-rw-r--r-- | src/core/SkScan_Antihair.cpp | 108 |
1 files changed, 88 insertions, 20 deletions
diff --git a/src/core/SkScan_Antihair.cpp b/src/core/SkScan_Antihair.cpp index 546ced0072..3073434f98 100644 --- a/src/core/SkScan_Antihair.cpp +++ b/src/core/SkScan_Antihair.cpp @@ -154,29 +154,70 @@ public: class Horish_SkAntiHairBlitter : public SkAntiHairBlitter { public: SkFixed drawCap(int x, SkFixed fy, SkFixed dy, int mod64) override { + int16_t runs[2]; + uint8_t aa[1]; + + runs[0] = 1; + runs[1] = 0; + fy += SK_Fixed1/2; - + SkBlitter* blitter = this->getBlitter(); + int lower_y = fy >> 16; uint8_t a = (uint8_t)(fy >> 8); - unsigned a0 = SmallDot6Scale(255 - a, mod64); - unsigned a1 = SmallDot6Scale(a, mod64); - this->getBlitter()->blitAntiV2(x, lower_y - 1, a0, a1); - - return fy + dy - SK_Fixed1/2; + unsigned ma = SmallDot6Scale(a, mod64); + if (ma) { + aa[0] = ApplyGamma(gamma, ma); + blitter->blitAntiH(x, lower_y, aa, runs); + // the clipping blitters might edit runs, but should not affect us + SkASSERT(runs[0] == 1); + SkASSERT(runs[1] == 0); + } + ma = SmallDot6Scale(255 - a, mod64); + if (ma) { + aa[0] = ApplyGamma(gamma, ma); + blitter->blitAntiH(x, lower_y - 1, aa, runs); + // the clipping blitters might edit runs, but should not affect us + SkASSERT(runs[0] == 1); + SkASSERT(runs[1] == 0); + } + fy += dy; + + return fy - SK_Fixed1/2; } - + SkFixed drawLine(int x, int stopx, SkFixed fy, SkFixed dy) override { SkASSERT(x < stopx); - + + int16_t runs[2]; + uint8_t aa[1]; + + runs[0] = 1; + runs[1] = 0; + fy += SK_Fixed1/2; SkBlitter* blitter = this->getBlitter(); do { int lower_y = fy >> 16; uint8_t a = (uint8_t)(fy >> 8); - blitter->blitAntiV2(x, lower_y - 1, 255 - a, a); + if (a) { + aa[0] = a; + blitter->blitAntiH(x, lower_y, aa, runs); + // the clipping blitters might edit runs, but should not affect us + SkASSERT(runs[0] == 1); + SkASSERT(runs[1] == 0); + } + a = 255 - a; + if (a) { + aa[0] = a; + blitter->blitAntiH(x, lower_y - 1, aa, runs); + // the clipping blitters might edit runs, but should not affect us + SkASSERT(runs[0] == 1); + SkASSERT(runs[1] == 0); + } fy += dy; } while (++x < stopx); - + return fy - SK_Fixed1/2; } }; @@ -225,26 +266,53 @@ public: class Vertish_SkAntiHairBlitter : public SkAntiHairBlitter { public: SkFixed drawCap(int y, SkFixed fx, SkFixed dx, int mod64) override { + int16_t runs[3]; + uint8_t aa[2]; + + runs[0] = 1; + runs[2] = 0; + fx += SK_Fixed1/2; - int x = fx >> 16; - uint8_t a = (uint8_t)(fx >> 8); - this->getBlitter()->blitAntiH2(x - 1, y, - SmallDot6Scale(255 - a, mod64), SmallDot6Scale(a, mod64)); - - return fx + dx - SK_Fixed1/2; + uint8_t a = (uint8_t)(fx >> 8); + + aa[0] = SmallDot6Scale(255 - a, mod64); + aa[1] = SmallDot6Scale(a, mod64); + // the clippng blitters might overwrite this guy, so we have to reset it each time + runs[1] = 1; + this->getBlitter()->blitAntiH(x - 1, y, aa, runs); + // the clipping blitters might edit runs, but should not affect us + SkASSERT(runs[0] == 1); + SkASSERT(runs[2] == 0); + fx += dx; + + return fx - SK_Fixed1/2; } - + SkFixed drawLine(int y, int stopy, SkFixed fx, SkFixed dx) override { SkASSERT(y < stopy); + int16_t runs[3]; + uint8_t aa[2]; + + runs[0] = 1; + runs[2] = 0; + fx += SK_Fixed1/2; do { int x = fx >> 16; - uint8_t a = (uint8_t)(fx >> 8); - this->getBlitter()->blitAntiH2(x - 1, y, 255 - a, a); + uint8_t a = (uint8_t)(fx >> 8); + + aa[0] = 255 - a; + aa[1] = a; + // the clippng blitters might overwrite this guy, so we have to reset it each time + runs[1] = 1; + this->getBlitter()->blitAntiH(x - 1, y, aa, runs); + // the clipping blitters might edit runs, but should not affect us + SkASSERT(runs[0] == 1); + SkASSERT(runs[2] == 0); fx += dx; } while (++y < stopy); - + return fx - SK_Fixed1/2; } }; |