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 95 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
106 fSrcRect.width() == dstRect.width() && fSrcRect.height() == dstRect.heig
ht() ? | 106 fSrcRect.width() == dstRect.width() && fSrcRect.height() == dstRect.heig
ht() ? |
107 kNone_SkFilterQuality : fFilterQuality); | 107 kNone_SkFilterQuality : fFilterQuality); |
108 canvas->drawImageRect(fImage.get(), fSrcRect, dstRect, &paint, | 108 canvas->drawImageRect(fImage.get(), fSrcRect, dstRect, &paint, |
109 SkCanvas::kStrict_SrcRectConstraint); | 109 SkCanvas::kStrict_SrcRectConstraint); |
110 | 110 |
111 offset->fX = dstIRect.fLeft; | 111 offset->fX = dstIRect.fLeft; |
112 offset->fY = dstIRect.fTop; | 112 offset->fY = dstIRect.fTop; |
113 return surf->makeImageSnapshot().release(); | 113 return surf->makeImageSnapshot().release(); |
114 } | 114 } |
115 | 115 |
116 void SkImageSource::computeFastBounds(const SkRect& src, SkRect* dst) const { | 116 SkRect SkImageSource::computeFastBounds(const SkRect& src) const { |
117 *dst = fDstRect; | 117 return fDstRect; |
118 } | 118 } |
119 | 119 |
120 #ifndef SK_IGNORE_TO_STRING | 120 #ifndef SK_IGNORE_TO_STRING |
121 void SkImageSource::toString(SkString* str) const { | 121 void SkImageSource::toString(SkString* str) const { |
122 str->appendf("SkImageSource: ("); | 122 str->appendf("SkImageSource: ("); |
123 str->appendf("src: (%f,%f,%f,%f) dst: (%f,%f,%f,%f) ", | 123 str->appendf("src: (%f,%f,%f,%f) dst: (%f,%f,%f,%f) ", |
124 fSrcRect.fLeft, fSrcRect.fTop, fSrcRect.fRight, fSrcRect.fBotto
m, | 124 fSrcRect.fLeft, fSrcRect.fTop, fSrcRect.fRight, fSrcRect.fBotto
m, |
125 fDstRect.fLeft, fDstRect.fTop, fDstRect.fRight, fDstRect.fBotto
m); | 125 fDstRect.fLeft, fDstRect.fTop, fDstRect.fRight, fDstRect.fBotto
m); |
126 str->appendf("image: (%d,%d)", | 126 str->appendf("image: (%d,%d)", |
127 fImage->width(), fImage->height()); | 127 fImage->width(), fImage->height()); |
128 str->append(")"); | 128 str->append(")"); |
129 } | 129 } |
130 #endif | 130 #endif |
OLD | NEW |