| 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 "SkPictureImageFilter.h" | 8 #include "SkPictureImageFilter.h" |
| 9 #include "SkDevice.h" | 9 #include "SkDevice.h" |
| 10 #include "SkCanvas.h" | 10 #include "SkCanvas.h" |
| (...skipping 27 matching lines...) Expand all Loading... |
| 38 buffer.readRect(&fRect); | 38 buffer.readRect(&fRect); |
| 39 } | 39 } |
| 40 | 40 |
| 41 void SkPictureImageFilter::flatten(SkWriteBuffer& buffer) const { | 41 void SkPictureImageFilter::flatten(SkWriteBuffer& buffer) const { |
| 42 this->INHERITED::flatten(buffer); | 42 this->INHERITED::flatten(buffer); |
| 43 // FIXME: flatten picture here. | 43 // FIXME: flatten picture here. |
| 44 buffer.writeRect(fRect); | 44 buffer.writeRect(fRect); |
| 45 } | 45 } |
| 46 | 46 |
| 47 bool SkPictureImageFilter::onFilterImage(Proxy* proxy, const SkBitmap&, const Sk
Matrix& matrix, | 47 bool SkPictureImageFilter::onFilterImage(Proxy* proxy, const SkBitmap&, const Sk
Matrix& matrix, |
| 48 SkBitmap* result, SkIPoint* offset) { | 48 SkBitmap* result, SkIPoint* offset) const { |
| 49 if (!fPicture) { | 49 if (!fPicture) { |
| 50 offset->fX = offset->fY = 0; | 50 offset->fX = offset->fY = 0; |
| 51 return true; | 51 return true; |
| 52 } | 52 } |
| 53 | 53 |
| 54 SkRect floatBounds; | 54 SkRect floatBounds; |
| 55 SkIRect bounds; | 55 SkIRect bounds; |
| 56 matrix.mapRect(&floatBounds, fRect); | 56 matrix.mapRect(&floatBounds, fRect); |
| 57 floatBounds.roundOut(&bounds); | 57 floatBounds.roundOut(&bounds); |
| 58 | 58 |
| (...skipping 12 matching lines...) Expand all Loading... |
| 71 | 71 |
| 72 canvas.translate(-SkIntToScalar(bounds.fLeft), -SkIntToScalar(bounds.fTop)); | 72 canvas.translate(-SkIntToScalar(bounds.fLeft), -SkIntToScalar(bounds.fTop)); |
| 73 canvas.concat(matrix); | 73 canvas.concat(matrix); |
| 74 canvas.drawPicture(*fPicture); | 74 canvas.drawPicture(*fPicture); |
| 75 | 75 |
| 76 *result = device.get()->accessBitmap(false); | 76 *result = device.get()->accessBitmap(false); |
| 77 offset->fX = bounds.fLeft; | 77 offset->fX = bounds.fLeft; |
| 78 offset->fY = bounds.fTop; | 78 offset->fY = bounds.fTop; |
| 79 return true; | 79 return true; |
| 80 } | 80 } |
| OLD | NEW |