OLD | NEW |
1 /* | 1 /* |
2 * Copyright 2014 The Android Open Source Project | 2 * Copyright 2014 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 #include "SkMatrixImageFilter.h" | 8 #include "SkMatrixImageFilter.h" |
9 #include "SkBitmap.h" | 9 #include "SkBitmap.h" |
10 #include "SkCanvas.h" | 10 #include "SkCanvas.h" |
(...skipping 13 matching lines...) Expand all Loading... |
24 fFilterLevel(filterLevel) { | 24 fFilterLevel(filterLevel) { |
25 } | 25 } |
26 | 26 |
27 SkMatrixImageFilter* SkMatrixImageFilter::Create(const SkMatrix& transform, | 27 SkMatrixImageFilter* SkMatrixImageFilter::Create(const SkMatrix& transform, |
28 SkPaint::FilterLevel filterLeve
l, | 28 SkPaint::FilterLevel filterLeve
l, |
29 SkImageFilter* input, | 29 SkImageFilter* input, |
30 uint32_t uniqueID) { | 30 uint32_t uniqueID) { |
31 return SkNEW_ARGS(SkMatrixImageFilter, (transform, filterLevel, input, uniqu
eID)); | 31 return SkNEW_ARGS(SkMatrixImageFilter, (transform, filterLevel, input, uniqu
eID)); |
32 } | 32 } |
33 | 33 |
| 34 #ifdef SK_SUPPORT_LEGACY_DEEPFLATTENING |
| 35 SkMatrixImageFilter::SkMatrixImageFilter(SkReadBuffer& buffer) |
| 36 : INHERITED(1, buffer) { |
| 37 buffer.readMatrix(&fTransform); |
| 38 fFilterLevel = static_cast<SkPaint::FilterLevel>(buffer.readInt()); |
| 39 } |
| 40 #endif |
| 41 |
34 SkFlattenable* SkMatrixImageFilter::CreateProc(SkReadBuffer& buffer) { | 42 SkFlattenable* SkMatrixImageFilter::CreateProc(SkReadBuffer& buffer) { |
35 SK_IMAGEFILTER_UNFLATTEN_COMMON(common, 1); | 43 SK_IMAGEFILTER_UNFLATTEN_COMMON(common, 1); |
36 SkMatrix matrix; | 44 SkMatrix matrix; |
37 buffer.readMatrix(&matrix); | 45 buffer.readMatrix(&matrix); |
38 SkPaint::FilterLevel level = static_cast<SkPaint::FilterLevel>(buffer.readIn
t()); | 46 SkPaint::FilterLevel level = static_cast<SkPaint::FilterLevel>(buffer.readIn
t()); |
39 return Create(matrix, level, common.getInput(0), common.uniqueID()); | 47 return Create(matrix, level, common.getInput(0), common.uniqueID()); |
40 } | 48 } |
41 | 49 |
42 void SkMatrixImageFilter::flatten(SkWriteBuffer& buffer) const { | 50 void SkMatrixImageFilter::flatten(SkWriteBuffer& buffer) const { |
43 this->INHERITED::flatten(buffer); | 51 this->INHERITED::flatten(buffer); |
(...skipping 76 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
120 SkRect floatBounds; | 128 SkRect floatBounds; |
121 matrix.mapRect(&floatBounds, SkRect::Make(src)); | 129 matrix.mapRect(&floatBounds, SkRect::Make(src)); |
122 SkIRect bounds = floatBounds.roundOut(); | 130 SkIRect bounds = floatBounds.roundOut(); |
123 if (getInput(0) && !getInput(0)->filterBounds(bounds, ctm, &bounds)) { | 131 if (getInput(0) && !getInput(0)->filterBounds(bounds, ctm, &bounds)) { |
124 return false; | 132 return false; |
125 } | 133 } |
126 | 134 |
127 *dst = bounds; | 135 *dst = bounds; |
128 return true; | 136 return true; |
129 } | 137 } |
OLD | NEW |