aboutsummaryrefslogtreecommitdiffhomepage
path: root/bench/SkRasterPipelineBench.cpp
diff options
context:
space:
mode:
authorGravatar Mike Klein <mtklein@chromium.org>2017-05-24 07:53:00 -0400
committerGravatar Skia Commit-Bot <skia-commit-bot@chromium.org>2017-05-24 14:54:15 +0000
commitb24704d35f67f5b460be9c92794892e06adceb46 (patch)
treebfa2c4929e37da568f8b9ccf704f0ea07c48a17e /bench/SkRasterPipelineBench.cpp
parent3cac5b8d736a81134f2acd3bf4af9b92c6825f2a (diff)
SkRasterPipeline in SkArenaAlloc
Bug: skia:6673 Change-Id: Ia2bae4f6a9039a007a10b6b45bcf2f0854bf6e5c Reviewed-on: https://skia-review.googlesource.com/17794 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.cpp69
1 files changed, 5 insertions, 64 deletions
diff --git a/bench/SkRasterPipelineBench.cpp b/bench/SkRasterPipelineBench.cpp
index bef80b3fca..df130183b8 100644
--- a/bench/SkRasterPipelineBench.cpp
+++ b/bench/SkRasterPipelineBench.cpp
@@ -39,7 +39,7 @@ public:
void* src_ctx = src;
void* dst_ctx = dst;
- SkRasterPipeline p;
+ SkRasterPipeline_<256> p;
p.append(SkRasterPipeline::load_8888, &src_ctx);
p.append_from_srgb(kUnpremul_SkAlphaType);
p.append(SkRasterPipeline::scale_u8, &mask_ctx);
@@ -79,7 +79,7 @@ public:
void* src_ctx = src;
void* dst_ctx = dst;
- SkRasterPipeline p;
+ SkRasterPipeline_<256> p;
p.append(SkRasterPipeline::load_8888, &dst_ctx);
p.append(SkRasterPipeline::move_src_dst);
p.append(SkRasterPipeline::load_8888, &src_ctx);
@@ -87,9 +87,7 @@ public:
p.append(SkRasterPipeline::store_8888, &dst_ctx);
if (fCompile) {
- char buffer[1024];
- SkArenaAlloc alloc(buffer);
- auto fn = p.compile(&alloc);
+ auto fn = p.compile();
while (loops --> 0) {
fn(0,N);
}
@@ -124,7 +122,7 @@ public:
SkColorSpaceTransferFn from_2dot2 = gamma( 2.2f),
to_2dot2 = gamma(1/2.2f);
- SkRasterPipeline p;
+ SkRasterPipeline_<256> p;
p.append(SkRasterPipeline::constant_color, &c);
p.append(SkRasterPipeline::parametric_r, &from_2dot2);
p.append(SkRasterPipeline::parametric_g, &from_2dot2);
@@ -148,7 +146,7 @@ public:
}
void onDraw(int loops, SkCanvas*) override {
- SkRasterPipeline p;
+ SkRasterPipeline_<256> p;
p.append(SkRasterPipeline::to_srgb);
while (loops --> 0) {
@@ -157,60 +155,3 @@ public:
}
};
DEF_BENCH( return (new SkRasterPipelineToSRGB); )
-
-class SkRasterPipelineReuseBench : public Benchmark {
-public:
- enum Mode { None, Some, Full };
-
- explicit SkRasterPipelineReuseBench(Mode mode) : fMode(mode), fName("SkRasterPipelineReuse") {
- switch(mode) {
- case None: fName.append("_none"); break;
- case Some: fName.append("_some"); break;
- case Full: fName.append("_full"); break;
- }
- }
- const char* onGetName() override { return fName.c_str(); }
- bool isSuitableFor(Backend backend) override { return backend == kNonRendering_Backend; }
-
- void onDraw(int loops, SkCanvas*) override {
- const int kStages = 20;
- const auto stage = SkRasterPipeline::to_srgb; // Any stage will do. We won't call it.
-
- switch(fMode) {
- case None:
- while (loops --> 0) {
- SkRasterPipeline p;
- for (int i = 0; i < kStages; i++) {
- p.append(stage);
- }
- }
- break;
-
- case Some:
- while (loops --> 0) {
- SkRasterPipeline p(kStages);
- for (int i = 0; i < kStages; i++) {
- p.append(stage);
- }
- }
- break;
-
- case Full:
- SkRasterPipeline p(kStages);
- while (loops --> 0) {
- p.rewind();
- for (int i = 0; i < kStages; i++) {
- p.append(stage);
- }
- }
- break;
- }
- }
-
-private:
- Mode fMode;
- SkString fName;
-};
-DEF_BENCH( return (new SkRasterPipelineReuseBench(SkRasterPipelineReuseBench::None)); )
-DEF_BENCH( return (new SkRasterPipelineReuseBench(SkRasterPipelineReuseBench::Some)); )
-DEF_BENCH( return (new SkRasterPipelineReuseBench(SkRasterPipelineReuseBench::Full)); )