| 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 46 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 57 return SkImageSource::Create(image, src, dst, filterQuality); | 57 return SkImageSource::Create(image, src, dst, filterQuality); |
| 58 } | 58 } |
| 59 | 59 |
| 60 void SkImageSource::flatten(SkWriteBuffer& buffer) const { | 60 void SkImageSource::flatten(SkWriteBuffer& buffer) const { |
| 61 buffer.writeInt(fFilterQuality); | 61 buffer.writeInt(fFilterQuality); |
| 62 buffer.writeRect(fSrcRect); | 62 buffer.writeRect(fSrcRect); |
| 63 buffer.writeRect(fDstRect); | 63 buffer.writeRect(fDstRect); |
| 64 buffer.writeImage(fImage); | 64 buffer.writeImage(fImage); |
| 65 } | 65 } |
| 66 | 66 |
| 67 bool SkImageSource::onFilterImage(Proxy* proxy, const SkBitmap& src, const Conte
xt& ctx, | 67 bool SkImageSource::onFilterImageDeprecated(Proxy* proxy, const SkBitmap& src, c
onst Context& ctx, |
| 68 SkBitmap* result, SkIPoint* offset) const { | 68 SkBitmap* result, SkIPoint* offset)
const { |
| 69 SkRect dstRect; | 69 SkRect dstRect; |
| 70 ctx.ctm().mapRect(&dstRect, fDstRect); | 70 ctx.ctm().mapRect(&dstRect, fDstRect); |
| 71 SkRect bounds = SkRect::MakeIWH(fImage->width(), fImage->height()); | 71 SkRect bounds = SkRect::MakeIWH(fImage->width(), fImage->height()); |
| 72 if (fSrcRect == bounds && dstRect == bounds) { | 72 if (fSrcRect == bounds && dstRect == bounds) { |
| 73 // No regions cropped out or resized; return entire image. | 73 // No regions cropped out or resized; return entire image. |
| 74 offset->fX = offset->fY = 0; | 74 offset->fX = offset->fY = 0; |
| 75 return fImage->asLegacyBitmap(result, SkImage::kRO_LegacyBitmapMode); | 75 return fImage->asLegacyBitmap(result, SkImage::kRO_LegacyBitmapMode); |
| 76 } | 76 } |
| 77 | 77 |
| 78 const SkIRect dstIRect = dstRect.roundOut(); | 78 const SkIRect dstIRect = dstRect.roundOut(); |
| (...skipping 30 matching lines...) Expand all 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 |