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" |
11 #include "SkDevice.h" | 11 #include "SkDevice.h" |
12 #include "SkImage.h" | 12 #include "SkImage.h" |
13 #include "SkReadBuffer.h" | 13 #include "SkReadBuffer.h" |
14 #include "SkWriteBuffer.h" | 14 #include "SkWriteBuffer.h" |
15 #include "SkString.h" | 15 #include "SkString.h" |
16 | 16 |
17 SkImageFilter* SkImageSource::Create(const SkImage* image) { | 17 SkImageFilter* SkImageSource::Create(const SkImage* image) { |
18 return image ? SkNEW_ARGS(SkImageSource, (image)) : nullptr; | 18 return image ? new SkImageSource(image) : nullptr; |
19 } | 19 } |
20 | 20 |
21 SkImageFilter* SkImageSource::Create(const SkImage* image, | 21 SkImageFilter* SkImageSource::Create(const SkImage* image, |
22 const SkRect& srcRect, | 22 const SkRect& srcRect, |
23 const SkRect& dstRect, | 23 const SkRect& dstRect, |
24 SkFilterQuality filterQuality) { | 24 SkFilterQuality filterQuality) { |
25 return image ? SkNEW_ARGS(SkImageSource, (image, srcRect, dstRect, filterQua
lity)) : nullptr; | 25 return image ? new SkImageSource(image, srcRect, dstRect, filterQuality) : n
ullptr; |
26 } | 26 } |
27 | 27 |
28 SkImageSource::SkImageSource(const SkImage* image) | 28 SkImageSource::SkImageSource(const SkImage* image) |
29 : INHERITED(0, nullptr) | 29 : INHERITED(0, nullptr) |
30 , fImage(SkRef(image)) | 30 , fImage(SkRef(image)) |
31 , fSrcRect(SkRect::MakeIWH(image->width(), image->height())) | 31 , fSrcRect(SkRect::MakeIWH(image->width(), image->height())) |
32 , fDstRect(fSrcRect) | 32 , fDstRect(fSrcRect) |
33 , fFilterQuality(kHigh_SkFilterQuality) { } | 33 , fFilterQuality(kHigh_SkFilterQuality) { } |
34 | 34 |
35 SkImageSource::SkImageSource(const SkImage* image, | 35 SkImageSource::SkImageSource(const SkImage* image, |
(...skipping 73 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
109 void SkImageSource::toString(SkString* str) const { | 109 void SkImageSource::toString(SkString* str) const { |
110 str->appendf("SkImageSource: ("); | 110 str->appendf("SkImageSource: ("); |
111 str->appendf("src: (%f,%f,%f,%f) dst: (%f,%f,%f,%f) ", | 111 str->appendf("src: (%f,%f,%f,%f) dst: (%f,%f,%f,%f) ", |
112 fSrcRect.fLeft, fSrcRect.fTop, fSrcRect.fRight, fSrcRect.fBotto
m, | 112 fSrcRect.fLeft, fSrcRect.fTop, fSrcRect.fRight, fSrcRect.fBotto
m, |
113 fDstRect.fLeft, fDstRect.fTop, fDstRect.fRight, fDstRect.fBotto
m); | 113 fDstRect.fLeft, fDstRect.fTop, fDstRect.fRight, fDstRect.fBotto
m); |
114 str->appendf("image: (%d,%d)", | 114 str->appendf("image: (%d,%d)", |
115 fImage->width(), fImage->height()); | 115 fImage->width(), fImage->height()); |
116 str->append(")"); | 116 str->append(")"); |
117 } | 117 } |
118 #endif | 118 #endif |
OLD | NEW |