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

Unified Diff: include/core/SkImageFilter.h

Issue 19775006: Implement crop rect for SkImageFilter (Closed) Base URL: https://skia.googlecode.com/svn/trunk
Patch Set: Fix comments Created 7 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 | « gyp/tests.gyp ('k') | include/core/SkRect.h » ('j') | no next file with comments »
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 fe383ae9e316d632ce04eb15efdd0b40efeeb46c..e467761a1f0607e2ce244003be132c295c4f9874 100644
--- a/include/core/SkImageFilter.h
+++ b/include/core/SkImageFilter.h
@@ -9,13 +9,13 @@
#define SkImageFilter_DEFINED
#include "SkFlattenable.h"
+#include "SkRect.h"
class SkBitmap;
class SkColorFilter;
class SkDevice;
class SkMatrix;
struct SkIPoint;
-struct SkIRect;
class SkShader;
class GrEffectRef;
class GrTexture;
@@ -139,14 +139,25 @@ public:
return fInputs[i];
}
+ /**
+ * Returns the crop rectangle of this filter. This is set at construction
+ * time, and determines which pixels from the input image will
+ * be processed. The size of this rectangle should be used as the size
+ * of the destination image. The origin of this rect should be used to
+ * offset access to the input images, and should also be added to the
+ * "offset" parameter in onFilterImage and filterImageGPU(). (The latter
+ * ensures that the resulting buffer is drawn in the correct location.)
+ */
+ const SkIRect& cropRect() const { return fCropRect; }
+
protected:
- SkImageFilter(int inputCount, SkImageFilter** inputs);
+ SkImageFilter(int inputCount, SkImageFilter** inputs, const SkIRect* cropRect = NULL);
// Convenience constructor for 1-input filters.
- explicit SkImageFilter(SkImageFilter* input);
+ explicit SkImageFilter(SkImageFilter* input, const SkIRect* cropRect = NULL);
// Convenience constructor for 2-input filters.
- SkImageFilter(SkImageFilter* input1, SkImageFilter* input2);
+ SkImageFilter(SkImageFilter* input1, SkImageFilter* input2, const SkIRect* cropRect = NULL);
virtual ~SkImageFilter();
@@ -160,10 +171,15 @@ protected:
// Default impl copies src into dst and returns true
virtual bool onFilterBounds(const SkIRect&, const SkMatrix&, SkIRect*);
+ // Sets rect to the intersection of rect and the crop rect. If there
+ // is no overlap, returns false and leaves rect unchanged.
+ bool applyCropRect(SkIRect* rect) const;
+
private:
typedef SkFlattenable INHERITED;
int fInputCount;
SkImageFilter** fInputs;
+ SkIRect fCropRect;
};
#endif
« no previous file with comments | « gyp/tests.gyp ('k') | include/core/SkRect.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698