| 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 "SkBitmapSource.h" | 8 #include "SkBitmapSource.h" |
| 9 #include "SkDevice.h" | 9 #include "SkDevice.h" |
| 10 #include "SkCanvas.h" | 10 #include "SkCanvas.h" |
| (...skipping 25 matching lines...) Expand all Loading... |
| 36 } | 36 } |
| 37 | 37 |
| 38 void SkBitmapSource::flatten(SkWriteBuffer& buffer) const { | 38 void SkBitmapSource::flatten(SkWriteBuffer& buffer) const { |
| 39 this->INHERITED::flatten(buffer); | 39 this->INHERITED::flatten(buffer); |
| 40 fBitmap.flatten(buffer); | 40 fBitmap.flatten(buffer); |
| 41 buffer.writeRect(fSrcRect); | 41 buffer.writeRect(fSrcRect); |
| 42 buffer.writeRect(fDstRect); | 42 buffer.writeRect(fDstRect); |
| 43 } | 43 } |
| 44 | 44 |
| 45 bool SkBitmapSource::onFilterImage(Proxy* proxy, const SkBitmap&, const SkMatrix
& matrix, | 45 bool SkBitmapSource::onFilterImage(Proxy* proxy, const SkBitmap&, const SkMatrix
& matrix, |
| 46 SkBitmap* result, SkIPoint* offset) { | 46 SkBitmap* result, SkIPoint* offset) const { |
| 47 SkRect bounds, dstRect; | 47 SkRect bounds, dstRect; |
| 48 fBitmap.getBounds(&bounds); | 48 fBitmap.getBounds(&bounds); |
| 49 matrix.mapRect(&dstRect, fDstRect); | 49 matrix.mapRect(&dstRect, fDstRect); |
| 50 if (fSrcRect == bounds && dstRect == bounds) { | 50 if (fSrcRect == bounds && dstRect == bounds) { |
| 51 // No regions cropped out or resized; return entire bitmap. | 51 // No regions cropped out or resized; return entire bitmap. |
| 52 *result = fBitmap; | 52 *result = fBitmap; |
| 53 offset->fX = offset->fY = 0; | 53 offset->fX = offset->fY = 0; |
| 54 return true; | 54 return true; |
| 55 } | 55 } |
| 56 SkIRect dstIRect; | 56 SkIRect dstIRect; |
| (...skipping 25 matching lines...) Expand all Loading... |
| 82 | 82 |
| 83 void SkBitmapSource::computeFastBounds(const SkRect&, SkRect* dst) const { | 83 void SkBitmapSource::computeFastBounds(const SkRect&, SkRect* dst) const { |
| 84 *dst = fDstRect; | 84 *dst = fDstRect; |
| 85 } | 85 } |
| 86 | 86 |
| 87 bool SkBitmapSource::onFilterBounds(const SkIRect& src, const SkMatrix& ctm, | 87 bool SkBitmapSource::onFilterBounds(const SkIRect& src, const SkMatrix& ctm, |
| 88 SkIRect* dst) const { | 88 SkIRect* dst) const { |
| 89 *dst = src; | 89 *dst = src; |
| 90 return true; | 90 return true; |
| 91 } | 91 } |
| OLD | NEW |