| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright 2013 Google Inc. | 2 * Copyright 2013 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 SkTileImageFilter_DEFINED | 8 #ifndef SkTileImageFilter_DEFINED |
| 9 #define SkTileImageFilter_DEFINED | 9 #define SkTileImageFilter_DEFINED |
| 10 | 10 |
| 11 #include "SkImageFilter.h" | 11 #include "SkImageFilter.h" |
| 12 | 12 |
| 13 class SK_API SkTileImageFilter : public SkImageFilter { | 13 class SK_API SkTileImageFilter : public SkImageFilter { |
| 14 public: | 14 public: |
| 15 /** Create a tile image filter | 15 /** Create a tile image filter |
| 16 @param src Defines the pixels to tile | 16 @param src Defines the pixels to tile |
| 17 @param dst Defines the pixels where tiles are drawn | 17 @param dst Defines the pixels where tiles are drawn |
| 18 @param input Input from which the subregion defined by srcRect will b
e tiled | 18 @param input Input from which the subregion defined by srcRect will b
e tiled |
| 19 */ | 19 */ |
| 20 static SkImageFilter* Create(const SkRect& src, const SkRect& dst, SkImageFi
lter* input); | 20 static sk_sp<SkImageFilter> Make(const SkRect& src, |
| 21 const SkRect& dst, |
| 22 sk_sp<SkImageFilter> input); |
| 21 | 23 |
| 22 SkIRect onFilterBounds(const SkIRect& src, const SkMatrix&, MapDirection) co
nst override; | 24 SkIRect onFilterBounds(const SkIRect& src, const SkMatrix&, MapDirection) co
nst override; |
| 23 SkIRect onFilterNodeBounds(const SkIRect&, const SkMatrix&, MapDirection) co
nst override; | 25 SkIRect onFilterNodeBounds(const SkIRect&, const SkMatrix&, MapDirection) co
nst override; |
| 24 SkRect computeFastBounds(const SkRect& src) const override; | 26 SkRect computeFastBounds(const SkRect& src) const override; |
| 25 | 27 |
| 26 SK_TO_STRING_OVERRIDE() | 28 SK_TO_STRING_OVERRIDE() |
| 27 SK_DECLARE_PUBLIC_FLATTENABLE_DESERIALIZATION_PROCS(SkTileImageFilter) | 29 SK_DECLARE_PUBLIC_FLATTENABLE_DESERIALIZATION_PROCS(SkTileImageFilter) |
| 28 | 30 |
| 31 #ifdef SK_SUPPORT_LEGACY_IMAGEFILTER_PTR |
| 32 static SkImageFilter* Create(const SkRect& src, const SkRect& dst, SkImageFi
lter* input) { |
| 33 return Make(src, dst, sk_ref_sp<SkImageFilter>(input)).release(); |
| 34 } |
| 35 #endif |
| 36 |
| 29 protected: | 37 protected: |
| 30 void flatten(SkWriteBuffer& buffer) const override; | 38 void flatten(SkWriteBuffer& buffer) const override; |
| 31 | 39 |
| 32 sk_sp<SkSpecialImage> onFilterImage(SkSpecialImage* source, const Context&, | 40 sk_sp<SkSpecialImage> onFilterImage(SkSpecialImage* source, const Context&, |
| 33 SkIPoint* offset) const override; | 41 SkIPoint* offset) const override; |
| 34 | 42 |
| 35 private: | 43 private: |
| 36 SkTileImageFilter(const SkRect& srcRect, const SkRect& dstRect, SkImageFilte
r* input) | 44 SkTileImageFilter(const SkRect& srcRect, const SkRect& dstRect, sk_sp<SkImag
eFilter> input) |
| 37 : INHERITED(1, &input, NULL), fSrcRect(srcRect), fDstRect(dstRect) {} | 45 : INHERITED(&input, 1, nullptr), fSrcRect(srcRect), fDstRect(dstRect) {} |
| 38 | 46 |
| 39 SkRect fSrcRect; | 47 SkRect fSrcRect; |
| 40 SkRect fDstRect; | 48 SkRect fDstRect; |
| 41 | 49 |
| 42 typedef SkImageFilter INHERITED; | 50 typedef SkImageFilter INHERITED; |
| 43 }; | 51 }; |
| 44 | 52 |
| 45 #endif | 53 #endif |
| OLD | NEW |