aboutsummaryrefslogtreecommitdiffhomepage
path: root/tests/ParametricStageTest.cpp
diff options
context:
space:
mode:
authorGravatar Mike Klein <mtklein@chromium.org>2017-04-25 15:51:23 -0400
committerGravatar Skia Commit-Bot <skia-commit-bot@chromium.org>2017-04-26 14:38:25 +0000
commitc7be00366bb0171e2d247ea71e291a64e3d10254 (patch)
tree20c96690ed1b6a99cbd374f1c00da7d901da1314 /tests/ParametricStageTest.cpp
parent21c131395fd032f962e138f7d91e654e1721e98c (diff)
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 <msarett@google.com> Commit-Queue: Mike Klein <mtklein@chromium.org>
Diffstat (limited to 'tests/ParametricStageTest.cpp')
-rw-r--r--tests/ParametricStageTest.cpp38
1 files changed, 4 insertions, 34 deletions
diff --git a/tests/ParametricStageTest.cpp b/tests/ParametricStageTest.cpp
index 0185abcb36..89b67c071a 100644
--- a/tests/ParametricStageTest.cpp
+++ b/tests/ParametricStageTest.cpp
@@ -41,7 +41,10 @@ static void check_error(skiatest::Reporter* r, float limit, SkColorSpaceTransfer
}
static void check_error(skiatest::Reporter* r, float limit, float gamma) {
- check_error(r, limit, { gamma, 1.0f,0,0,0,0,0 });
+ SkColorSpaceTransferFn fn = {0,0,0,0,0,0,0};
+ fn.fG = gamma;
+ fn.fA = 1;
+ check_error(r, limit, fn);
}
DEF_TEST(Parametric_sRGB, r) {
@@ -73,36 +76,3 @@ DEF_TEST(Parametric_inv_1dot8, r) { check_error(r, 1/510.0f, 1/1.8f); }
DEF_TEST(Parametric_inv_2dot0, r) { check_error(r, 1/510.0f, 1/2.0f); }
DEF_TEST(Parametric_inv_2dot2, r) { check_error(r, 1/510.0f, 1/2.2f); }
DEF_TEST(Parametric_inv_2dot4, r) { check_error(r, 1/510.0f, 1/2.4f); }
-
-// As above, checking that the stage implements gamma within limit.
-static void check_error(skiatest::Reporter* r, float limit,
- float gamma, SkRasterPipeline::StockStage stage) {
-
- // We expect the gamma will only be applied to R,G,B, leaving A alone.
- // So this isn't quite exhaustive, but it's pretty good.
- float in[256], out[256];
- for (int i = 0; i < 256; i++) {
- in [i] = i / 255.0f;
- out[i] = 0.0f; // Not likely important. Just being tidy.
- }
-
- const float* ip = in;
- float* op = out;
-
- SkRasterPipeline p;
- p.append(SkRasterPipeline::load_f32, &ip);
- p.append(stage);
- p.append(SkRasterPipeline::store_f32, &op);
- p.run(0, 256/4);
-
- for (int i = 0; i < 256; i++) {
- float want = powf(i/255.0f, (i%4) == 3 ? 1.0f
- : gamma);
- float err = fabsf(out[i] - want);
- if (err > limit) {
- ERRORF(r, "At %d, error was %g (got %g, want %g)", i, err, out[i], want);
- }
- }
-}
-DEF_TEST(from_2dot2, r) { check_error(r, 1/510.f, 2.2f, SkRasterPipeline::from_2dot2); }
-DEF_TEST( to_2dot2, r) { check_error(r, 1/510.f, 1/2.2f,SkRasterPipeline:: to_2dot2); }