| 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.drawSprite(src, srcOffset.fX - bounds.fLeft, srcOffset.fY - bounds.fT
op, &paint); | 82 canvas.drawBitmap(src, SkIntToScalar(srcOffset.fX - bounds.fLeft), |
| 83 SkIntToScalar(srcOffset.fY - bounds.fTop), &paint); |
| 83 | 84 |
| 84 *result = device.get()->accessBitmap(false); | 85 *result = device.get()->accessBitmap(false); |
| 85 offset->fX = bounds.fLeft; | 86 offset->fX = bounds.fLeft; |
| 86 offset->fY = bounds.fTop; | 87 offset->fY = bounds.fTop; |
| 87 return true; | 88 return true; |
| 88 } | 89 } |
| 89 | 90 |
| 90 bool SkColorFilterImageFilter::onIsColorFilterNode(SkColorFilter** filter) const
{ | 91 bool SkColorFilterImageFilter::onIsColorFilterNode(SkColorFilter** filter) const
{ |
| 91 SkASSERT(1 == this->countInputs()); | 92 SkASSERT(1 == this->countInputs()); |
| 92 if (!this->cropRectIsSet()) { | 93 if (!this->cropRectIsSet()) { |
| (...skipping 18 matching lines...) Expand all Loading... |
| 111 if (this->getInput(0)) { | 112 if (this->getInput(0)) { |
| 112 this->getInput(0)->toString(str); | 113 this->getInput(0)->toString(str); |
| 113 } | 114 } |
| 114 | 115 |
| 115 str->appendf(") color filter: "); | 116 str->appendf(") color filter: "); |
| 116 fColorFilter->toString(str); | 117 fColorFilter->toString(str); |
| 117 | 118 |
| 118 str->append(")"); | 119 str->append(")"); |
| 119 } | 120 } |
| 120 #endif | 121 #endif |
| OLD | NEW |