| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright 2013 The Android Open Source Project | 2 * Copyright 2013 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 "SkResizeImageFilter.h" | 8 #include "SkResizeImageFilter.h" |
| 9 #include "SkBitmap.h" | 9 #include "SkBitmap.h" |
| 10 #include "SkCanvas.h" | 10 #include "SkCanvas.h" |
| (...skipping 26 matching lines...) Expand all Loading... |
| 37 buffer.writeInt(fFilterLevel); | 37 buffer.writeInt(fFilterLevel); |
| 38 } | 38 } |
| 39 | 39 |
| 40 SkResizeImageFilter::~SkResizeImageFilter() { | 40 SkResizeImageFilter::~SkResizeImageFilter() { |
| 41 } | 41 } |
| 42 | 42 |
| 43 bool SkResizeImageFilter::onFilterImage(Proxy* proxy, | 43 bool SkResizeImageFilter::onFilterImage(Proxy* proxy, |
| 44 const SkBitmap& source, | 44 const SkBitmap& source, |
| 45 const SkMatrix& matrix, | 45 const SkMatrix& matrix, |
| 46 SkBitmap* result, | 46 SkBitmap* result, |
| 47 SkIPoint* offset) { | 47 SkIPoint* offset) const { |
| 48 SkBitmap src = source; | 48 SkBitmap src = source; |
| 49 SkIPoint srcOffset = SkIPoint::Make(0, 0); | 49 SkIPoint srcOffset = SkIPoint::Make(0, 0); |
| 50 if (getInput(0) && !getInput(0)->filterImage(proxy, source, matrix, &src, &s
rcOffset)) { | 50 if (getInput(0) && !getInput(0)->filterImage(proxy, source, matrix, &src, &s
rcOffset)) { |
| 51 return false; | 51 return false; |
| 52 } | 52 } |
| 53 | 53 |
| 54 SkRect dstRect; | 54 SkRect dstRect; |
| 55 SkIRect srcBounds, dstBounds; | 55 SkIRect srcBounds, dstBounds; |
| 56 src.getBounds(&srcBounds); | 56 src.getBounds(&srcBounds); |
| 57 srcBounds.offset(srcOffset); | 57 srcBounds.offset(srcOffset); |
| (...skipping 15 matching lines...) Expand all Loading... |
| 73 paint.setXfermodeMode(SkXfermode::kSrc_Mode); | 73 paint.setXfermodeMode(SkXfermode::kSrc_Mode); |
| 74 paint.setFilterLevel(fFilterLevel); | 74 paint.setFilterLevel(fFilterLevel); |
| 75 canvas.concat(dstMatrix); | 75 canvas.concat(dstMatrix); |
| 76 canvas.drawBitmap(src, srcRect.left(), srcRect.top(), &paint); | 76 canvas.drawBitmap(src, srcRect.left(), srcRect.top(), &paint); |
| 77 | 77 |
| 78 *result = device.get()->accessBitmap(false); | 78 *result = device.get()->accessBitmap(false); |
| 79 offset->fX = dstBounds.fLeft; | 79 offset->fX = dstBounds.fLeft; |
| 80 offset->fY = dstBounds.fTop; | 80 offset->fY = dstBounds.fTop; |
| 81 return true; | 81 return true; |
| 82 } | 82 } |
| OLD | NEW |