diff options
Diffstat (limited to 'tests/LayerDrawLooperTest.cpp')
-rw-r--r-- | tests/LayerDrawLooperTest.cpp | 21 |
1 files changed, 15 insertions, 6 deletions
diff --git a/tests/LayerDrawLooperTest.cpp b/tests/LayerDrawLooperTest.cpp index 4897fd2884..7b3aa29883 100644 --- a/tests/LayerDrawLooperTest.cpp +++ b/tests/LayerDrawLooperTest.cpp @@ -60,8 +60,11 @@ static void test_frontToBack(skiatest::Reporter* reporter) { SkPaint paint; auto looper(looperBuilder.detach()); SkSmallAllocator<1, 32> allocator; - void* buffer = allocator.reserveT<SkDrawLooper::Context>(looper->contextSize()); - SkDrawLooper::Context* context = looper->createContext(&canvas, buffer); + SkDrawLooper::Context* context = allocator.createWithIniter( + looper->contextSize(), + [&](void* buffer) { + return looper->createContext(&canvas, buffer); + }); // The back layer should come first. REPORTER_ASSERT(reporter, context->next(&canvas, &paint)); @@ -100,8 +103,11 @@ static void test_backToFront(skiatest::Reporter* reporter) { SkPaint paint; auto looper(looperBuilder.detach()); SkSmallAllocator<1, 32> allocator; - void* buffer = allocator.reserveT<SkDrawLooper::Context>(looper->contextSize()); - SkDrawLooper::Context* context = looper->createContext(&canvas, buffer); + SkDrawLooper::Context* context = allocator.createWithIniter( + looper->contextSize(), + [&](void* buffer) { + return looper->createContext(&canvas, buffer); + }); // The back layer should come first. REPORTER_ASSERT(reporter, context->next(&canvas, &paint)); @@ -140,8 +146,11 @@ static void test_mixed(skiatest::Reporter* reporter) { SkPaint paint; sk_sp<SkDrawLooper> looper(looperBuilder.detach()); SkSmallAllocator<1, 32> allocator; - void* buffer = allocator.reserveT<SkDrawLooper::Context>(looper->contextSize()); - SkDrawLooper::Context* context = looper->createContext(&canvas, buffer); + SkDrawLooper::Context* context = allocator.createWithIniter( + looper->contextSize(), + [&](void* buffer) { + return looper->createContext(&canvas, buffer); + }); // The back layer should come first. REPORTER_ASSERT(reporter, context->next(&canvas, &paint)); |