diff options
author | Mike Klein <mtklein@chromium.org> | 2017-01-10 13:42:51 -0500 |
---|---|---|
committer | Skia Commit-Bot <skia-commit-bot@chromium.org> | 2017-01-10 19:20:22 +0000 |
commit | 7ba89a15fcba8543da6bef56674cd0806dcc6439 (patch) | |
tree | 167a39dd9bbce9ed49d3298d5b7ed18e2c7c056e /tests | |
parent | 4641d7d0550c6abcb6ffbda9941f6add268c017c (diff) |
SkSplicer: test and fix loop logic
The new test would fail without the the change in SkSplicer.cpp to call fSpliced(x,x+body) instead of fSpliced(x,body). The rest of the changes are cosmetic, mostly renaming n to limit.
Change-Id: Iae28802d0adb91e962ed3ee60fa5a4334bd140f9
Reviewed-on: https://skia-review.googlesource.com/6837
Reviewed-by: Herb Derby <herb@google.com>
Commit-Queue: Mike Klein <mtklein@chromium.org>
Diffstat (limited to 'tests')
-rw-r--r-- | tests/SkRasterPipelineTest.cpp | 31 |
1 files changed, 31 insertions, 0 deletions
diff --git a/tests/SkRasterPipelineTest.cpp b/tests/SkRasterPipelineTest.cpp index 2f9b4066b5..a3314b80b0 100644 --- a/tests/SkRasterPipelineTest.cpp +++ b/tests/SkRasterPipelineTest.cpp @@ -59,3 +59,34 @@ DEF_TEST(SkRasterPipeline_nonsense, r) { p.append(SkRasterPipeline::srcover); p.run(0,0, 20); } + +DEF_TEST(SkRasterPipeline_JIT, r) { + // This tests a couple odd corners that a JIT backend can stumble over. + + uint32_t buf[72] = { + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, + 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + }; + + const uint32_t* src = buf + 0; + uint32_t* dst = buf + 36; + + // Copy buf[x] to buf[x+36] for x in [15,35). + SkRasterPipeline p; + p.append(SkRasterPipeline:: load_8888, &src); + p.append(SkRasterPipeline::store_8888, &dst); + auto fn = p.compile(); + fn(15, 0, 20); + + for (int i = 0; i < 36; i++) { + if (i < 15 || i == 35) { + REPORTER_ASSERT(r, dst[i] == 0); + } else { + REPORTER_ASSERT(r, dst[i] == (uint32_t)(i - 11)); + } + } +} |