OLD | NEW |
1 /* | 1 /* |
2 * Copyright 2012 The Android Open Source Project | 2 * Copyright 2012 The Android Open Source Project |
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 #include "SkMorphologyImageFilter.h" | 8 #include "SkMorphologyImageFilter.h" |
9 #include "SkBitmap.h" | 9 #include "SkBitmap.h" |
10 #include "SkColorPriv.h" | 10 #include "SkColorPriv.h" |
(...skipping 16 matching lines...) Expand all Loading... |
27 fRadius.fWidth = buffer.readInt(); | 27 fRadius.fWidth = buffer.readInt(); |
28 fRadius.fHeight = buffer.readInt(); | 28 fRadius.fHeight = buffer.readInt(); |
29 buffer.validate((fRadius.fWidth >= 0) && | 29 buffer.validate((fRadius.fWidth >= 0) && |
30 (fRadius.fHeight >= 0)); | 30 (fRadius.fHeight >= 0)); |
31 } | 31 } |
32 #endif | 32 #endif |
33 | 33 |
34 SkMorphologyImageFilter::SkMorphologyImageFilter(int radiusX, | 34 SkMorphologyImageFilter::SkMorphologyImageFilter(int radiusX, |
35 int radiusY, | 35 int radiusY, |
36 SkImageFilter* input, | 36 SkImageFilter* input, |
37 const CropRect* cropRect) | 37 const CropRect* cropRect, |
38 : INHERITED(1, &input, cropRect), fRadius(SkISize::Make(radiusX, radiusY)) { | 38 uint32_t uniqueID) |
| 39 : INHERITED(1, &input, cropRect, uniqueID), fRadius(SkISize::Make(radiusX, r
adiusY)) { |
39 } | 40 } |
40 | 41 |
41 void SkMorphologyImageFilter::flatten(SkWriteBuffer& buffer) const { | 42 void SkMorphologyImageFilter::flatten(SkWriteBuffer& buffer) const { |
42 this->INHERITED::flatten(buffer); | 43 this->INHERITED::flatten(buffer); |
43 buffer.writeInt(fRadius.fWidth); | 44 buffer.writeInt(fRadius.fWidth); |
44 buffer.writeInt(fRadius.fHeight); | 45 buffer.writeInt(fRadius.fHeight); |
45 } | 46 } |
46 | 47 |
47 enum MorphDirection { | 48 enum MorphDirection { |
48 kX, kY | 49 kX, kY |
(...skipping 207 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
256 ctm.mapVectors(&radius, 1); | 257 ctm.mapVectors(&radius, 1); |
257 bounds.outset(SkScalarCeilToInt(radius.x()), SkScalarCeilToInt(radius.y())); | 258 bounds.outset(SkScalarCeilToInt(radius.x()), SkScalarCeilToInt(radius.y())); |
258 *dst = bounds; | 259 *dst = bounds; |
259 return true; | 260 return true; |
260 } | 261 } |
261 | 262 |
262 SkFlattenable* SkErodeImageFilter::CreateProc(SkReadBuffer& buffer) { | 263 SkFlattenable* SkErodeImageFilter::CreateProc(SkReadBuffer& buffer) { |
263 SK_IMAGEFILTER_UNFLATTEN_COMMON(common, 1); | 264 SK_IMAGEFILTER_UNFLATTEN_COMMON(common, 1); |
264 const int width = buffer.readInt(); | 265 const int width = buffer.readInt(); |
265 const int height = buffer.readInt(); | 266 const int height = buffer.readInt(); |
266 return Create(width, height, common.getInput(0), &common.cropRect()); | 267 return Create(width, height, common.getInput(0), &common.cropRect(), common.
uniqueID()); |
267 } | 268 } |
268 | 269 |
269 SkFlattenable* SkDilateImageFilter::CreateProc(SkReadBuffer& buffer) { | 270 SkFlattenable* SkDilateImageFilter::CreateProc(SkReadBuffer& buffer) { |
270 SK_IMAGEFILTER_UNFLATTEN_COMMON(common, 1); | 271 SK_IMAGEFILTER_UNFLATTEN_COMMON(common, 1); |
271 const int width = buffer.readInt(); | 272 const int width = buffer.readInt(); |
272 const int height = buffer.readInt(); | 273 const int height = buffer.readInt(); |
273 return Create(width, height, common.getInput(0), &common.cropRect()); | 274 return Create(width, height, common.getInput(0), &common.cropRect(), common.
uniqueID()); |
274 } | 275 } |
275 | 276 |
276 #if SK_SUPPORT_GPU | 277 #if SK_SUPPORT_GPU |
277 | 278 |
278 /////////////////////////////////////////////////////////////////////////////// | 279 /////////////////////////////////////////////////////////////////////////////// |
279 | 280 |
280 class GrGLMorphologyEffect; | 281 class GrGLMorphologyEffect; |
281 | 282 |
282 /** | 283 /** |
283 * Morphology effects. Depending upon the type of morphology, either the | 284 * Morphology effects. Depending upon the type of morphology, either the |
(...skipping 316 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
600 SkBitmap* result, SkIPoint* offset) con
st { | 601 SkBitmap* result, SkIPoint* offset) con
st { |
601 return this->filterImageGPUGeneric(true, proxy, src, ctx, result, offset); | 602 return this->filterImageGPUGeneric(true, proxy, src, ctx, result, offset); |
602 } | 603 } |
603 | 604 |
604 bool SkErodeImageFilter::filterImageGPU(Proxy* proxy, const SkBitmap& src, const
Context& ctx, | 605 bool SkErodeImageFilter::filterImageGPU(Proxy* proxy, const SkBitmap& src, const
Context& ctx, |
605 SkBitmap* result, SkIPoint* offset) cons
t { | 606 SkBitmap* result, SkIPoint* offset) cons
t { |
606 return this->filterImageGPUGeneric(false, proxy, src, ctx, result, offset); | 607 return this->filterImageGPUGeneric(false, proxy, src, ctx, result, offset); |
607 } | 608 } |
608 | 609 |
609 #endif | 610 #endif |
OLD | NEW |