commit-bot@chromium.org | 1a4fb70 | 2013-09-26 16:09:28 +0000 | [diff] [blame] | 1 | /* |
| 2 | * Copyright 2013 Google Inc. |
| 3 | * |
| 4 | * Use of this source code is governed by a BSD-style license that can be |
| 5 | * found in the LICENSE file. |
| 6 | */ |
| 7 | |
| 8 | #ifndef SkTileImageFilter_DEFINED |
| 9 | #define SkTileImageFilter_DEFINED |
| 10 | |
Cary Clark | 4dc5a45 | 2018-05-21 11:56:57 -0400 | [diff] [blame] | 11 | #include "SkFlattenable.h" |
commit-bot@chromium.org | 1a4fb70 | 2013-09-26 16:09:28 +0000 | [diff] [blame] | 12 | #include "SkImageFilter.h" |
| 13 | |
sugoi@google.com | 55f5682 | 2013-10-02 18:27:43 +0000 | [diff] [blame] | 14 | class SK_API SkTileImageFilter : public SkImageFilter { |
commit-bot@chromium.org | 1a4fb70 | 2013-09-26 16:09:28 +0000 | [diff] [blame] | 15 | public: |
commit-bot@chromium.org | cac5fd5 | 2014-03-10 10:51:58 +0000 | [diff] [blame] | 16 | /** Create a tile image filter |
reed | 5ea95df | 2015-10-06 14:05:32 -0700 | [diff] [blame] | 17 | @param src Defines the pixels to tile |
| 18 | @param dst Defines the pixels where tiles are drawn |
commit-bot@chromium.org | 1a4fb70 | 2013-09-26 16:09:28 +0000 | [diff] [blame] | 19 | @param input Input from which the subregion defined by srcRect will be tiled |
| 20 | */ |
robertphillips | 534c270 | 2016-04-15 07:57:40 -0700 | [diff] [blame] | 21 | static sk_sp<SkImageFilter> Make(const SkRect& src, |
| 22 | const SkRect& dst, |
| 23 | sk_sp<SkImageFilter> input); |
commit-bot@chromium.org | 1a4fb70 | 2013-09-26 16:09:28 +0000 | [diff] [blame] | 24 | |
Robert Phillips | 1207843 | 2018-05-17 11:17:39 -0400 | [diff] [blame] | 25 | SkIRect onFilterBounds(const SkIRect& src, const SkMatrix& ctm, |
| 26 | MapDirection, const SkIRect* inputRect) const override; |
| 27 | SkIRect onFilterNodeBounds(const SkIRect&, const SkMatrix& ctm, |
| 28 | MapDirection, const SkIRect* inputRect) const override; |
senorblanco | e5e7984 | 2016-03-21 14:51:59 -0700 | [diff] [blame] | 29 | SkRect computeFastBounds(const SkRect& src) const override; |
commit-bot@chromium.org | 1a4fb70 | 2013-09-26 16:09:28 +0000 | [diff] [blame] | 30 | |
Cary Clark | 4dc5a45 | 2018-05-21 11:56:57 -0400 | [diff] [blame] | 31 | Factory getFactory() const override { return CreateProc; } |
commit-bot@chromium.org | 1a4fb70 | 2013-09-26 16:09:28 +0000 | [diff] [blame] | 32 | |
| 33 | protected: |
schenney | 95376a0 | 2015-10-06 12:59:55 -0700 | [diff] [blame] | 34 | void flatten(SkWriteBuffer& buffer) const override; |
| 35 | |
robertphillips | c14b978 | 2016-04-11 13:26:14 -0700 | [diff] [blame] | 36 | sk_sp<SkSpecialImage> onFilterImage(SkSpecialImage* source, const Context&, |
| 37 | SkIPoint* offset) const override; |
Matt Sarett | 6d72ed9 | 2017-04-10 16:35:33 -0400 | [diff] [blame] | 38 | sk_sp<SkImageFilter> onMakeColorSpace(SkColorSpaceXformer*) const override; |
robertphillips | c14b978 | 2016-04-11 13:26:14 -0700 | [diff] [blame] | 39 | |
schenney | 95376a0 | 2015-10-06 12:59:55 -0700 | [diff] [blame] | 40 | private: |
robertphillips | 534c270 | 2016-04-15 07:57:40 -0700 | [diff] [blame] | 41 | SkTileImageFilter(const SkRect& srcRect, const SkRect& dstRect, sk_sp<SkImageFilter> input) |
| 42 | : INHERITED(&input, 1, nullptr), fSrcRect(srcRect), fDstRect(dstRect) {} |
Cary Clark | 4dc5a45 | 2018-05-21 11:56:57 -0400 | [diff] [blame] | 43 | static sk_sp<SkFlattenable> CreateProc(SkReadBuffer&); |
| 44 | friend class SkFlattenable::PrivateInitializer; |
reed | 5ea95df | 2015-10-06 14:05:32 -0700 | [diff] [blame] | 45 | |
commit-bot@chromium.org | 1a4fb70 | 2013-09-26 16:09:28 +0000 | [diff] [blame] | 46 | SkRect fSrcRect; |
| 47 | SkRect fDstRect; |
robertphillips | c14b978 | 2016-04-11 13:26:14 -0700 | [diff] [blame] | 48 | |
| 49 | typedef SkImageFilter INHERITED; |
commit-bot@chromium.org | 1a4fb70 | 2013-09-26 16:09:28 +0000 | [diff] [blame] | 50 | }; |
| 51 | |
| 52 | #endif |