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 | |
| 11 | #include "SkImageFilter.h" |
| 12 | |
sugoi@google.com | 55f5682 | 2013-10-02 18:27:43 +0000 | [diff] [blame] | 13 | class SK_API SkTileImageFilter : public SkImageFilter { |
commit-bot@chromium.org | 1a4fb70 | 2013-09-26 16:09:28 +0000 | [diff] [blame] | 14 | typedef SkImageFilter INHERITED; |
| 15 | |
| 16 | public: |
commit-bot@chromium.org | cac5fd5 | 2014-03-10 10:51:58 +0000 | [diff] [blame] | 17 | /** Create a tile image filter |
commit-bot@chromium.org | 1a4fb70 | 2013-09-26 16:09:28 +0000 | [diff] [blame] | 18 | @param srcRect Defines the pixels to tile |
| 19 | @param dstRect Defines the pixels where tiles are drawn |
| 20 | @param input Input from which the subregion defined by srcRect will be tiled |
| 21 | */ |
commit-bot@chromium.org | cac5fd5 | 2014-03-10 10:51:58 +0000 | [diff] [blame] | 22 | static SkTileImageFilter* Create(const SkRect& srcRect, const SkRect& dstRect, |
senorblanco | 5e5f948 | 2014-08-26 12:27:12 -0700 | [diff] [blame^] | 23 | SkImageFilter* input, uint32_t uniqueID = 0); |
commit-bot@chromium.org | 1a4fb70 | 2013-09-26 16:09:28 +0000 | [diff] [blame] | 24 | |
senorblanco@chromium.org | 4cb543d | 2014-03-14 15:44:01 +0000 | [diff] [blame] | 25 | virtual bool onFilterImage(Proxy* proxy, const SkBitmap& src, const Context& ctx, |
commit-bot@chromium.org | ae761f7 | 2014-02-05 22:32:02 +0000 | [diff] [blame] | 26 | SkBitmap* dst, SkIPoint* offset) const SK_OVERRIDE; |
senorblanco@chromium.org | 0a5c233 | 2014-04-29 15:20:39 +0000 | [diff] [blame] | 27 | virtual bool onFilterBounds(const SkIRect& src, const SkMatrix&, |
| 28 | SkIRect* dst) const SK_OVERRIDE; |
commit-bot@chromium.org | 1a4fb70 | 2013-09-26 16:09:28 +0000 | [diff] [blame] | 29 | |
| 30 | SK_DECLARE_PUBLIC_FLATTENABLE_DESERIALIZATION_PROCS(SkTileImageFilter) |
| 31 | |
| 32 | protected: |
senorblanco | 5e5f948 | 2014-08-26 12:27:12 -0700 | [diff] [blame^] | 33 | SkTileImageFilter(const SkRect& srcRect, const SkRect& dstRect, SkImageFilter* input, uint32_t uniqueID) |
| 34 | : INHERITED(1, &input, NULL, uniqueID), fSrcRect(srcRect), fDstRect(dstRect) {} |
reed | 9fa60da | 2014-08-21 07:59:51 -0700 | [diff] [blame] | 35 | #ifdef SK_SUPPORT_LEGACY_DEEPFLATTENING |
commit-bot@chromium.org | 8b0e8ac | 2014-01-30 18:58:24 +0000 | [diff] [blame] | 36 | explicit SkTileImageFilter(SkReadBuffer& buffer); |
reed | 9fa60da | 2014-08-21 07:59:51 -0700 | [diff] [blame] | 37 | #endif |
commit-bot@chromium.org | 1a4fb70 | 2013-09-26 16:09:28 +0000 | [diff] [blame] | 38 | |
commit-bot@chromium.org | 8b0e8ac | 2014-01-30 18:58:24 +0000 | [diff] [blame] | 39 | virtual void flatten(SkWriteBuffer& buffer) const SK_OVERRIDE; |
commit-bot@chromium.org | 1a4fb70 | 2013-09-26 16:09:28 +0000 | [diff] [blame] | 40 | |
commit-bot@chromium.org | 1a4fb70 | 2013-09-26 16:09:28 +0000 | [diff] [blame] | 41 | private: |
| 42 | SkRect fSrcRect; |
| 43 | SkRect fDstRect; |
| 44 | }; |
| 45 | |
| 46 | #endif |