| 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 83 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 94 buffer.writeFlattenable(fColorFilter); | 94 buffer.writeFlattenable(fColorFilter); |
| 95 } | 95 } |
| 96 | 96 |
| 97 SkColorFilterImageFilter::~SkColorFilterImageFilter() { | 97 SkColorFilterImageFilter::~SkColorFilterImageFilter() { |
| 98 SkSafeUnref(fColorFilter); | 98 SkSafeUnref(fColorFilter); |
| 99 } | 99 } |
| 100 | 100 |
| 101 bool SkColorFilterImageFilter::onFilterImage(Proxy* proxy, const SkBitmap& sourc
e, | 101 bool SkColorFilterImageFilter::onFilterImage(Proxy* proxy, const SkBitmap& sourc
e, |
| 102 const SkMatrix& matrix, | 102 const SkMatrix& matrix, |
| 103 SkBitmap* result, | 103 SkBitmap* result, |
| 104 SkIPoint* offset) { | 104 SkIPoint* offset) const { |
| 105 SkBitmap src = source; | 105 SkBitmap src = source; |
| 106 SkIPoint srcOffset = SkIPoint::Make(0, 0); | 106 SkIPoint srcOffset = SkIPoint::Make(0, 0); |
| 107 if (getInput(0) && !getInput(0)->filterImage(proxy, source, matrix, &src, &s
rcOffset)) { | 107 if (getInput(0) && !getInput(0)->filterImage(proxy, source, matrix, &src, &s
rcOffset)) { |
| 108 return false; | 108 return false; |
| 109 } | 109 } |
| 110 | 110 |
| 111 SkIRect bounds; | 111 SkIRect bounds; |
| 112 src.getBounds(&bounds); | 112 src.getBounds(&bounds); |
| 113 bounds.offset(srcOffset); | 113 bounds.offset(srcOffset); |
| 114 if (!this->applyCropRect(&bounds, matrix)) { | 114 if (!this->applyCropRect(&bounds, matrix)) { |
| (...skipping 20 matching lines...) Expand all Loading... |
| 135 bool SkColorFilterImageFilter::asColorFilter(SkColorFilter** filter) const { | 135 bool SkColorFilterImageFilter::asColorFilter(SkColorFilter** filter) const { |
| 136 if (!cropRectIsSet()) { | 136 if (!cropRectIsSet()) { |
| 137 if (filter) { | 137 if (filter) { |
| 138 *filter = fColorFilter; | 138 *filter = fColorFilter; |
| 139 fColorFilter->ref(); | 139 fColorFilter->ref(); |
| 140 } | 140 } |
| 141 return true; | 141 return true; |
| 142 } | 142 } |
| 143 return false; | 143 return false; |
| 144 } | 144 } |
| OLD | NEW |