| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright 2012 The Android Open Source Project | 2 * Copyright 2012 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 "SkColorFilterImageFilter.h" | 8 #include "SkColorFilterImageFilter.h" |
| 9 #include "SkBitmap.h" | 9 #include "SkBitmap.h" |
| 10 #include "SkCanvas.h" | 10 #include "SkCanvas.h" |
| (...skipping 65 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 76 return SkNEW_ARGS(SkColorFilterImageFilter, (cf, input, cropRect)); | 76 return SkNEW_ARGS(SkColorFilterImageFilter, (cf, input, cropRect)); |
| 77 } | 77 } |
| 78 | 78 |
| 79 SkColorFilterImageFilter::SkColorFilterImageFilter(SkColorFilter* cf, | 79 SkColorFilterImageFilter::SkColorFilterImageFilter(SkColorFilter* cf, |
| 80 SkImageFilter* input, const CropRect* cropRect) | 80 SkImageFilter* input, const CropRect* cropRect) |
| 81 : INHERITED(1, &input, cropRect), fColorFilter(cf) { | 81 : INHERITED(1, &input, cropRect), fColorFilter(cf) { |
| 82 SkASSERT(cf); | 82 SkASSERT(cf); |
| 83 SkSafeRef(cf); | 83 SkSafeRef(cf); |
| 84 } | 84 } |
| 85 | 85 |
| 86 #ifdef SK_SUPPORT_LEGACY_DEEPFLATTENING |
| 86 SkColorFilterImageFilter::SkColorFilterImageFilter(SkReadBuffer& buffer) | 87 SkColorFilterImageFilter::SkColorFilterImageFilter(SkReadBuffer& buffer) |
| 87 : INHERITED(1, buffer) { | 88 : INHERITED(1, buffer) { |
| 88 fColorFilter = buffer.readColorFilter(); | 89 fColorFilter = buffer.readColorFilter(); |
| 89 } | 90 } |
| 91 #endif |
| 92 |
| 93 SkFlattenable* SkColorFilterImageFilter::CreateProc(SkReadBuffer& buffer) { |
| 94 SK_IMAGEFILTER_UNFLATTEN_COMMON(common, 1); |
| 95 return Create(buffer.readColorFilter(), common.getInput(0), &common.cropRect
()); |
| 96 } |
| 90 | 97 |
| 91 void SkColorFilterImageFilter::flatten(SkWriteBuffer& buffer) const { | 98 void SkColorFilterImageFilter::flatten(SkWriteBuffer& buffer) const { |
| 92 this->INHERITED::flatten(buffer); | 99 this->INHERITED::flatten(buffer); |
| 93 | |
| 94 buffer.writeFlattenable(fColorFilter); | 100 buffer.writeFlattenable(fColorFilter); |
| 95 } | 101 } |
| 96 | 102 |
| 97 SkColorFilterImageFilter::~SkColorFilterImageFilter() { | 103 SkColorFilterImageFilter::~SkColorFilterImageFilter() { |
| 98 SkSafeUnref(fColorFilter); | 104 SkSafeUnref(fColorFilter); |
| 99 } | 105 } |
| 100 | 106 |
| 101 bool SkColorFilterImageFilter::onFilterImage(Proxy* proxy, const SkBitmap& sourc
e, | 107 bool SkColorFilterImageFilter::onFilterImage(Proxy* proxy, const SkBitmap& sourc
e, |
| 102 const Context& ctx, | 108 const Context& ctx, |
| 103 SkBitmap* result, | 109 SkBitmap* result, |
| (...skipping 29 matching lines...) Expand all Loading... |
| 133 bool SkColorFilterImageFilter::asColorFilter(SkColorFilter** filter) const { | 139 bool SkColorFilterImageFilter::asColorFilter(SkColorFilter** filter) const { |
| 134 if (!cropRectIsSet()) { | 140 if (!cropRectIsSet()) { |
| 135 if (filter) { | 141 if (filter) { |
| 136 *filter = fColorFilter; | 142 *filter = fColorFilter; |
| 137 fColorFilter->ref(); | 143 fColorFilter->ref(); |
| 138 } | 144 } |
| 139 return true; | 145 return true; |
| 140 } | 146 } |
| 141 return false; | 147 return false; |
| 142 } | 148 } |
| OLD | NEW |