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

Unified Diff: tests/ImageFilterTest.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 | « gm/imagefiltersgraph.cpp ('k') | tests/PDFPrimitivesTest.cpp » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: tests/ImageFilterTest.cpp
diff --git a/tests/ImageFilterTest.cpp b/tests/ImageFilterTest.cpp
index f873fa08221a5adf3d52e49d9b89ff60fb4ded7c..48d3147ef9d275bb58d6cdd6df61947f7b179dbc 100644
--- a/tests/ImageFilterTest.cpp
+++ b/tests/ImageFilterTest.cpp
@@ -51,20 +51,21 @@ namespace {
class MatrixTestImageFilter : public SkImageFilter {
public:
- MatrixTestImageFilter(skiatest::Reporter* reporter, const SkMatrix& expectedMatrix)
- : SkImageFilter(0, nullptr), fReporter(reporter), fExpectedMatrix(expectedMatrix) {
+ static sk_sp<SkImageFilter> Make(skiatest::Reporter* reporter,
+ const SkMatrix& expectedMatrix) {
+ return sk_sp<SkImageFilter>(new MatrixTestImageFilter(reporter, expectedMatrix));
}
+ SK_TO_STRING_OVERRIDE()
+ SK_DECLARE_PUBLIC_FLATTENABLE_DESERIALIZATION_PROCS(MatrixTestImageFilter)
+
+protected:
bool onFilterImageDeprecated(Proxy*, const SkBitmap& src, const Context& ctx,
SkBitmap* result, SkIPoint* offset) const override {
REPORTER_ASSERT(fReporter, ctx.ctm() == fExpectedMatrix);
return true;
}
- SK_TO_STRING_OVERRIDE()
- SK_DECLARE_PUBLIC_FLATTENABLE_DESERIALIZATION_PROCS(MatrixTestImageFilter)
-
-protected:
void flatten(SkWriteBuffer& buffer) const override {
this->INHERITED::flatten(buffer);
buffer.writeFunctionPtr(fReporter);
@@ -72,6 +73,12 @@ protected:
}
private:
+ MatrixTestImageFilter(skiatest::Reporter* reporter, const SkMatrix& expectedMatrix)
+ : INHERITED(nullptr, 0, nullptr)
+ , fReporter(reporter)
+ , fExpectedMatrix(expectedMatrix) {
+ }
+
skiatest::Reporter* fReporter;
SkMatrix fExpectedMatrix;
@@ -250,7 +257,7 @@ sk_sp<SkFlattenable> MatrixTestImageFilter::CreateProc(SkReadBuffer& buffer) {
skiatest::Reporter* reporter = (skiatest::Reporter*)buffer.readFunctionPtr();
SkMatrix matrix;
buffer.readMatrix(&matrix);
- return sk_make_sp<MatrixTestImageFilter>(reporter, matrix);
+ return MatrixTestImageFilter::Make(reporter, matrix);
}
#ifndef SK_IGNORE_TO_STRING
@@ -1027,9 +1034,7 @@ DEF_TEST(ImageFilterMatrix, reporter) {
SkCanvas* recordingCanvas = recorder.beginRecording(100, 100, &factory, 0);
SkPaint paint;
- SkAutoTUnref<MatrixTestImageFilter> imageFilter(
- new MatrixTestImageFilter(reporter, expectedMatrix));
- paint.setImageFilter(imageFilter.get());
+ paint.setImageFilter(MatrixTestImageFilter::Make(reporter, expectedMatrix));
recordingCanvas->saveLayer(nullptr, &paint);
SkPaint solidPaint;
solidPaint.setColor(0xFFFFFFFF);
« no previous file with comments | « gm/imagefiltersgraph.cpp ('k') | tests/PDFPrimitivesTest.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698