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 |
(...skipping 77 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
88 */ | 88 */ |
89 bool applyTo(const SkIRect& imageBounds, const Context&, SkIRect* croppe
d) const; | 89 bool applyTo(const SkIRect& imageBounds, const Context&, SkIRect* croppe
d) const; |
90 | 90 |
91 private: | 91 private: |
92 SkRect fRect; | 92 SkRect fRect; |
93 uint32_t fFlags; | 93 uint32_t fFlags; |
94 }; | 94 }; |
95 | 95 |
96 class Proxy { | 96 class Proxy { |
97 public: | 97 public: |
98 Proxy(SkBaseDevice* device) : fDevice(device) { } | 98 virtual ~Proxy() {} |
99 | 99 |
100 SkBaseDevice* createDevice(int width, int height); | 100 virtual SkBaseDevice* createDevice(int width, int height) = 0; |
| 101 |
| 102 // Returns true if the proxy handled the filter itself. If this returns |
| 103 // false then the filter's code will be called. |
| 104 virtual bool filterImage(const SkImageFilter*, const SkBitmap& src, |
| 105 const SkImageFilter::Context&, |
| 106 SkBitmap* result, SkIPoint* offset) = 0; |
| 107 }; |
| 108 |
| 109 class DeviceProxy : public Proxy { |
| 110 public: |
| 111 DeviceProxy(SkBaseDevice* device) : fDevice(device) {} |
| 112 |
| 113 SkBaseDevice* createDevice(int width, int height) override; |
101 | 114 |
102 // Returns true if the proxy handled the filter itself. If this returns | 115 // Returns true if the proxy handled the filter itself. If this returns |
103 // false then the filter's code will be called. | 116 // false then the filter's code will be called. |
104 bool filterImage(const SkImageFilter*, const SkBitmap& src, const SkImag
eFilter::Context&, | 117 bool filterImage(const SkImageFilter*, const SkBitmap& src, const SkImag
eFilter::Context&, |
105 SkBitmap* result, SkIPoint* offset); | 118 SkBitmap* result, SkIPoint* offset) override; |
106 | 119 |
107 private: | 120 private: |
108 SkBaseDevice* fDevice; | 121 SkBaseDevice* fDevice; |
109 }; | 122 }; |
110 | 123 |
111 | |
112 /** | 124 /** |
113 * Request a new (result) image to be created from the src image. | 125 * Request a new (result) image to be created from the src image. |
114 * If the src has no pixels (isNull()) then the request just wants to | 126 * If the src has no pixels (isNull()) then the request just wants to |
115 * receive the config and width/height of the result. | 127 * receive the config and width/height of the result. |
116 * | 128 * |
117 * The matrix is the current matrix on the canvas. | 129 * The matrix is the current matrix on the canvas. |
118 * | 130 * |
119 * Offset is the amount to translate the resulting image relative to the | 131 * Offset is the amount to translate the resulting image relative to the |
120 * src when it is drawn. This is an out-param. | 132 * src when it is drawn. This is an out-param. |
121 * | 133 * |
(...skipping 270 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
392 */ | 404 */ |
393 #define SK_IMAGEFILTER_UNFLATTEN_COMMON(localVar, expectedCount) \ | 405 #define SK_IMAGEFILTER_UNFLATTEN_COMMON(localVar, expectedCount) \ |
394 Common localVar; \ | 406 Common localVar; \ |
395 do { \ | 407 do { \ |
396 if (!localVar.unflatten(buffer, expectedCount)) { \ | 408 if (!localVar.unflatten(buffer, expectedCount)) { \ |
397 return NULL; \ | 409 return NULL; \ |
398 } \ | 410 } \ |
399 } while (0) | 411 } while (0) |
400 | 412 |
401 #endif | 413 #endif |
OLD | NEW |