aboutsummaryrefslogtreecommitdiffhomepage
path: root/bench/SkRasterPipelineBench.cpp
diff options
context:
space:
mode:
authorGravatar Mike Klein <mtklein@chromium.org>2017-08-09 13:51:35 -0400
committerGravatar Skia Commit-Bot <skia-commit-bot@chromium.org>2017-08-09 18:51:44 +0000
commita07e4302cfefc282d8d235edfbc20a54c75afa88 (patch)
tree213da9d00c56d3cf3f8056410a81da60388dc933 /bench/SkRasterPipelineBench.cpp
parentb681a0f1b0acebe36130fd463d14016d48295b97 (diff)
add gamma stage
Until now we've been using 3 separate parametric stages to apply gamma to r,g,b. That works fine, but is kind of unnecessarily slow, and again less clear in a stack trace than seeing "gamma". The new bench runs in about 60% of the time the old one does on my Trashcan. BUG=skia:6939 Change-Id: I079698d3009b081f1c23a2e27fc26e373b439610 Reviewed-on: https://skia-review.googlesource.com/32721 Reviewed-by: Mike Reed <reed@google.com> Commit-Queue: Mike Klein <mtklein@chromium.org>
Diffstat (limited to 'bench/SkRasterPipelineBench.cpp')
-rw-r--r--bench/SkRasterPipelineBench.cpp27
1 files changed, 19 insertions, 8 deletions
diff --git a/bench/SkRasterPipelineBench.cpp b/bench/SkRasterPipelineBench.cpp
index 818ab2b447..baff258409 100644
--- a/bench/SkRasterPipelineBench.cpp
+++ b/bench/SkRasterPipelineBench.cpp
@@ -113,9 +113,12 @@ static SkColorSpaceTransferFn gamma(float g) {
class SkRasterPipeline_2dot2 : public Benchmark {
public:
+ SkRasterPipeline_2dot2(bool parametric) : fParametric(parametric) {}
+
bool isSuitableFor(Backend backend) override { return backend == kNonRendering_Backend; }
const char* onGetName() override {
- return "SkRasterPipeline_2dot2";
+ return fParametric ? "SkRasterPipeline_2dot2_parametric"
+ : "SkRasterPipeline_2dot2_gamma";
}
void onDraw(int loops, SkCanvas*) override {
@@ -126,19 +129,27 @@ public:
SkSTArenaAlloc<256> alloc;
SkRasterPipeline p(&alloc);
p.append_constant_color(&alloc, c);
- p.append(SkRasterPipeline::parametric_r, &from_2dot2);
- p.append(SkRasterPipeline::parametric_g, &from_2dot2);
- p.append(SkRasterPipeline::parametric_b, &from_2dot2);
- p.append(SkRasterPipeline::parametric_r, & to_2dot2);
- p.append(SkRasterPipeline::parametric_g, & to_2dot2);
- p.append(SkRasterPipeline::parametric_b, & to_2dot2);
+ if (fParametric) {
+ p.append(SkRasterPipeline::parametric_r, &from_2dot2);
+ p.append(SkRasterPipeline::parametric_g, &from_2dot2);
+ p.append(SkRasterPipeline::parametric_b, &from_2dot2);
+ p.append(SkRasterPipeline::parametric_r, & to_2dot2);
+ p.append(SkRasterPipeline::parametric_g, & to_2dot2);
+ p.append(SkRasterPipeline::parametric_b, & to_2dot2);
+ } else {
+ p.append(SkRasterPipeline::gamma, &from_2dot2.fG);
+ p.append(SkRasterPipeline::gamma, & to_2dot2.fG);
+ }
while (loops --> 0) {
p.run(0,0,N,1);
}
}
+private:
+ bool fParametric;
};
-DEF_BENCH( return (new SkRasterPipeline_2dot2); )
+DEF_BENCH( return (new SkRasterPipeline_2dot2( true)); )
+DEF_BENCH( return (new SkRasterPipeline_2dot2(false)); )
class SkRasterPipelineToSRGB : public Benchmark {
public: