OLD | NEW |
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 |
11 #include "SkFlattenable.h" | 11 #include "SkFlattenable.h" |
12 #include "SkMatrix.h" | 12 #include "SkMatrix.h" |
13 #include "SkRect.h" | 13 #include "SkRect.h" |
14 #include "SkTemplates.h" | 14 #include "SkTemplates.h" |
15 | 15 |
16 class SkBitmap; | 16 class SkBitmap; |
17 class SkColorFilter; | 17 class SkColorFilter; |
18 class SkBaseDevice; | 18 class SkBaseDevice; |
| 19 class SkSurfaceProps; |
19 struct SkIPoint; | 20 struct SkIPoint; |
20 class GrFragmentProcessor; | 21 class GrFragmentProcessor; |
21 class GrTexture; | 22 class GrTexture; |
22 | 23 |
23 /** | 24 /** |
24 * Base class for image filters. If one is installed in the paint, then | 25 * 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 | 26 * 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 | 27 * 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 | 28 * 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). | 29 * is what will finally be drawn to the device (using the original xfermode). |
(...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
80 virtual ~Proxy() {}; | 81 virtual ~Proxy() {}; |
81 | 82 |
82 virtual SkBaseDevice* createDevice(int width, int height) = 0; | 83 virtual SkBaseDevice* createDevice(int width, int height) = 0; |
83 // returns true if the proxy can handle this filter natively | 84 // returns true if the proxy can handle this filter natively |
84 virtual bool canHandleImageFilter(const SkImageFilter*) = 0; | 85 virtual bool canHandleImageFilter(const SkImageFilter*) = 0; |
85 // returns true if the proxy handled the filter itself. if this returns | 86 // returns true if the proxy handled the filter itself. if this returns |
86 // false then the filter's code will be called. | 87 // false then the filter's code will be called. |
87 virtual bool filterImage(const SkImageFilter*, const SkBitmap& src, | 88 virtual bool filterImage(const SkImageFilter*, const SkBitmap& src, |
88 const Context&, | 89 const Context&, |
89 SkBitmap* result, SkIPoint* offset) = 0; | 90 SkBitmap* result, SkIPoint* offset) = 0; |
| 91 virtual const SkSurfaceProps* surfaceProps() const = 0; |
90 }; | 92 }; |
91 | 93 |
92 /** | 94 /** |
93 * Request a new (result) image to be created from the src image. | 95 * Request a new (result) image to be created from the src image. |
94 * If the src has no pixels (isNull()) then the request just wants to | 96 * If the src has no pixels (isNull()) then the request just wants to |
95 * receive the config and width/height of the result. | 97 * receive the config and width/height of the result. |
96 * | 98 * |
97 * The matrix is the current matrix on the canvas. | 99 * The matrix is the current matrix on the canvas. |
98 * | 100 * |
99 * Offset is the amount to translate the resulting image relative to the | 101 * Offset is the amount to translate the resulting image relative to the |
(...skipping 222 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
322 */ | 324 */ |
323 #define SK_IMAGEFILTER_UNFLATTEN_COMMON(localVar, expectedCount) \ | 325 #define SK_IMAGEFILTER_UNFLATTEN_COMMON(localVar, expectedCount) \ |
324 Common localVar; \ | 326 Common localVar; \ |
325 do { \ | 327 do { \ |
326 if (!localVar.unflatten(buffer, expectedCount)) { \ | 328 if (!localVar.unflatten(buffer, expectedCount)) { \ |
327 return NULL; \ | 329 return NULL; \ |
328 } \ | 330 } \ |
329 } while (0) | 331 } while (0) |
330 | 332 |
331 #endif | 333 #endif |
OLD | NEW |