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

Unified Diff: tests/ImageFilterTest.cpp

Issue 395603002: Simplify flattening to just write enough to call the factory (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: simplify xfermodes, fix SkLayerDrawLooper Created 6 years, 4 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
Index: tests/ImageFilterTest.cpp
diff --git a/tests/ImageFilterTest.cpp b/tests/ImageFilterTest.cpp
index 4ee9f5dcb90d52a2ec4dfedd10cdcab8e1e7f4af..2227667faae50a300f46bfc808800af397f84778 100644
--- a/tests/ImageFilterTest.cpp
+++ b/tests/ImageFilterTest.cpp
@@ -56,12 +56,15 @@ public:
SK_DECLARE_PUBLIC_FLATTENABLE_DESERIALIZATION_PROCS(MatrixTestImageFilter)
protected:
+#ifdef SK_SUPPORT_LEGACY_DEEPFLATTENING
explicit MatrixTestImageFilter(SkReadBuffer& buffer) : SkImageFilter(0, NULL) {
fReporter = static_cast<skiatest::Reporter*>(buffer.readFunctionPtr());
buffer.readMatrix(&fExpectedMatrix);
}
+#endif
virtual void flatten(SkWriteBuffer& buffer) const SK_OVERRIDE {
+ this->INHERITED::flatten(buffer);
buffer.writeFunctionPtr(fReporter);
buffer.writeMatrix(fExpectedMatrix);
}
@@ -69,10 +72,20 @@ protected:
private:
skiatest::Reporter* fReporter;
SkMatrix fExpectedMatrix;
+
+ typedef SkImageFilter INHERITED;
};
}
+SkFlattenable* MatrixTestImageFilter::CreateProc(SkReadBuffer& buffer) {
+ SK_IMAGEFILTER_UNFLATTEN_COMMON(common, 1);
+ skiatest::Reporter* reporter = (skiatest::Reporter*)buffer.readFunctionPtr();
+ SkMatrix matrix;
+ buffer.readMatrix(&matrix);
+ return SkNEW_ARGS(MatrixTestImageFilter, (reporter, matrix));
+}
+
static void make_small_bitmap(SkBitmap& bitmap) {
bitmap.allocN32Pixels(kBitmapSize, kBitmapSize);
SkCanvas canvas(bitmap);

Powered by Google App Engine
This is Rietveld 408576698