| 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 sk_sp<SkImageFilter> Make(sk_sp<SkPicture> picture) { | 19 static sk_sp<SkImageFilter> Make(sk_sp<SkPicture> picture); |
| 20 return sk_sp<SkImageFilter>(new SkPictureImageFilter(std::move(picture))
); | |
| 21 } | |
| 22 | 20 |
| 23 /** | 21 /** |
| 24 * Refs the passed-in picture. cropRect can be used to crop or expand the d
estination rect when | 22 * 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.) | 23 * the picture is drawn. (No scaling is implied by the dest rect; only the
CTM is applied.) |
| 26 */ | 24 */ |
| 27 static sk_sp<SkImageFilter> Make(sk_sp<SkPicture> picture, const SkRect& cro
pRect) { | 25 static sk_sp<SkImageFilter> Make(sk_sp<SkPicture> picture, const SkRect& cro
pRect); |
| 28 return sk_sp<SkImageFilter>(new SkPictureImageFilter(std::move(picture),
| |
| 29 cropRect, | |
| 30 kDeviceSpace_Pictur
eResolution, | |
| 31 kLow_SkFilterQualit
y)); | |
| 32 } | |
| 33 | 26 |
| 34 /** | 27 /** |
| 35 * Refs the passed-in picture. The picture is rasterized at a resolution th
at matches the | 28 * Refs the passed-in picture. The picture is rasterized at a resolution th
at matches the |
| 36 * local coordinate space. If the picture needs to be resampled for drawing
it into the | 29 * local coordinate space. If the picture needs to be resampled for drawing
it into the |
| 37 * destination canvas, bilinear filtering will be used. cropRect can be use
d to crop or | 30 * destination canvas, bilinear filtering will be used. cropRect can be use
d to crop or |
| 38 * expand the destination rect when the picture is drawn. (No scaling is im
plied by the | 31 * expand the destination rect when the picture is drawn. (No scaling is im
plied by the |
| 39 * dest rect; only the CTM is applied.) | 32 * dest rect; only the CTM is applied.) |
| 40 */ | 33 */ |
| 41 static sk_sp<SkImageFilter> MakeForLocalSpace(sk_sp<SkPicture> picture, | 34 static sk_sp<SkImageFilter> MakeForLocalSpace(sk_sp<SkPicture> picture, |
| 42 const SkRect& cropRect, | 35 const SkRect& cropRect, |
| 43 SkFilterQuality filterQuality)
{ | 36 SkFilterQuality filterQuality)
; |
| 44 return sk_sp<SkImageFilter>(new SkPictureImageFilter(std::move(picture), | |
| 45 cropRect, | |
| 46 kLocalSpace_Picture
Resolution, | |
| 47 filterQuality)); | |
| 48 } | |
| 49 | 37 |
| 50 #ifdef SK_SUPPORT_LEGACY_IMAGEFILTER_PTR | 38 #ifdef SK_SUPPORT_LEGACY_IMAGEFILTER_PTR |
| 51 static SkImageFilter* Create(const SkPicture* picture) { | 39 static SkImageFilter* Create(const SkPicture* picture) { |
| 52 return Make(sk_ref_sp(const_cast<SkPicture*>(picture))).release(); | 40 return Make(sk_ref_sp(const_cast<SkPicture*>(picture))).release(); |
| 53 } | 41 } |
| 54 static SkImageFilter* Create(const SkPicture* picture, const SkRect& cropRec
t) { | 42 static SkImageFilter* Create(const SkPicture* picture, const SkRect& cropRec
t) { |
| 55 return Make(sk_ref_sp(const_cast<SkPicture*>(picture)), cropRect).releas
e(); | 43 return Make(sk_ref_sp(const_cast<SkPicture*>(picture)), cropRect).releas
e(); |
| 56 } | 44 } |
| 57 static SkImageFilter* CreateForLocalSpace(const SkPicture* picture, | 45 static SkImageFilter* CreateForLocalSpace(const SkPicture* picture, |
| 58 const SkRect& cropRect, | 46 const SkRect& cropRect, |
| (...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 97 | 85 |
| 98 sk_sp<SkPicture> fPicture; | 86 sk_sp<SkPicture> fPicture; |
| 99 SkRect fCropRect; | 87 SkRect fCropRect; |
| 100 PictureResolution fPictureResolution; | 88 PictureResolution fPictureResolution; |
| 101 SkFilterQuality fFilterQuality; | 89 SkFilterQuality fFilterQuality; |
| 102 | 90 |
| 103 typedef SkImageFilter INHERITED; | 91 typedef SkImageFilter INHERITED; |
| 104 }; | 92 }; |
| 105 | 93 |
| 106 #endif | 94 #endif |
| OLD | NEW |