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>
diff --git a/tests/SkRasterPipelineTest.cpp b/tests/SkRasterPipelineTest.cpp
index 2f9b406..a3314b8 100644
--- a/tests/SkRasterPipelineTest.cpp
+++ b/tests/SkRasterPipelineTest.cpp
@@ -59,3 +59,34 @@
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));
+ }
+ }
+}