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 10 matching lines...) Expand all Loading... |
21 } | 21 } |
22 | 22 |
23 SkBitmapSource::SkBitmapSource(const SkBitmap& bitmap, const SkRect& srcRect, co
nst SkRect& dstRect) | 23 SkBitmapSource::SkBitmapSource(const SkBitmap& bitmap, const SkRect& srcRect, co
nst SkRect& dstRect) |
24 : INHERITED(0, 0) | 24 : INHERITED(0, 0) |
25 , fBitmap(bitmap) | 25 , fBitmap(bitmap) |
26 , fSrcRect(srcRect) | 26 , fSrcRect(srcRect) |
27 , fDstRect(dstRect) {} | 27 , fDstRect(dstRect) {} |
28 | 28 |
29 SkBitmapSource::SkBitmapSource(SkReadBuffer& buffer) : INHERITED(0, buffer) { | 29 SkBitmapSource::SkBitmapSource(SkReadBuffer& buffer) : INHERITED(0, buffer) { |
30 if (buffer.isVersionLT(SkReadBuffer::kNoMoreBitmapFlatten_Version)) { | 30 if (buffer.isVersionLT(SkReadBuffer::kNoMoreBitmapFlatten_Version)) { |
31 fBitmap.unflatten(buffer); | 31 fBitmap.legacyUnflatten(buffer); |
32 } else { | 32 } else { |
33 buffer.readBitmap(&fBitmap); | 33 buffer.readBitmap(&fBitmap); |
34 } | 34 } |
35 buffer.readRect(&fSrcRect); | 35 buffer.readRect(&fSrcRect); |
36 buffer.readRect(&fDstRect); | 36 buffer.readRect(&fDstRect); |
37 buffer.validate(buffer.isValid() && SkIsValidRect(fSrcRect) && SkIsValidRect
(fDstRect)); | 37 buffer.validate(buffer.isValid() && SkIsValidRect(fSrcRect) && SkIsValidRect
(fDstRect)); |
38 } | 38 } |
39 | 39 |
40 void SkBitmapSource::flatten(SkWriteBuffer& buffer) const { | 40 void SkBitmapSource::flatten(SkWriteBuffer& buffer) const { |
41 this->INHERITED::flatten(buffer); | 41 this->INHERITED::flatten(buffer); |
(...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
84 | 84 |
85 void SkBitmapSource::computeFastBounds(const SkRect&, SkRect* dst) const { | 85 void SkBitmapSource::computeFastBounds(const SkRect&, SkRect* dst) const { |
86 *dst = fDstRect; | 86 *dst = fDstRect; |
87 } | 87 } |
88 | 88 |
89 bool SkBitmapSource::onFilterBounds(const SkIRect& src, const SkMatrix& ctm, | 89 bool SkBitmapSource::onFilterBounds(const SkIRect& src, const SkMatrix& ctm, |
90 SkIRect* dst) const { | 90 SkIRect* dst) const { |
91 *dst = src; | 91 *dst = src; |
92 return true; | 92 return true; |
93 } | 93 } |
OLD | NEW |