| 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" |
| (...skipping 88 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 99 paint.setShader(SkShader::MakeBitmapShader(subset, SkShader::kRepeat_TileMod
e, | 99 paint.setShader(SkShader::MakeBitmapShader(subset, SkShader::kRepeat_TileMod
e, |
| 100 SkShader::kRepeat_TileMode)); | 100 SkShader::kRepeat_TileMode)); |
| 101 canvas.translate(-dstRect.fLeft, -dstRect.fTop); | 101 canvas.translate(-dstRect.fLeft, -dstRect.fTop); |
| 102 canvas.drawRect(dstRect, paint); | 102 canvas.drawRect(dstRect, paint); |
| 103 *dst = device->accessBitmap(false); | 103 *dst = device->accessBitmap(false); |
| 104 offset->fX = dstIRect.fLeft; | 104 offset->fX = dstIRect.fLeft; |
| 105 offset->fY = dstIRect.fTop; | 105 offset->fY = dstIRect.fTop; |
| 106 return true; | 106 return true; |
| 107 } | 107 } |
| 108 | 108 |
| 109 void SkTileImageFilter::onFilterNodeBounds(const SkIRect& src, const SkMatrix& c
tm, | 109 SkIRect SkTileImageFilter::onFilterNodeBounds(const SkIRect& src, const SkMatrix
& ctm, |
| 110 SkIRect* dst, MapDirection direction)
const { | 110 MapDirection direction) const { |
| 111 SkRect rect = kReverse_MapDirection == direction ? fSrcRect : fDstRect; | 111 SkRect rect = kReverse_MapDirection == direction ? fSrcRect : fDstRect; |
| 112 ctm.mapRect(&rect); | 112 ctm.mapRect(&rect); |
| 113 rect.roundOut(dst); | 113 return rect.roundOut(); |
| 114 } | 114 } |
| 115 | 115 |
| 116 bool SkTileImageFilter::onFilterBounds(const SkIRect& src, const SkMatrix& ctm, | 116 SkIRect SkTileImageFilter::onFilterBounds(const SkIRect& src, const SkMatrix&, M
apDirection) const { |
| 117 SkIRect* dst, MapDirection direction) con
st { | |
| 118 // Don't recurse into inputs. | 117 // Don't recurse into inputs. |
| 119 *dst = src; | 118 return src; |
| 120 return true; | |
| 121 } | 119 } |
| 122 | 120 |
| 123 void SkTileImageFilter::computeFastBounds(const SkRect& src, SkRect* dst) const
{ | 121 SkRect SkTileImageFilter::computeFastBounds(const SkRect& src) const { |
| 124 *dst = fDstRect; | 122 return fDstRect; |
| 125 } | 123 } |
| 126 | 124 |
| 127 SkFlattenable* SkTileImageFilter::CreateProc(SkReadBuffer& buffer) { | 125 SkFlattenable* SkTileImageFilter::CreateProc(SkReadBuffer& buffer) { |
| 128 SK_IMAGEFILTER_UNFLATTEN_COMMON(common, 1); | 126 SK_IMAGEFILTER_UNFLATTEN_COMMON(common, 1); |
| 129 SkRect src, dst; | 127 SkRect src, dst; |
| 130 buffer.readRect(&src); | 128 buffer.readRect(&src); |
| 131 buffer.readRect(&dst); | 129 buffer.readRect(&dst); |
| 132 return Create(src, dst, common.getInput(0)); | 130 return Create(src, dst, common.getInput(0)); |
| 133 } | 131 } |
| 134 | 132 |
| (...skipping 11 matching lines...) Expand all Loading... |
| 146 str->appendf(" dst: %.2f %.2f %.2f %.2f", | 144 str->appendf(" dst: %.2f %.2f %.2f %.2f", |
| 147 fDstRect.fLeft, fDstRect.fTop, fDstRect.fRight, fDstRect.fBotto
m); | 145 fDstRect.fLeft, fDstRect.fTop, fDstRect.fRight, fDstRect.fBotto
m); |
| 148 if (this->getInput(0)) { | 146 if (this->getInput(0)) { |
| 149 str->appendf("input: ("); | 147 str->appendf("input: ("); |
| 150 this->getInput(0)->toString(str); | 148 this->getInput(0)->toString(str); |
| 151 str->appendf(")"); | 149 str->appendf(")"); |
| 152 } | 150 } |
| 153 str->append(")"); | 151 str->append(")"); |
| 154 } | 152 } |
| 155 #endif | 153 #endif |
| OLD | NEW |