| 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 | |
| 42 SkFlattenable* SkMatrixImageFilter::CreateProc(SkReadBuffer& buffer) { | 34 SkFlattenable* SkMatrixImageFilter::CreateProc(SkReadBuffer& buffer) { |
| 43 SK_IMAGEFILTER_UNFLATTEN_COMMON(common, 1); | 35 SK_IMAGEFILTER_UNFLATTEN_COMMON(common, 1); |
| 44 SkMatrix matrix; | 36 SkMatrix matrix; |
| 45 buffer.readMatrix(&matrix); | 37 buffer.readMatrix(&matrix); |
| 46 SkPaint::FilterLevel level = static_cast<SkPaint::FilterLevel>(buffer.readIn
t()); | 38 SkPaint::FilterLevel level = static_cast<SkPaint::FilterLevel>(buffer.readIn
t()); |
| 47 return Create(matrix, level, common.getInput(0), common.uniqueID()); | 39 return Create(matrix, level, common.getInput(0), common.uniqueID()); |
| 48 } | 40 } |
| 49 | 41 |
| 50 void SkMatrixImageFilter::flatten(SkWriteBuffer& buffer) const { | 42 void SkMatrixImageFilter::flatten(SkWriteBuffer& buffer) const { |
| 51 this->INHERITED::flatten(buffer); | 43 this->INHERITED::flatten(buffer); |
| (...skipping 76 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 128 SkRect floatBounds; | 120 SkRect floatBounds; |
| 129 matrix.mapRect(&floatBounds, SkRect::Make(src)); | 121 matrix.mapRect(&floatBounds, SkRect::Make(src)); |
| 130 SkIRect bounds = floatBounds.roundOut(); | 122 SkIRect bounds = floatBounds.roundOut(); |
| 131 if (getInput(0) && !getInput(0)->filterBounds(bounds, ctm, &bounds)) { | 123 if (getInput(0) && !getInput(0)->filterBounds(bounds, ctm, &bounds)) { |
| 132 return false; | 124 return false; |
| 133 } | 125 } |
| 134 | 126 |
| 135 *dst = bounds; | 127 *dst = bounds; |
| 136 return true; | 128 return true; |
| 137 } | 129 } |
| OLD | NEW |