senorblanco@chromium.org | 5333300 | 2013-12-12 23:28:52 +0000 | [diff] [blame] | 1 | /* |
| 2 | * Copyright 2013 The Android Open Source Project |
| 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 SkPictureImageFilter_DEFINED |
| 9 | #define SkPictureImageFilter_DEFINED |
| 10 | |
| 11 | #include "SkImageFilter.h" |
| 12 | #include "SkPicture.h" |
| 13 | |
| 14 | class SK_API SkPictureImageFilter : public SkImageFilter { |
| 15 | public: |
| 16 | /** |
| 17 | * Refs the passed-in picture. |
| 18 | */ |
| 19 | explicit SkPictureImageFilter(SkPicture* picture); |
| 20 | |
| 21 | /** |
| 22 | * Refs the passed-in picture. rect can be used to crop or expand the destination rect when |
| 23 | * the picture is drawn. (No scaling is implied by the dest rect; only the CTM is applied.) |
| 24 | */ |
| 25 | SkPictureImageFilter(SkPicture* picture, const SkRect& rect); |
| 26 | |
| 27 | SK_DECLARE_PUBLIC_FLATTENABLE_DESERIALIZATION_PROCS(SkPictureImageFilter) |
| 28 | |
| 29 | protected: |
| 30 | virtual ~SkPictureImageFilter(); |
commit-bot@chromium.org | 5e0995e | 2014-02-07 12:20:04 +0000 | [diff] [blame^] | 31 | /* Constructs an SkPictureImageFilter object from an SkReadBuffer. |
| 32 | * Note: If the SkPictureImageFilter object construction requires bitmap |
| 33 | * decoding, the decoder must be set on the SkReadBuffer parameter by calling |
| 34 | * SkReadBuffer::setBitmapDecoder() before calling this constructor. |
| 35 | * @param SkReadBuffer Serialized picture data. |
| 36 | */ |
| 37 | explicit SkPictureImageFilter(SkReadBuffer&); |
commit-bot@chromium.org | 8b0e8ac | 2014-01-30 18:58:24 +0000 | [diff] [blame] | 38 | virtual void flatten(SkWriteBuffer&) const SK_OVERRIDE; |
senorblanco@chromium.org | 5333300 | 2013-12-12 23:28:52 +0000 | [diff] [blame] | 39 | virtual bool onFilterImage(Proxy*, const SkBitmap& src, const SkMatrix&, |
commit-bot@chromium.org | ae761f7 | 2014-02-05 22:32:02 +0000 | [diff] [blame] | 40 | SkBitmap* result, SkIPoint* offset) const SK_OVERRIDE; |
senorblanco@chromium.org | 5333300 | 2013-12-12 23:28:52 +0000 | [diff] [blame] | 41 | |
| 42 | private: |
| 43 | SkPicture* fPicture; |
| 44 | SkRect fRect; |
| 45 | typedef SkImageFilter INHERITED; |
| 46 | }; |
| 47 | |
| 48 | #endif |