aboutsummaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authorGravatar Mike Reed <reed@google.com>2017-08-28 11:30:48 -0400
committerGravatar Skia Commit-Bot <skia-commit-bot@chromium.org>2017-08-28 15:56:06 +0000
commite6befa5ac8e00400a7baa1813d323cdb834a22e5 (patch)
tree0d83878158c080a458b8cfe01140cd728aee8431
parentc172f9b894455f2d262a5b1edf067764d70b1b62 (diff)
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>
-rw-r--r--bench/nanobench.cpp2
-rw-r--r--src/core/SkRasterPipelineBlitter.cpp13
2 files changed, 15 insertions, 0 deletions
diff --git a/bench/nanobench.cpp b/bench/nanobench.cpp
index ab7c689309..95977c53cb 100644
--- a/bench/nanobench.cpp
+++ b/bench/nanobench.cpp
@@ -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,
diff --git a/src/core/SkRasterPipelineBlitter.cpp b/src/core/SkRasterPipelineBlitter.cpp
index 4c484a0439..863fb92fad 100644
--- a/src/core/SkRasterPipelineBlitter.cpp
+++ b/src/core/SkRasterPipelineBlitter.cpp
@@ -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?