OLD | NEW |
1 /* | 1 /* |
2 * Copyright 2015 Google Inc. | 2 * Copyright 2015 Google Inc. |
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 "SkImageSource.h" | 8 #include "SkImageSource.h" |
9 | 9 |
10 #include "SkCanvas.h" | 10 #include "SkCanvas.h" |
(...skipping 17 matching lines...) Expand all Loading... |
28 const SkRect& srcRect, | 28 const SkRect& srcRect, |
29 const SkRect& dstRect, | 29 const SkRect& dstRect, |
30 SkFilterQuality filterQuality) | 30 SkFilterQuality filterQuality) |
31 : INHERITED(0, nullptr) | 31 : INHERITED(0, nullptr) |
32 , fImage(std::move(image)) | 32 , fImage(std::move(image)) |
33 , fSrcRect(srcRect) | 33 , fSrcRect(srcRect) |
34 , fDstRect(dstRect) | 34 , fDstRect(dstRect) |
35 , fFilterQuality(filterQuality) { | 35 , fFilterQuality(filterQuality) { |
36 } | 36 } |
37 | 37 |
38 SkFlattenable* SkImageSource::CreateProc(SkReadBuffer& buffer) { | 38 sk_sp<SkFlattenable> SkImageSource::CreateProc(SkReadBuffer& buffer) { |
39 SkFilterQuality filterQuality = (SkFilterQuality)buffer.readInt(); | 39 SkFilterQuality filterQuality = (SkFilterQuality)buffer.readInt(); |
40 | 40 |
41 SkRect src, dst; | 41 SkRect src, dst; |
42 buffer.readRect(&src); | 42 buffer.readRect(&src); |
43 buffer.readRect(&dst); | 43 buffer.readRect(&dst); |
44 | 44 |
45 sk_sp<SkImage> image(buffer.readImage()); | 45 sk_sp<SkImage> image(buffer.readImage()); |
46 if (!image) { | 46 if (!image) { |
47 return nullptr; | 47 return nullptr; |
48 } | 48 } |
49 | 49 |
50 return SkImageSource::Make(std::move(image), src, dst, filterQuality).releas
e(); | 50 return SkImageSource::Make(std::move(image), src, dst, filterQuality); |
51 } | 51 } |
52 | 52 |
53 void SkImageSource::flatten(SkWriteBuffer& buffer) const { | 53 void SkImageSource::flatten(SkWriteBuffer& buffer) const { |
54 buffer.writeInt(fFilterQuality); | 54 buffer.writeInt(fFilterQuality); |
55 buffer.writeRect(fSrcRect); | 55 buffer.writeRect(fSrcRect); |
56 buffer.writeRect(fDstRect); | 56 buffer.writeRect(fDstRect); |
57 buffer.writeImage(fImage.get()); | 57 buffer.writeImage(fImage.get()); |
58 } | 58 } |
59 | 59 |
60 sk_sp<SkSpecialImage> SkImageSource::onFilterImage(SkSpecialImage* source, const
Context& ctx, | 60 sk_sp<SkSpecialImage> SkImageSource::onFilterImage(SkSpecialImage* source, const
Context& ctx, |
(...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
113 void SkImageSource::toString(SkString* str) const { | 113 void SkImageSource::toString(SkString* str) const { |
114 str->appendf("SkImageSource: ("); | 114 str->appendf("SkImageSource: ("); |
115 str->appendf("src: (%f,%f,%f,%f) dst: (%f,%f,%f,%f) ", | 115 str->appendf("src: (%f,%f,%f,%f) dst: (%f,%f,%f,%f) ", |
116 fSrcRect.fLeft, fSrcRect.fTop, fSrcRect.fRight, fSrcRect.fBotto
m, | 116 fSrcRect.fLeft, fSrcRect.fTop, fSrcRect.fRight, fSrcRect.fBotto
m, |
117 fDstRect.fLeft, fDstRect.fTop, fDstRect.fRight, fDstRect.fBotto
m); | 117 fDstRect.fLeft, fDstRect.fTop, fDstRect.fRight, fDstRect.fBotto
m); |
118 str->appendf("image: (%d,%d)", | 118 str->appendf("image: (%d,%d)", |
119 fImage->width(), fImage->height()); | 119 fImage->width(), fImage->height()); |
120 str->append(")"); | 120 str->append(")"); |
121 } | 121 } |
122 #endif | 122 #endif |
OLD | NEW |