diff options
author | Mike Klein <mtklein@chromium.org> | 2017-10-10 15:14:20 -0400 |
---|---|---|
committer | Skia Commit-Bot <skia-commit-bot@chromium.org> | 2017-10-11 13:06:19 +0000 |
commit | b89c88311d3e1edd7ecdc246ef89d9156b527374 (patch) | |
tree | 17dbdf61c36d882be3428c4dda8d2afcb6e05098 /tests | |
parent | 5eb1528234733e548a6417161e0b70ce333dbd1d (diff) |
keep SkRSXforms aligned in SkLiteDL
We've been copying the text first, then the transforms.
That's a good way to get the transforms out of alignment.
This CL swaps the order of the two.
Bug: skia:7133
Change-Id: If8cd402b9ffba1787345dc4b5ffd4ee6abb14f33
Reviewed-on: https://skia-review.googlesource.com/57941
Reviewed-by: Derek Sollenberger <djsollen@google.com>
Commit-Queue: Mike Klein <mtklein@chromium.org>
Diffstat (limited to 'tests')
-rw-r--r-- | tests/SkLiteDLTest.cpp | 28 |
1 files changed, 27 insertions, 1 deletions
diff --git a/tests/SkLiteDLTest.cpp b/tests/SkLiteDLTest.cpp index d719c0bb76..4dfce09bba 100644 --- a/tests/SkLiteDLTest.cpp +++ b/tests/SkLiteDLTest.cpp @@ -5,9 +5,10 @@ * found in the LICENSE file. */ -#include "Test.h" #include "SkLiteDL.h" #include "SkLiteRecorder.h" +#include "SkRSXform.h" +#include "Test.h" DEF_TEST(SkLiteDL_basics, r) { SkLiteDL p; @@ -62,3 +63,28 @@ DEF_TEST(SkLiteRecorder_RecordsFlush, r) { canvas.flush(); REPORTER_ASSERT(r, !dl.empty()); } + +// skia:7133 regression test. +// At one point we recorded text before the transforms, which makes it easy for +// the recording buffer to not be suitably aligned for the transforms. +DEF_TEST(SkLiteRecorder_RSXformAlignment, r) { + SkLiteDL dl; + SkLiteRecorder canvas; + canvas.reset(&dl, {0,0,100,100}); + + SkPaint paint; + paint.setTextEncoding(SkPaint::kUTF8_TextEncoding); + + // These values don't really matter... we just need 5 valid transforms. + SkRSXform xforms[] = { + {1,0, 1,1}, + {1,0, 2,2}, + {1,0, 3,3}, + {1,0, 4,4}, + {1,0, 5,5}, + }; + canvas.drawTextRSXform("hello", 5, xforms, nullptr, paint); + + // We're just checking that this recorded our draw without SkASSERTing in Debug builds. + REPORTER_ASSERT(r, !dl.empty()); +} |