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

Unified Diff: include/core/SkImageFilter.h

Issue 1172693002: remove subclassing from ImageFilter::Proxy (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: Created 5 years, 6 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: include/core/SkImageFilter.h
diff --git a/include/core/SkImageFilter.h b/include/core/SkImageFilter.h
index 55a504ced29f7a64470b9701d12fc56c4e62098c..3508df50ce81d43d6193e6e69f97587462593852 100644
--- a/include/core/SkImageFilter.h
+++ b/include/core/SkImageFilter.h
@@ -12,15 +12,15 @@
#include "SkFlattenable.h"
#include "SkMatrix.h"
#include "SkRect.h"
+#include "SkSurfaceProps.h"
#include "SkTemplates.h"
+class GrFragmentProcessor;
+class GrTexture;
+class SkBaseDevice;
class SkBitmap;
class SkColorFilter;
-class SkBaseDevice;
-class SkSurfaceProps;
struct SkIPoint;
-class GrFragmentProcessor;
-class GrTexture;
/**
* Base class for image filters. If one is installed in the paint, then
@@ -75,21 +75,28 @@ public:
private:
SkMatrix fCTM;
SkIRect fClipBounds;
- Cache* fCache;
+ Cache* fCache;
};
class Proxy {
public:
- virtual ~Proxy() {};
-
- virtual SkBaseDevice* createDevice(int width, int height) = 0;
+ Proxy(SkBaseDevice* device, const SkSurfaceProps& props)
+ : fDevice(device)
+ , fProps(props.flags(), kUnknown_SkPixelGeometry)
+ {}
+
+ SkBaseDevice* createDevice(int width, int height);
// returns true if the proxy handled the filter itself. if this returns
// false then the filter's code will be called.
- virtual bool filterImage(const SkImageFilter*, const SkBitmap& src,
- const Context&,
- SkBitmap* result, SkIPoint* offset) = 0;
- virtual const SkSurfaceProps* surfaceProps() const = 0;
+ bool filterImage(const SkImageFilter*, const SkBitmap& src, const SkImageFilter::Context&,
+ SkBitmap* result, SkIPoint* offset);
+ const SkSurfaceProps& surfaceProps() const { return fProps; }
+
+ private:
+ SkBaseDevice* fDevice;
+ const SkSurfaceProps fProps;
};
+
/**
* Request a new (result) image to be created from the src image.
« no previous file with comments | « include/core/SkDevice.h ('k') | src/core/SkCanvas.cpp » ('j') | src/core/SkImageFilter.cpp » ('J')

Powered by Google App Engine
This is Rietveld 408576698