diff options
author | Mike Klein <mtklein@chromium.org> | 2017-06-05 07:10:01 -0400 |
---|---|---|
committer | Mike Reed <reed@google.com> | 2017-06-05 13:31:31 +0000 |
commit | 34d10d734c883758576f3473c5ac38be20c1e99f (patch) | |
tree | 859fcf0daffc7ad1e34aba158cef46a5857ee87c | |
parent | e18474e8644eabfe62bc9f05a2483dcb7572c494 (diff) |
implement SkRasterPipelineBlitter::blitAntiH2()
The default blitAntiH2() calls blitAntiH() with two length-1 runs, but
for this blitter creating a small mask is better. We can stamp both
pixels out with a single pipeline invocation.
Change-Id: If356975e85310a4545e54f2231a142d6e537944d
Reviewed-on: https://skia-review.googlesource.com/18581
Reviewed-by: Mike Reed <reed@google.com>
-rw-r--r-- | src/core/SkRasterPipelineBlitter.cpp | 20 |
1 files changed, 17 insertions, 3 deletions
diff --git a/src/core/SkRasterPipelineBlitter.cpp b/src/core/SkRasterPipelineBlitter.cpp index 3d60d756f6..cba39f021d 100644 --- a/src/core/SkRasterPipelineBlitter.cpp +++ b/src/core/SkRasterPipelineBlitter.cpp @@ -36,9 +36,10 @@ public: , fColorPipeline(alloc) {} - void blitH (int x, int y, int w) override; - void blitAntiH(int x, int y, const SkAlpha[], const int16_t[]) override; - void blitMask (const SkMask&, const SkIRect& clip) override; + void blitH (int x, int y, int w) override; + void blitAntiH (int x, int y, const SkAlpha[], const int16_t[]) override; + void blitAntiH2(int x, int y, U8CPU a0, U8CPU a1) override; + void blitMask (const SkMask&, const SkIRect& clip) override; // TODO: The default implementations of the other blits look fine, // but some of them like blitV could probably benefit from custom @@ -316,6 +317,19 @@ void SkRasterPipelineBlitter::blitAntiH(int x, int y, const SkAlpha aa[], const } } +void SkRasterPipelineBlitter::blitAntiH2(int x, int y, U8CPU a0, U8CPU a1) { + SkIRect clip = {x,y, x+2,y+1}; + uint8_t coverage[] = { (uint8_t)a0, (uint8_t)a1 }; + + SkMask mask; + mask.fImage = coverage; + mask.fBounds = clip; + mask.fRowBytes = 2; + mask.fFormat = SkMask::kA8_Format; + + this->blitMask(mask, clip); +} + void SkRasterPipelineBlitter::blitMask(const SkMask& mask, const SkIRect& clip) { if (mask.fFormat == SkMask::kBW_Format) { // TODO: native BW masks? |