OLD | NEW |
---|---|
1 /* | 1 /* |
2 * Copyright 2013 The Android Open Source Project | 2 * Copyright 2013 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 #ifndef SkPictureImageFilter_DEFINED | 8 #ifndef SkPictureImageFilter_DEFINED |
9 #define SkPictureImageFilter_DEFINED | 9 #define SkPictureImageFilter_DEFINED |
10 | 10 |
11 #include "SkImageFilter.h" | 11 #include "SkImageFilter.h" |
12 #include "SkPicture.h" | 12 #include "SkPicture.h" |
13 | 13 |
14 class SK_API SkPictureImageFilter : public SkImageFilter { | 14 class SK_API SkPictureImageFilter : public SkImageFilter { |
15 public: | 15 public: |
16 /** | 16 /** |
17 * Refs the passed-in picture. | 17 * Refs the passed-in picture. |
18 */ | 18 */ |
19 explicit SkPictureImageFilter(SkPicture* picture); | 19 static SkPictureImageFilter* Create(SkPicture* picture) { |
20 return SkNEW_ARGS(SkPictureImageFilter, (picture)); | |
21 } | |
20 | 22 |
21 /** | 23 /** |
22 * Refs the passed-in picture. rect can be used to crop or expand the desti nation rect when | 24 * Refs the passed-in picture. rect can be used to crop or expand the desti nation rect when |
23 * the picture is drawn. (No scaling is implied by the dest rect; only the CTM is applied.) | 25 * the picture is drawn. (No scaling is implied by the dest rect; only the CTM is applied.) |
24 */ | 26 */ |
25 SkPictureImageFilter(SkPicture* picture, const SkRect& rect); | 27 static SkPictureImageFilter* Create(SkPicture* picture, const SkRect& rect) { |
reed1
2014/03/04 16:56:42
'rect' is a pretty unmeaningful parameter name. Do
Stephen White
2014/03/04 18:18:00
Yep, it's the bounds in world space (it gets trans
Dominik Grewe
2014/03/07 16:43:38
Changed it to cropRect.
| |
28 return SkNEW_ARGS(SkPictureImageFilter, (picture, rect)); | |
29 } | |
26 | 30 |
27 SK_DECLARE_PUBLIC_FLATTENABLE_DESERIALIZATION_PROCS(SkPictureImageFilter) | 31 SK_DECLARE_PUBLIC_FLATTENABLE_DESERIALIZATION_PROCS(SkPictureImageFilter) |
28 | 32 |
29 protected: | 33 protected: |
30 virtual ~SkPictureImageFilter(); | 34 virtual ~SkPictureImageFilter(); |
31 /* Constructs an SkPictureImageFilter object from an SkReadBuffer. | 35 /* Constructs an SkPictureImageFilter object from an SkReadBuffer. |
32 * Note: If the SkPictureImageFilter object construction requires bitmap | 36 * Note: If the SkPictureImageFilter object construction requires bitmap |
33 * decoding, the decoder must be set on the SkReadBuffer parameter by calli ng | 37 * decoding, the decoder must be set on the SkReadBuffer parameter by calli ng |
34 * SkReadBuffer::setBitmapDecoder() before calling this constructor. | 38 * SkReadBuffer::setBitmapDecoder() before calling this constructor. |
35 * @param SkReadBuffer Serialized picture data. | 39 * @param SkReadBuffer Serialized picture data. |
36 */ | 40 */ |
37 explicit SkPictureImageFilter(SkReadBuffer&); | 41 explicit SkPictureImageFilter(SkReadBuffer&); |
38 virtual void flatten(SkWriteBuffer&) const SK_OVERRIDE; | 42 virtual void flatten(SkWriteBuffer&) const SK_OVERRIDE; |
39 virtual bool onFilterImage(Proxy*, const SkBitmap& src, const SkMatrix&, | 43 virtual bool onFilterImage(Proxy*, const SkBitmap& src, const SkMatrix&, |
40 SkBitmap* result, SkIPoint* offset) const SK_OVER RIDE; | 44 SkBitmap* result, SkIPoint* offset) const SK_OVER RIDE; |
41 | 45 |
46 #ifdef SK_SUPPORT_LEGACY_PUBLICEFFECTCONSTRUCTORS | |
47 public: | |
48 #endif | |
49 explicit SkPictureImageFilter(SkPicture* picture); | |
50 SkPictureImageFilter(SkPicture* picture, const SkRect& rect); | |
51 | |
42 private: | 52 private: |
43 SkPicture* fPicture; | 53 SkPicture* fPicture; |
44 SkRect fRect; | 54 SkRect fRect; |
45 typedef SkImageFilter INHERITED; | 55 typedef SkImageFilter INHERITED; |
46 }; | 56 }; |
47 | 57 |
48 #endif | 58 #endif |
OLD | NEW |