OLD | NEW |
1 /* | 1 /* |
2 * Copyright 2016 Google Inc. | 2 * Copyright 2016 Google Inc. |
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 #include "SkPaintImageFilter.h" | 8 #include "SkPaintImageFilter.h" |
9 #include "SkCanvas.h" | 9 #include "SkCanvas.h" |
10 #include "SkReadBuffer.h" | 10 #include "SkReadBuffer.h" |
11 #include "SkSpecialImage.h" | 11 #include "SkSpecialImage.h" |
12 #include "SkSpecialSurface.h" | 12 #include "SkSpecialSurface.h" |
13 #include "SkWriteBuffer.h" | 13 #include "SkWriteBuffer.h" |
14 | 14 |
| 15 sk_sp<SkImageFilter> SkPaintImageFilter::Make(const SkPaint& paint, |
| 16 const CropRect* cropRect) { |
| 17 return sk_sp<SkImageFilter>(new SkPaintImageFilter(paint, cropRect)); |
| 18 } |
| 19 |
15 SkPaintImageFilter::SkPaintImageFilter(const SkPaint& paint, const CropRect* cro
pRect) | 20 SkPaintImageFilter::SkPaintImageFilter(const SkPaint& paint, const CropRect* cro
pRect) |
16 : INHERITED(nullptr, 0, cropRect) | 21 : INHERITED(nullptr, 0, cropRect) |
17 , fPaint(paint) { | 22 , fPaint(paint) { |
18 } | 23 } |
19 | 24 |
20 sk_sp<SkFlattenable> SkPaintImageFilter::CreateProc(SkReadBuffer& buffer) { | 25 sk_sp<SkFlattenable> SkPaintImageFilter::CreateProc(SkReadBuffer& buffer) { |
21 SK_IMAGEFILTER_UNFLATTEN_COMMON(common, 0); | 26 SK_IMAGEFILTER_UNFLATTEN_COMMON(common, 0); |
22 SkPaint paint; | 27 SkPaint paint; |
23 buffer.readPaint(&paint); | 28 buffer.readPaint(&paint); |
24 return SkPaintImageFilter::Make(paint, &common.cropRect()); | 29 return SkPaintImageFilter::Make(paint, &common.cropRect()); |
(...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
70 return true; | 75 return true; |
71 } | 76 } |
72 | 77 |
73 #ifndef SK_IGNORE_TO_STRING | 78 #ifndef SK_IGNORE_TO_STRING |
74 void SkPaintImageFilter::toString(SkString* str) const { | 79 void SkPaintImageFilter::toString(SkString* str) const { |
75 str->appendf("SkPaintImageFilter: ("); | 80 str->appendf("SkPaintImageFilter: ("); |
76 fPaint.toString(str); | 81 fPaint.toString(str); |
77 str->append(")"); | 82 str->append(")"); |
78 } | 83 } |
79 #endif | 84 #endif |
OLD | NEW |