| 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 61 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 72 | 72 |
| 73 SkAutoTUnref<SkBaseDevice> device(proxy->createDevice(bounds.width(), bounds
.height())); | 73 SkAutoTUnref<SkBaseDevice> device(proxy->createDevice(bounds.width(), bounds
.height())); |
| 74 if (nullptr == device.get()) { | 74 if (nullptr == device.get()) { |
| 75 return false; | 75 return false; |
| 76 } | 76 } |
| 77 SkCanvas canvas(device.get()); | 77 SkCanvas canvas(device.get()); |
| 78 SkPaint paint; | 78 SkPaint paint; |
| 79 | 79 |
| 80 paint.setXfermodeMode(SkXfermode::kSrc_Mode); | 80 paint.setXfermodeMode(SkXfermode::kSrc_Mode); |
| 81 paint.setColorFilter(fColorFilter); | 81 paint.setColorFilter(fColorFilter); |
| 82 canvas.drawBitmap(src, SkIntToScalar(srcOffset.fX - bounds.fLeft), | 82 canvas.drawSprite(src, srcOffset.fX - bounds.fLeft, srcOffset.fY - bounds.fT
op, &paint); |
| 83 SkIntToScalar(srcOffset.fY - bounds.fTop), &paint); | |
| 84 | 83 |
| 85 *result = device.get()->accessBitmap(false); | 84 *result = device.get()->accessBitmap(false); |
| 86 offset->fX = bounds.fLeft; | 85 offset->fX = bounds.fLeft; |
| 87 offset->fY = bounds.fTop; | 86 offset->fY = bounds.fTop; |
| 88 return true; | 87 return true; |
| 89 } | 88 } |
| 90 | 89 |
| 91 bool SkColorFilterImageFilter::onIsColorFilterNode(SkColorFilter** filter) const
{ | 90 bool SkColorFilterImageFilter::onIsColorFilterNode(SkColorFilter** filter) const
{ |
| 92 SkASSERT(1 == this->countInputs()); | 91 SkASSERT(1 == this->countInputs()); |
| 93 if (!this->cropRectIsSet()) { | 92 if (!this->cropRectIsSet()) { |
| (...skipping 18 matching lines...) Expand all Loading... |
| 112 if (this->getInput(0)) { | 111 if (this->getInput(0)) { |
| 113 this->getInput(0)->toString(str); | 112 this->getInput(0)->toString(str); |
| 114 } | 113 } |
| 115 | 114 |
| 116 str->appendf(") color filter: "); | 115 str->appendf(") color filter: "); |
| 117 fColorFilter->toString(str); | 116 fColorFilter->toString(str); |
| 118 | 117 |
| 119 str->append(")"); | 118 str->append(")"); |
| 120 } | 119 } |
| 121 #endif | 120 #endif |
| OLD | NEW |