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 static SkPictureImageFilter* Create(const SkPicture* picture) { | 19 static SkPictureImageFilter* Create(const SkPicture* picture) { |
20 return SkNEW_ARGS(SkPictureImageFilter, (picture)); | 20 return new SkPictureImageFilter(picture); |
21 } | 21 } |
22 | 22 |
23 /** | 23 /** |
24 * Refs the passed-in picture. cropRect can be used to crop or expand the d
estination rect when | 24 * Refs the passed-in picture. cropRect can be used to crop or expand the d
estination rect when |
25 * 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.) |
26 */ | 26 */ |
27 static SkPictureImageFilter* Create(const SkPicture* picture, const SkRect&
cropRect) { | 27 static SkPictureImageFilter* Create(const SkPicture* picture, const SkRect&
cropRect) { |
28 return SkNEW_ARGS(SkPictureImageFilter, (picture, cropRect, | 28 return new SkPictureImageFilter(picture, cropRect, kDeviceSpace_PictureR
esolution, |
29 kDeviceSpace_PictureResolution, | 29 kLow_SkFilterQuality); |
30 kLow_SkFilterQuality)); | |
31 } | 30 } |
32 | 31 |
33 /** | 32 /** |
34 * Refs the passed-in picture. The picture is rasterized at a resolution th
at matches the | 33 * Refs the passed-in picture. The picture is rasterized at a resolution th
at matches the |
35 * local coordinate space. If the picture needs to be resampled for drawing
it into the | 34 * local coordinate space. If the picture needs to be resampled for drawing
it into the |
36 * destination canvas, bilinear filtering will be used. cropRect can be use
d to crop or | 35 * destination canvas, bilinear filtering will be used. cropRect can be use
d to crop or |
37 * expand the destination rect when the picture is drawn. (No scaling is im
plied by the | 36 * expand the destination rect when the picture is drawn. (No scaling is im
plied by the |
38 * dest rect; only the CTM is applied.) | 37 * dest rect; only the CTM is applied.) |
39 */ | 38 */ |
40 static SkPictureImageFilter* CreateForLocalSpace(const SkPicture* picture, | 39 static SkPictureImageFilter* CreateForLocalSpace(const SkPicture* picture, |
41 const SkRect& cropRect, | 40 const SkRect& cropRect, |
42 SkFilterQuality filterQuali
ty) { | 41 SkFilterQuality filterQuali
ty) { |
43 return SkNEW_ARGS(SkPictureImageFilter, (picture, cropRect, | 42 return new SkPictureImageFilter(picture, cropRect, kLocalSpace_PictureRe
solution, |
44 kLocalSpace_PictureResolution,
filterQuality)); | 43 filterQuality); |
45 } | 44 } |
46 SK_TO_STRING_OVERRIDE() | 45 SK_TO_STRING_OVERRIDE() |
47 SK_DECLARE_PUBLIC_FLATTENABLE_DESERIALIZATION_PROCS(SkPictureImageFilter) | 46 SK_DECLARE_PUBLIC_FLATTENABLE_DESERIALIZATION_PROCS(SkPictureImageFilter) |
48 | 47 |
49 protected: | 48 protected: |
50 enum PictureResolution { | 49 enum PictureResolution { |
51 kDeviceSpace_PictureResolution, | 50 kDeviceSpace_PictureResolution, |
52 kLocalSpace_PictureResolution | 51 kLocalSpace_PictureResolution |
53 }; | 52 }; |
54 | 53 |
(...skipping 20 matching lines...) Expand all Loading... |
75 const Context&) const; | 74 const Context&) const; |
76 | 75 |
77 const SkPicture* fPicture; | 76 const SkPicture* fPicture; |
78 SkRect fCropRect; | 77 SkRect fCropRect; |
79 PictureResolution fPictureResolution; | 78 PictureResolution fPictureResolution; |
80 SkFilterQuality fFilterQuality; | 79 SkFilterQuality fFilterQuality; |
81 typedef SkImageFilter INHERITED; | 80 typedef SkImageFilter INHERITED; |
82 }; | 81 }; |
83 | 82 |
84 #endif | 83 #endif |
OLD | NEW |