Index: tests/QuickRejectTest.cpp |
diff --git a/tests/QuickRejectTest.cpp b/tests/QuickRejectTest.cpp |
index 5c1b8776c21697674a2f2e0c6137d12d3c83a591..01374a3f42f72bc09c3acef684f0a4b57bf84203 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,10 @@ |
*/ |
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::DrawContext* init(SkCanvas*, void*, size_t) const |
+ SK_OVERRIDE { |
+ return SkNEW(TestDrawLooperContext); |
} |
#ifdef SK_DEVELOPER |
@@ -35,6 +27,24 @@ public: |
} |
#endif |
+private: |
+ class TestDrawLooperContext : public SkDrawLooper::DrawContext { |
+ 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() |
}; |