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" |
(...skipping 13 matching lines...) Expand all Loading... |
24 | 24 |
25 sk_sp<SkFlattenable> SkPaintImageFilter::CreateProc(SkReadBuffer& buffer) { | 25 sk_sp<SkFlattenable> SkPaintImageFilter::CreateProc(SkReadBuffer& buffer) { |
26 SK_IMAGEFILTER_UNFLATTEN_COMMON(common, 0); | 26 SK_IMAGEFILTER_UNFLATTEN_COMMON(common, 0); |
27 SkPaint paint; | 27 SkPaint paint; |
28 buffer.readPaint(&paint); | 28 buffer.readPaint(&paint); |
29 return SkPaintImageFilter::Make(paint, &common.cropRect()); | 29 return SkPaintImageFilter::Make(paint, &common.cropRect()); |
30 } | 30 } |
31 | 31 |
32 void SkPaintImageFilter::flatten(SkWriteBuffer& buffer) const { | 32 void SkPaintImageFilter::flatten(SkWriteBuffer& buffer) const { |
33 this->INHERITED::flatten(buffer); | 33 this->INHERITED::flatten(buffer); |
34 buffer.writePaint(fPaint); | 34 buffer.writePaint("fPaint", fPaint); |
35 } | 35 } |
36 | 36 |
37 sk_sp<SkSpecialImage> SkPaintImageFilter::onFilterImage(SkSpecialImage* source, | 37 sk_sp<SkSpecialImage> SkPaintImageFilter::onFilterImage(SkSpecialImage* source, |
38 const Context& ctx, | 38 const Context& ctx, |
39 SkIPoint* offset) const
{ | 39 SkIPoint* offset) const
{ |
40 SkIRect bounds; | 40 SkIRect bounds; |
41 const SkIRect srcBounds = SkIRect::MakeWH(source->width(), source->height())
; | 41 const SkIRect srcBounds = SkIRect::MakeWH(source->width(), source->height())
; |
42 if (!this->applyCropRect(ctx, srcBounds, &bounds)) { | 42 if (!this->applyCropRect(ctx, srcBounds, &bounds)) { |
43 return nullptr; | 43 return nullptr; |
44 } | 44 } |
(...skipping 30 matching lines...) Expand all Loading... |
75 return true; | 75 return true; |
76 } | 76 } |
77 | 77 |
78 #ifndef SK_IGNORE_TO_STRING | 78 #ifndef SK_IGNORE_TO_STRING |
79 void SkPaintImageFilter::toString(SkString* str) const { | 79 void SkPaintImageFilter::toString(SkString* str) const { |
80 str->appendf("SkPaintImageFilter: ("); | 80 str->appendf("SkPaintImageFilter: ("); |
81 fPaint.toString(str); | 81 fPaint.toString(str); |
82 str->append(")"); | 82 str->append(")"); |
83 } | 83 } |
84 #endif | 84 #endif |
OLD | NEW |