Index: tests/PDFPrimitivesTest.cpp |
diff --git a/tests/PDFPrimitivesTest.cpp b/tests/PDFPrimitivesTest.cpp |
index f4c29b358db6a3dde8fe34848d87f061dfec675f..ac3b28bb16c71ef2cb2f40e0be9b24a5b18fabce 100644 |
--- a/tests/PDFPrimitivesTest.cpp |
+++ b/tests/PDFPrimitivesTest.cpp |
@@ -364,8 +364,15 @@ namespace { |
class DummyImageFilter : public SkImageFilter { |
public: |
- DummyImageFilter(bool visited = false) : SkImageFilter(0, nullptr), fVisited(visited) {} |
- ~DummyImageFilter() override {} |
+ static sk_sp<DummyImageFilter> Make(bool visited = false) { |
+ return sk_sp<DummyImageFilter>(new DummyImageFilter(visited)); |
+ } |
+ |
+ SK_TO_STRING_OVERRIDE() |
+ SK_DECLARE_PUBLIC_FLATTENABLE_DESERIALIZATION_PROCS(DummyImageFilter) |
+ bool visited() const { return fVisited; } |
+ |
+protected: |
bool onFilterImageDeprecated(Proxy*, const SkBitmap& src, const Context&, |
SkBitmap* result, SkIPoint* offset) const override { |
fVisited = true; |
@@ -373,18 +380,19 @@ public: |
*result = src; |
return true; |
} |
- SK_TO_STRING_OVERRIDE() |
- SK_DECLARE_PUBLIC_FLATTENABLE_DESERIALIZATION_PROCS(DummyImageFilter) |
- bool visited() const { return fVisited; } |
private: |
+ DummyImageFilter(bool visited) : INHERITED(nullptr, 0, nullptr), fVisited(visited) {} |
+ |
mutable bool fVisited; |
+ |
+ typedef SkImageFilter INHERITED; |
}; |
sk_sp<SkFlattenable> DummyImageFilter::CreateProc(SkReadBuffer& buffer) { |
SK_IMAGEFILTER_UNFLATTEN_COMMON(common, 0); |
bool visited = buffer.readBool(); |
- return sk_make_sp<DummyImageFilter>(visited); |
+ return DummyImageFilter::Make(visited); |
} |
#ifndef SK_IGNORE_TO_STRING |
@@ -403,7 +411,7 @@ DEF_TEST(PDFImageFilter, reporter) { |
sk_sp<SkDocument> doc(SkDocument::CreatePDF(&stream)); |
SkCanvas* canvas = doc->beginPage(100.0f, 100.0f); |
- sk_sp<DummyImageFilter> filter(new DummyImageFilter()); |
+ sk_sp<DummyImageFilter> filter(DummyImageFilter::Make()); |
// Filter just created; should be unvisited. |
REPORTER_ASSERT(reporter, !filter->visited()); |