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 "SkReadBuffer.h" |
| 13 #include "SkWriteBuffer.h" |
13 #include "SkMatrix.h" | 14 #include "SkMatrix.h" |
14 #include "SkPaint.h" | 15 #include "SkPaint.h" |
15 #include "SkShader.h" | 16 #include "SkShader.h" |
16 #include "SkValidationUtils.h" | 17 #include "SkValidationUtils.h" |
17 | 18 |
18 bool SkTileImageFilter::onFilterImage(Proxy* proxy, const SkBitmap& src, const S
kMatrix& ctm, | 19 bool SkTileImageFilter::onFilterImage(Proxy* proxy, const SkBitmap& src, const S
kMatrix& ctm, |
19 SkBitmap* dst, SkIPoint* offset) { | 20 SkBitmap* dst, SkIPoint* offset) { |
20 SkBitmap source = src; | 21 SkBitmap source = src; |
21 SkImageFilter* input = getInput(0); | 22 SkImageFilter* input = getInput(0); |
22 SkIPoint srcOffset = SkIPoint::Make(0, 0); | 23 SkIPoint srcOffset = SkIPoint::Make(0, 0); |
(...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
66 shader->setLocalMatrix(shaderMatrix); | 67 shader->setLocalMatrix(shaderMatrix); |
67 paint.setShader(shader); | 68 paint.setShader(shader); |
68 canvas.translate(-dstRect.fLeft, -dstRect.fTop); | 69 canvas.translate(-dstRect.fLeft, -dstRect.fTop); |
69 canvas.drawRect(dstRect, paint); | 70 canvas.drawRect(dstRect, paint); |
70 *dst = device->accessBitmap(false); | 71 *dst = device->accessBitmap(false); |
71 offset->fX = dstIRect.fLeft; | 72 offset->fX = dstIRect.fLeft; |
72 offset->fY = dstIRect.fTop; | 73 offset->fY = dstIRect.fTop; |
73 return true; | 74 return true; |
74 } | 75 } |
75 | 76 |
76 SkTileImageFilter::SkTileImageFilter(SkFlattenableReadBuffer& buffer) | 77 SkTileImageFilter::SkTileImageFilter(SkReadBuffer& buffer) |
77 : INHERITED(1, buffer) { | 78 : INHERITED(1, buffer) { |
78 buffer.readRect(&fSrcRect); | 79 buffer.readRect(&fSrcRect); |
79 buffer.readRect(&fDstRect); | 80 buffer.readRect(&fDstRect); |
80 buffer.validate(buffer.isValid() && SkIsValidRect(fSrcRect) && SkIsValidRect
(fDstRect)); | 81 buffer.validate(buffer.isValid() && SkIsValidRect(fSrcRect) && SkIsValidRect
(fDstRect)); |
81 } | 82 } |
82 | 83 |
83 void SkTileImageFilter::flatten(SkFlattenableWriteBuffer& buffer) const { | 84 void SkTileImageFilter::flatten(SkWriteBuffer& buffer) const { |
84 this->INHERITED::flatten(buffer); | 85 this->INHERITED::flatten(buffer); |
85 buffer.writeRect(fSrcRect); | 86 buffer.writeRect(fSrcRect); |
86 buffer.writeRect(fDstRect); | 87 buffer.writeRect(fDstRect); |
87 } | 88 } |
OLD | NEW |