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>
diff --git a/src/core/SkRasterPipelineBlitter.cpp b/src/core/SkRasterPipelineBlitter.cpp
index 3d60d75..cba39f0 100644
--- a/src/core/SkRasterPipelineBlitter.cpp
+++ b/src/core/SkRasterPipelineBlitter.cpp
@@ -36,9 +36,10 @@
, 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::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?