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

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

Issue 112803004: Make SkImageFilter crop rects relative to the primitive origin, instead of relative to their parent (Closed) Base URL: https://skia.googlecode.com/svn/trunk
Patch Set: Updated to ToT Created 6 years, 11 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/tileimagefilter.cpp ('k') | src/core/SkCanvas.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 53 matching lines...) Expand 10 before | Expand all | Expand 10 after
64 }; 64 };
65 65
66 /** 66 /**
67 * Request a new (result) image to be created from the src image. 67 * Request a new (result) image to be created from the src image.
68 * If the src has no pixels (isNull()) then the request just wants to 68 * If the src has no pixels (isNull()) then the request just wants to
69 * receive the config and width/height of the result. 69 * receive the config and width/height of the result.
70 * 70 *
71 * The matrix is the current matrix on the canvas. 71 * The matrix is the current matrix on the canvas.
72 * 72 *
73 * Offset is the amount to translate the resulting image relative to the 73 * Offset is the amount to translate the resulting image relative to the
74 * src when it is drawn. 74 * src when it is drawn. This is an out-param.
75 * 75 *
76 * If the result image cannot be created, return false, in which case both 76 * If the result image cannot be created, return false, in which case both
77 * the result and offset parameters will be ignored by the caller. 77 * the result and offset parameters will be ignored by the caller.
78 */ 78 */
79 bool filterImage(Proxy*, const SkBitmap& src, const SkMatrix& ctm, 79 bool filterImage(Proxy*, const SkBitmap& src, const SkMatrix& ctm,
80 SkBitmap* result, SkIPoint* offset); 80 SkBitmap* result, SkIPoint* offset);
81 81
82 /** 82 /**
83 * Given the src bounds of an image, this returns the bounds of the result 83 * Given the src bounds of an image, this returns the bounds of the result
84 * image after the filter has been applied. 84 * image after the filter has been applied.
(...skipping 75 matching lines...) Expand 10 before | Expand all | Expand 10 after
160 * Constructs a new SkImageFilter read from an SkFlattenableReadBuffer obje ct. 160 * Constructs a new SkImageFilter read from an SkFlattenableReadBuffer obje ct.
161 * 161 *
162 * @param inputCount The exact number of inputs expected for this SkImag eFilter object. 162 * @param inputCount The exact number of inputs expected for this SkImag eFilter object.
163 * -1 can be used if the filter accepts any number of inputs. 163 * -1 can be used if the filter accepts any number of inputs.
164 * @param rb SkFlattenableReadBuffer object from which the SkIma geFilter is read. 164 * @param rb SkFlattenableReadBuffer object from which the SkIma geFilter is read.
165 */ 165 */
166 explicit SkImageFilter(int inputCount, SkFlattenableReadBuffer& rb); 166 explicit SkImageFilter(int inputCount, SkFlattenableReadBuffer& rb);
167 167
168 virtual void flatten(SkFlattenableWriteBuffer& wb) const SK_OVERRIDE; 168 virtual void flatten(SkFlattenableWriteBuffer& wb) const SK_OVERRIDE;
169 169
170 // Default impl returns false 170 /**
171 * This is the virtual which should be overridden by the derived class
172 * to perform image filtering.
173 *
174 * src is the original primitive bitmap. If the filter has a connected
175 * input, it should recurse on that input and use that in place of src.
176 *
177 * The matrix is the current matrix on the canvas.
178 *
179 * Offset is the amount to translate the resulting image relative to the
180 * src when it is drawn. This is an out-param.
181 *
182 * If the result image cannot be created, this should false, in which
183 * case both the result and offset parameters will be ignored by the
184 * caller.
185 */
171 virtual bool onFilterImage(Proxy*, const SkBitmap& src, const SkMatrix&, 186 virtual bool onFilterImage(Proxy*, const SkBitmap& src, const SkMatrix&,
172 SkBitmap* result, SkIPoint* offset); 187 SkBitmap* result, SkIPoint* offset);
173 // Default impl copies src into dst and returns true 188 // Default impl copies src into dst and returns true
174 virtual bool onFilterBounds(const SkIRect&, const SkMatrix&, SkIRect*); 189 virtual bool onFilterBounds(const SkIRect&, const SkMatrix&, SkIRect*);
175 190
176 // Applies "matrix" to the crop rect, and sets "rect" to the intersection of 191 // Applies "matrix" to the crop rect, and sets "rect" to the intersection of
177 // "rect" and the transformed crop rect. If there is no overlap, returns 192 // "rect" and the transformed crop rect. If there is no overlap, returns
178 // false and leaves "rect" unchanged. 193 // false and leaves "rect" unchanged.
179 bool applyCropRect(SkIRect* rect, const SkMatrix& matrix) const; 194 bool applyCropRect(SkIRect* rect, const SkMatrix& matrix) const;
180 195
(...skipping 18 matching lines...) Expand all
199 const SkIRect& bounds) const; 214 const SkIRect& bounds) const;
200 215
201 private: 216 private:
202 typedef SkFlattenable INHERITED; 217 typedef SkFlattenable INHERITED;
203 int fInputCount; 218 int fInputCount;
204 SkImageFilter** fInputs; 219 SkImageFilter** fInputs;
205 CropRect fCropRect; 220 CropRect fCropRect;
206 }; 221 };
207 222
208 #endif 223 #endif
OLDNEW
« no previous file with comments | « gm/tileimagefilter.cpp ('k') | src/core/SkCanvas.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698