| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright 2013 Google Inc. | 2 * Copyright 2013 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 "SkTileImageFilter.h" | 8 #include "SkTileImageFilter.h" |
| 9 #include "SkBitmap.h" | 9 #include "SkBitmap.h" |
| 10 #include "SkCanvas.h" | 10 #include "SkCanvas.h" |
| 11 #include "SkDevice.h" | 11 #include "SkDevice.h" |
| 12 #include "SkFlattenableBuffers.h" | 12 #include "SkFlattenableBuffers.h" |
| 13 #include "SkMatrix.h" | 13 #include "SkMatrix.h" |
| 14 #include "SkPaint.h" | 14 #include "SkPaint.h" |
| 15 #include "SkShader.h" | 15 #include "SkShader.h" |
| 16 #include "SkValidationUtils.h" |
| 16 | 17 |
| 17 bool SkTileImageFilter::onFilterImage(Proxy* proxy, const SkBitmap& src, const S
kMatrix& ctm, | 18 bool SkTileImageFilter::onFilterImage(Proxy* proxy, const SkBitmap& src, const S
kMatrix& ctm, |
| 18 SkBitmap* dst, SkIPoint* offset) { | 19 SkBitmap* dst, SkIPoint* offset) { |
| 19 SkBitmap source = src; | 20 SkBitmap source = src; |
| 20 SkImageFilter* input = getInput(0); | 21 SkImageFilter* input = getInput(0); |
| 21 SkIPoint localOffset = SkIPoint::Make(0, 0); | 22 SkIPoint localOffset = SkIPoint::Make(0, 0); |
| 22 if (input && !input->filterImage(proxy, src, ctm, &source, &localOffset)) { | 23 if (input && !input->filterImage(proxy, src, ctm, &source, &localOffset)) { |
| 23 return false; | 24 return false; |
| 24 } | 25 } |
| 25 | 26 |
| (...skipping 23 matching lines...) Expand all Loading... |
| 49 SkRect dstRect = fDstRect; | 50 SkRect dstRect = fDstRect; |
| 50 dstRect.offset(SkIntToScalar(localOffset.fX), SkIntToScalar(localOffset.fY))
; | 51 dstRect.offset(SkIntToScalar(localOffset.fX), SkIntToScalar(localOffset.fY))
; |
| 51 canvas.drawRect(dstRect, paint); | 52 canvas.drawRect(dstRect, paint); |
| 52 *dst = device->accessBitmap(false); | 53 *dst = device->accessBitmap(false); |
| 53 return true; | 54 return true; |
| 54 } | 55 } |
| 55 | 56 |
| 56 SkTileImageFilter::SkTileImageFilter(SkFlattenableReadBuffer& buffer) : INHERITE
D(buffer) { | 57 SkTileImageFilter::SkTileImageFilter(SkFlattenableReadBuffer& buffer) : INHERITE
D(buffer) { |
| 57 buffer.readRect(&fSrcRect); | 58 buffer.readRect(&fSrcRect); |
| 58 buffer.readRect(&fDstRect); | 59 buffer.readRect(&fDstRect); |
| 60 buffer.validate(SkIsValidRect(fSrcRect) && SkIsValidRect(fDstRect)); |
| 59 } | 61 } |
| 60 | 62 |
| 61 void SkTileImageFilter::flatten(SkFlattenableWriteBuffer& buffer) const { | 63 void SkTileImageFilter::flatten(SkFlattenableWriteBuffer& buffer) const { |
| 62 this->INHERITED::flatten(buffer); | 64 this->INHERITED::flatten(buffer); |
| 63 buffer.writeRect(fSrcRect); | 65 buffer.writeRect(fSrcRect); |
| 64 buffer.writeRect(fDstRect); | 66 buffer.writeRect(fDstRect); |
| 65 } | 67 } |
| OLD | NEW |