add 'a8' config for nanobench, specialize blitV for raster-pipeline

Motivated by wanting to speed-up A8 blits in general (and at the moment, aarect blits). More to come in these areas.

Bug: skia:
Change-Id: I45e8ef951b8e89a825af72b1918049be10920137
Reviewed-on: https://skia-review.googlesource.com/39401
Reviewed-by: Yuqian Li <liyuqian@google.com>
Commit-Queue: Mike Reed <reed@google.com>
This commit is contained in:
Mike Reed 2017-08-28 11:30:48 -04:00 committed by Skia Commit-Bot
parent c172f9b894
commit e6befa5ac8
2 changed files with 15 additions and 0 deletions

View File

@ -475,6 +475,8 @@ static void create_config(const SkCommandLineConfig* config, SkTArray<Config>* c
CPU_CONFIG(nonrendering, kNonRendering_Backend,
kUnknown_SkColorType, kUnpremul_SkAlphaType, nullptr)
CPU_CONFIG(a8, kRaster_Backend,
kAlpha_8_SkColorType, kPremul_SkAlphaType, nullptr)
CPU_CONFIG(8888, kRaster_Backend,
kN32_SkColorType, kPremul_SkAlphaType, nullptr)
CPU_CONFIG(565, kRaster_Backend,

View File

@ -44,6 +44,7 @@ public:
void blitAntiH2(int x, int y, U8CPU a0, U8CPU a1) override;
void blitMask (const SkMask&, const SkIRect& clip) override;
void blitRect (int x, int y, int width, int height) override;
void blitV (int x, int y, int height, SkAlpha alpha) override;
// TODO: The default implementations of the other blits look fine,
// but some of them like blitV could probably benefit from custom
@ -389,6 +390,18 @@ void SkRasterPipelineBlitter::blitAntiH2(int x, int y, U8CPU a0, U8CPU a1) {
this->blitMask(mask, clip);
}
void SkRasterPipelineBlitter::blitV(int x, int y, int height, SkAlpha alpha) {
SkIRect clip = {x,y, x+1,y+height};
SkMask mask;
mask.fImage = &alpha;
mask.fBounds = clip;
mask.fRowBytes = 0; // so we reuse the 1 "row" for all of height
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?