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

Side by Side Diff: include/core/SkImageFilter.h

Issue 27521002: Remove support for SK_CROP_RECT_IS_INT, now that it is no longer used in Blink or Chrome. (Closed) Base URL: https://skia.googlecode.com/svn/trunk
Patch Set: Created 7 years, 2 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 unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « gm/xfermodeimagefilter.cpp ('k') | src/core/SkImageFilter.cpp » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 /* 1 /*
2 * Copyright 2011 Google Inc. 2 * Copyright 2011 Google Inc.
3 * 3 *
4 * Use of this source code is governed by a BSD-style license that can be 4 * Use of this source code is governed by a BSD-style license that can be
5 * found in the LICENSE file. 5 * found in the LICENSE file.
6 */ 6 */
7 7
8 #ifndef SkImageFilter_DEFINED 8 #ifndef SkImageFilter_DEFINED
9 #define SkImageFilter_DEFINED 9 #define SkImageFilter_DEFINED
10 10
(...skipping 13 matching lines...) Expand all
24 * Base class for image filters. If one is installed in the paint, then 24 * Base class for image filters. If one is installed in the paint, then
25 * all drawing occurs as usual, but it is as if the drawing happened into an 25 * all drawing occurs as usual, but it is as if the drawing happened into an
26 * offscreen (before the xfermode is applied). This offscreen bitmap will 26 * offscreen (before the xfermode is applied). This offscreen bitmap will
27 * then be handed to the imagefilter, who in turn creates a new bitmap which 27 * then be handed to the imagefilter, who in turn creates a new bitmap which
28 * is what will finally be drawn to the device (using the original xfermode). 28 * is what will finally be drawn to the device (using the original xfermode).
29 */ 29 */
30 class SK_API SkImageFilter : public SkFlattenable { 30 class SK_API SkImageFilter : public SkFlattenable {
31 public: 31 public:
32 SK_DECLARE_INST_COUNT(SkImageFilter) 32 SK_DECLARE_INST_COUNT(SkImageFilter)
33 33
34 #ifdef SK_CROP_RECT_IS_INT
35 typedef SkIRect CropRect;
36 #else
37 struct CropRect { 34 struct CropRect {
38 SkRect fRect; 35 SkRect fRect;
39 uint32_t fFlags; 36 uint32_t fFlags;
reed1 2013/10/16 14:51:53 Is your longer-term plan to keep these fields expo
Stephen White 2013/10/16 14:57:15 I was going to leave it as a struct, in the spirit
reed1 2013/10/16 14:59:27 Not sure if you're serious, but rect doesn't have
40 enum CropEdge { 37 enum CropEdge {
41 kHasLeft_CropEdge = 0x01, 38 kHasLeft_CropEdge = 0x01,
42 kHasTop_CropEdge = 0x02, 39 kHasTop_CropEdge = 0x02,
43 kHasRight_CropEdge = 0x04, 40 kHasRight_CropEdge = 0x04,
44 kHasBottom_CropEdge = 0x08, 41 kHasBottom_CropEdge = 0x08,
45 kHasAll_CropEdge = 0x0F, 42 kHasAll_CropEdge = 0x0F,
46 }; 43 };
47 CropRect() {} 44 CropRect() {}
48 explicit CropRect(const SkRect& rect, uint32_t flags = kHasAll_CropEdge) : fRect(rect), fFlags(flags) {} 45 explicit CropRect(const SkRect& rect, uint32_t flags = kHasAll_CropEdge) : fRect(rect), fFlags(flags) {}
49 bool isSet() const 46 bool isSet() const
reed1 2013/10/16 14:51:53 Can we have a more descriptive name, and/or some d
Stephen White 2013/10/16 14:57:15 Done.
50 { 47 {
51 return fFlags != 0x0; 48 return fFlags != 0x0;
52 } 49 }
53 }; 50 };
54 #endif
55 51
56 class Proxy { 52 class Proxy {
57 public: 53 public:
58 virtual ~Proxy() {}; 54 virtual ~Proxy() {};
59 55
60 virtual SkBaseDevice* createDevice(int width, int height) = 0; 56 virtual SkBaseDevice* createDevice(int width, int height) = 0;
61 // returns true if the proxy can handle this filter natively 57 // returns true if the proxy can handle this filter natively
62 virtual bool canHandleImageFilter(SkImageFilter*) = 0; 58 virtual bool canHandleImageFilter(SkImageFilter*) = 0;
63 // returns true if the proxy handled the filter itself. if this returns 59 // returns true if the proxy handled the filter itself. if this returns
64 // false then the filter's code will be called. 60 // false then the filter's code will be called.
(...skipping 88 matching lines...) Expand 10 before | Expand all | Expand 10 after
153 149
154 /** 150 /**
155 * Returns the crop rectangle of this filter. This is set at construction 151 * Returns the crop rectangle of this filter. This is set at construction
156 * time, and determines which pixels from the input image will 152 * time, and determines which pixels from the input image will
157 * be processed. The size of this rectangle should be used as the size 153 * be processed. The size of this rectangle should be used as the size
158 * of the destination image. The origin of this rect should be used to 154 * of the destination image. The origin of this rect should be used to
159 * offset access to the input images, and should also be added to the 155 * offset access to the input images, and should also be added to the
160 * "offset" parameter in onFilterImage and filterImageGPU(). (The latter 156 * "offset" parameter in onFilterImage and filterImageGPU(). (The latter
161 * ensures that the resulting buffer is drawn in the correct location.) 157 * ensures that the resulting buffer is drawn in the correct location.)
162 */ 158 */
163 #ifdef SK_CROP_RECT_IS_INT
164 bool cropRectIsSet() const { return !fCropRect.isLargest(); }
165 #else
166 bool cropRectIsSet() const { return fCropRect.isSet(); } 159 bool cropRectIsSet() const { return fCropRect.isSet(); }
167 #endif
168 160
169 protected: 161 protected:
170 SkImageFilter(int inputCount, SkImageFilter** inputs, const CropRect* cropRe ct = NULL); 162 SkImageFilter(int inputCount, SkImageFilter** inputs, const CropRect* cropRe ct = NULL);
171 163
172 // Convenience constructor for 1-input filters. 164 // Convenience constructor for 1-input filters.
173 explicit SkImageFilter(SkImageFilter* input, const CropRect* cropRect = NULL ); 165 explicit SkImageFilter(SkImageFilter* input, const CropRect* cropRect = NULL );
174 166
175 // Convenience constructor for 2-input filters. 167 // Convenience constructor for 2-input filters.
176 SkImageFilter(SkImageFilter* input1, SkImageFilter* input2, const CropRect* cropRect = NULL); 168 SkImageFilter(SkImageFilter* input1, SkImageFilter* input2, const CropRect* cropRect = NULL);
177 169
(...skipping 15 matching lines...) Expand all
193 bool applyCropRect(SkIRect* rect, const SkMatrix& matrix) const; 185 bool applyCropRect(SkIRect* rect, const SkMatrix& matrix) const;
194 186
195 private: 187 private:
196 typedef SkFlattenable INHERITED; 188 typedef SkFlattenable INHERITED;
197 int fInputCount; 189 int fInputCount;
198 SkImageFilter** fInputs; 190 SkImageFilter** fInputs;
199 CropRect fCropRect; 191 CropRect fCropRect;
200 }; 192 };
201 193
202 #endif 194 #endif
OLDNEW
« no previous file with comments | « gm/xfermodeimagefilter.cpp ('k') | src/core/SkImageFilter.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698