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

Unified Diff: include/core/SkImageFilter.h

Issue 395273002: factor out flattening/unflattening of common fields from SkImageFilter (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: use SkAutoSTarray Created 6 years, 5 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 | « no previous file | src/core/SkImageFilter.cpp » ('j') | src/core/SkImageFilter.cpp » ('J')
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: include/core/SkImageFilter.h
diff --git a/include/core/SkImageFilter.h b/include/core/SkImageFilter.h
index a571184aa21bb66c4bc38b4b2eeca942245e4931..cd34ba3f91bd55664c05ce46a6e268003e22ba8f 100644
--- a/include/core/SkImageFilter.h
+++ b/include/core/SkImageFilter.h
@@ -11,6 +11,7 @@
#include "SkFlattenable.h"
#include "SkMatrix.h"
#include "SkRect.h"
+#include "SkTemplates.h"
class SkBitmap;
class SkColorFilter;
@@ -199,6 +200,31 @@ public:
SK_DEFINE_FLATTENABLE_TYPE(SkImageFilter)
protected:
+ class Common {
+ public:
+ Common() {}
+ ~Common();
+
+ bool unflatten(SkReadBuffer&, int expectedInputs = -1);
+
+ CropRect cropRect() const { return fCropRect; }
+ int inputCount() const { return fInputs.count(); }
+ SkImageFilter** inputs() const { return fInputs.get(); }
+
+ // If the caller wants a copy of the inputs, call this and it will transfer ownership
+ // of the unflattened input filters to the caller. This is just a short-cut for copying
+ // the inputs, calling ref() on each, and then waiting for Common's destructor to call
+ // unref() on each.
+ void detachInputs(SkImageFilter** inputs);
+
+ private:
+ CropRect fCropRect;
+ // most filters accept at most 2 input-filters
+ SkAutoSTArray<2, SkImageFilter*> fInputs;
+
+ void allocInputs(int count);
+ };
+
SkImageFilter(int inputCount, SkImageFilter** inputs, const CropRect* cropRect = NULL);
virtual ~SkImageFilter();
« no previous file with comments | « no previous file | src/core/SkImageFilter.cpp » ('j') | src/core/SkImageFilter.cpp » ('J')

Powered by Google App Engine
This is Rietveld 408576698