aboutsummaryrefslogtreecommitdiffhomepage
path: root/tests
diff options
context:
space:
mode:
authorGravatar Mike Reed <reed@google.com>2017-07-21 11:53:23 -0400
committerGravatar Skia Commit-Bot <skia-commit-bot@chromium.org>2017-07-21 19:38:15 +0000
commitaaa3056e46ed9004097dc784db94c3a97d070569 (patch)
tree64e4f3eb40168c83b95f5d36597ce312c3a1b3fa /tests
parentc686ce39f06d556d55befd290e0eb82851c7d33b (diff)
switch away from std::function in public api
Bug: skia: Change-Id: I181382dc1f9d8671b814134c1a787185745b90a8 Reviewed-on: https://skia-review.googlesource.com/25643 Reviewed-by: Ben Wagner <bungeman@google.com> Commit-Queue: Mike Reed <reed@google.com>
Diffstat (limited to 'tests')
-rw-r--r--tests/TextBlobTest.cpp22
1 files changed, 12 insertions, 10 deletions
diff --git a/tests/TextBlobTest.cpp b/tests/TextBlobTest.cpp
index c00970fa23..d8d4865b29 100644
--- a/tests/TextBlobTest.cpp
+++ b/tests/TextBlobTest.cpp
@@ -434,23 +434,25 @@ DEF_TEST(TextBlob_serialize, reporter) {
sk_sp<SkTextBlob> blob0 = builder.make();
SkTDArray<SkTypeface*> array;
- sk_sp<SkData> data = blob0->serialize([&array](SkTypeface* tf) {
- if (array.find(tf) < 0) {
- *array.append() = tf;
+ sk_sp<SkData> data = blob0->serialize([](SkTypeface* tf, void* ctx) {
+ auto array = (SkTDArray<SkTypeface*>*)ctx;
+ if (array->find(tf) < 0) {
+ *array->append() = tf;
}
- });
+ }, &array);
REPORTER_ASSERT(reporter, array.count() > 0);
sk_sp<SkTextBlob> blob1 = SkTextBlob::Deserialize(data->data(), data->size(),
- [&array, reporter](uint32_t uniqueID) {
- for (int i = 0; i < array.count(); ++i) {
- if (array[i]->uniqueID() == uniqueID) {
- return sk_ref_sp(array[i]);
+ [](uint32_t uniqueID, void* ctx) {
+ auto array = (SkTDArray<SkTypeface*>*)ctx;
+ for (int i = 0; i < array->count(); ++i) {
+ if ((*array)[i]->uniqueID() == uniqueID) {
+ return sk_ref_sp((*array)[i]);
}
}
- REPORTER_ASSERT(reporter, false);
+ SkASSERT(false);
return sk_sp<SkTypeface>(nullptr);
- });
+ }, &array);
sk_sp<SkImage> img0 = render(blob0.get());
sk_sp<SkImage> img1 = render(blob1.get());