Chromium Code Reviews| Index: tests/QuickRejectTest.cpp |
| diff --git a/tests/QuickRejectTest.cpp b/tests/QuickRejectTest.cpp |
| index 2d367389bb81f1e82d0c5cfcd951914270540e63..b1f4215dac12771a0d817480ea212668da1fae69 100644 |
| --- a/tests/QuickRejectTest.cpp |
| +++ b/tests/QuickRejectTest.cpp |
| @@ -7,6 +7,7 @@ |
| #include "SkCanvas.h" |
| #include "SkDrawLooper.h" |
| +#include "SkTypes.h" |
| #include "Test.h" |
| /* |
| @@ -14,19 +15,12 @@ |
| */ |
| class TestLooper : public SkDrawLooper { |
| public: |
| - bool fOnce; |
| - virtual void init(SkCanvas*) SK_OVERRIDE { |
| - fOnce = true; |
| - } |
| - |
| - virtual bool next(SkCanvas* canvas, SkPaint*) SK_OVERRIDE { |
| - if (fOnce) { |
| - fOnce = false; |
| - canvas->translate(SkIntToScalar(10), 0); |
| - return true; |
| - } |
| - return false; |
| + virtual SkDrawLooper::Context* init(SkCanvas*, SkDrawLooper::ContextAllocator* allocator) const |
| + SK_OVERRIDE { |
| + int tp=sizeof(TestDrawLooperContext); |
|
scroggo
2014/03/10 19:41:32
Shouldn't the return value of sizeof be a size_t?
|
| + if (tp < 0) return NULL; |
|
scroggo
2014/03/10 19:41:32
I don't think this should ever happen.
Dominik Grewe
2014/03/10 21:54:07
Sorry, please ignore those two lines. I just added
|
| + return allocator->createT<TestDrawLooperContext>(); |
| } |
| #ifdef SK_DEVELOPER |
| @@ -35,6 +29,24 @@ public: |
| } |
| #endif |
| +private: |
| + class TestDrawLooperContext : public SkDrawLooper::Context { |
| + public: |
| + TestDrawLooperContext() : fOnce(true) {} |
| + virtual ~TestDrawLooperContext() {} |
| + |
| + virtual bool next(SkCanvas* canvas, SkPaint*) SK_OVERRIDE { |
| + if (fOnce) { |
| + fOnce = false; |
| + canvas->translate(SkIntToScalar(10), 0); |
| + return true; |
| + } |
| + return false; |
| + } |
| + private: |
| + bool fOnce; |
| + }; |
| + |
| SK_DECLARE_UNFLATTENABLE_OBJECT() |
| }; |