Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(329)

Unified Diff: tests/PDFPrimitivesTest.cpp

Issue 1854023003: Update internal testing ImageFilters to sk_sp (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: update to ToT Created 4 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « tests/ImageFilterTest.cpp ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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());
« no previous file with comments | « tests/ImageFilterTest.cpp ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698