diff options
author | Herb Derby <herb@google.com> | 2017-02-08 15:12:19 -0500 |
---|---|---|
committer | Skia Commit-Bot <skia-commit-bot@chromium.org> | 2017-02-08 21:08:02 +0000 |
commit | 73fe7b07e6391da81dfc48d600d7b3141be1f471 (patch) | |
tree | 34df5836e6c9360d69a9da9293cd2823d316191a /tests | |
parent | 16c149664d3f95e1cabded8a1b7b3d105222c236 (diff) |
Remove use of SkSmallAllocator from all Loopers.
R=reed@google.com
Change-Id: I22b140ee8e12900de13bc623adb30b5fca3051f9
Reviewed-on: https://skia-review.googlesource.com/7658
Reviewed-by: Mike Reed <reed@google.com>
Commit-Queue: Herb Derby <herb@google.com>
Diffstat (limited to 'tests')
-rw-r--r-- | tests/LayerDrawLooperTest.cpp | 26 | ||||
-rw-r--r-- | tests/QuickRejectTest.cpp | 7 |
2 files changed, 10 insertions, 23 deletions
diff --git a/tests/LayerDrawLooperTest.cpp b/tests/LayerDrawLooperTest.cpp index 8fcbf1615c..2910341be8 100644 --- a/tests/LayerDrawLooperTest.cpp +++ b/tests/LayerDrawLooperTest.cpp @@ -5,6 +5,7 @@ * found in the LICENSE file. */ +#include "SkArenaAlloc.h" #include "SkBitmap.h" #include "SkBitmapDevice.h" #include "SkCanvas.h" @@ -15,7 +16,6 @@ #include "SkRect.h" #include "SkRefCnt.h" #include "SkScalar.h" -#include "SkSmallAllocator.h" #include "Test.h" static SkBitmap make_bm(int w, int h) { @@ -58,12 +58,8 @@ static void test_frontToBack(skiatest::Reporter* reporter) { SkCanvas canvas(&device); SkPaint paint; auto looper(looperBuilder.detach()); - SkSmallAllocator<1, 32> allocator; - SkDrawLooper::Context* context = allocator.createWithIniter( - looper->contextSize(), - [&](void* buffer) { - return looper->createContext(&canvas, buffer); - }); + SkArenaAlloc alloc{48}; + SkDrawLooper::Context* context = looper->makeContext(&canvas, &alloc); // The back layer should come first. REPORTER_ASSERT(reporter, context->next(&canvas, &paint)); @@ -101,12 +97,8 @@ static void test_backToFront(skiatest::Reporter* reporter) { SkCanvas canvas(&device); SkPaint paint; auto looper(looperBuilder.detach()); - SkSmallAllocator<1, 32> allocator; - SkDrawLooper::Context* context = allocator.createWithIniter( - looper->contextSize(), - [&](void* buffer) { - return looper->createContext(&canvas, buffer); - }); + SkArenaAlloc alloc{48}; + SkDrawLooper::Context* context = looper->makeContext(&canvas, &alloc); // The back layer should come first. REPORTER_ASSERT(reporter, context->next(&canvas, &paint)); @@ -144,12 +136,8 @@ static void test_mixed(skiatest::Reporter* reporter) { SkCanvas canvas(&device); SkPaint paint; sk_sp<SkDrawLooper> looper(looperBuilder.detach()); - SkSmallAllocator<1, 32> allocator; - SkDrawLooper::Context* context = allocator.createWithIniter( - looper->contextSize(), - [&](void* buffer) { - return looper->createContext(&canvas, buffer); - }); + SkArenaAlloc alloc{48}; + SkDrawLooper::Context* context = looper->makeContext(&canvas, &alloc); // The back layer should come first. REPORTER_ASSERT(reporter, context->next(&canvas, &paint)); diff --git a/tests/QuickRejectTest.cpp b/tests/QuickRejectTest.cpp index 452aa8b742..6f472dcd86 100644 --- a/tests/QuickRejectTest.cpp +++ b/tests/QuickRejectTest.cpp @@ -5,6 +5,7 @@ * found in the LICENSE file. */ +#include "SkArenaAlloc.h" #include "SkCanvas.h" #include "SkDrawLooper.h" #include "SkLightingImageFilter.h" @@ -17,12 +18,10 @@ class TestLooper : public SkDrawLooper { public: - SkDrawLooper::Context* createContext(SkCanvas*, void* storage) const override { - return new (storage) TestDrawLooperContext; + SkDrawLooper::Context* makeContext(SkCanvas*, SkArenaAlloc* alloc) const override { + return alloc->make<TestDrawLooperContext>(); } - size_t contextSize() const override { return sizeof(TestDrawLooperContext); } - #ifndef SK_IGNORE_TO_STRING void toString(SkString* str) const override { str->append("TestLooper:"); |