From c7be00366bb0171e2d247ea71e291a64e3d10254 Mon Sep 17 00:00:00 2001 From: Mike Klein Date: Tue, 25 Apr 2017 15:51:23 -0400 Subject: remove to_2dot2 and from_2dot2 The parametric_{r,g,b} stages are just as good now; under the hood it's all going through approx_powf. Change-Id: If7f3ae1e24fcee2ddb201c1d66ce1dd64820c89a Reviewed-on: https://skia-review.googlesource.com/14320 Reviewed-by: Matt Sarett Commit-Queue: Mike Klein --- bench/SkRasterPipelineBench.cpp | 18 ++++++++++++++++-- 1 file changed, 16 insertions(+), 2 deletions(-) (limited to 'bench/SkRasterPipelineBench.cpp') diff --git a/bench/SkRasterPipelineBench.cpp b/bench/SkRasterPipelineBench.cpp index fa2df4b3e1..f54efc546d 100644 --- a/bench/SkRasterPipelineBench.cpp +++ b/bench/SkRasterPipelineBench.cpp @@ -91,6 +91,13 @@ public: }; DEF_BENCH( return (new SkRasterPipelineLegacyBench); ) +static SkColorSpaceTransferFn gamma(float g) { + SkColorSpaceTransferFn fn = {0,0,0,0,0,0,0}; + fn.fG = g; + fn.fA = 1; + return fn; +} + class SkRasterPipeline_2dot2 : public Benchmark { public: bool isSuitableFor(Backend backend) override { return backend == kNonRendering_Backend; } @@ -100,10 +107,17 @@ public: void onDraw(int loops, SkCanvas*) override { SkColor4f c = { 1.0f, 1.0f, 1.0f, 1.0f }; + + SkColorSpaceTransferFn from_2dot2 = gamma( 2.2f), + to_2dot2 = gamma(1/2.2f); SkRasterPipeline p; p.append(SkRasterPipeline::constant_color, &c); - p.append(SkRasterPipeline::from_2dot2); - p.append(SkRasterPipeline::to_2dot2); + 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); while (loops --> 0) { p.run(0,N); -- cgit v1.2.3