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 95 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
106 offset->fX = dstIRect.fLeft; | 106 offset->fX = dstIRect.fLeft; |
107 offset->fY = dstIRect.fTop; | 107 offset->fY = dstIRect.fTop; |
108 return true; | 108 return true; |
109 } | 109 } |
110 | 110 |
111 void SkTileImageFilter::onFilterNodeBounds(const SkIRect& src, const SkMatrix& c
tm, | 111 void SkTileImageFilter::onFilterNodeBounds(const SkIRect& src, const SkMatrix& c
tm, |
112 SkIRect* dst, MapDirection direction)
const { | 112 SkIRect* dst, MapDirection direction)
const { |
113 SkRect rect = kReverse_MapDirection == direction ? fSrcRect : fDstRect; | 113 SkRect rect = kReverse_MapDirection == direction ? fSrcRect : fDstRect; |
114 ctm.mapRect(&rect); | 114 ctm.mapRect(&rect); |
115 rect.roundOut(dst); | 115 rect.roundOut(dst); |
116 #ifdef SK_SUPPORT_SRC_BOUNDS_BLOAT_FOR_IMAGEFILTERS | |
117 dst->join(src); | |
118 #endif | |
119 } | 116 } |
120 | 117 |
121 bool SkTileImageFilter::onFilterBounds(const SkIRect& src, const SkMatrix& ctm, | 118 bool SkTileImageFilter::onFilterBounds(const SkIRect& src, const SkMatrix& ctm, |
122 SkIRect* dst) const { | 119 SkIRect* dst) const { |
123 this->onFilterNodeBounds(src, ctm, dst, kReverse_MapDirection); | 120 this->onFilterNodeBounds(src, ctm, dst, kReverse_MapDirection); |
124 return true; | 121 return true; |
125 } | 122 } |
126 | 123 |
127 void SkTileImageFilter::computeFastBounds(const SkRect& src, SkRect* dst) const
{ | 124 void SkTileImageFilter::computeFastBounds(const SkRect& src, SkRect* dst) const
{ |
128 #ifdef SK_SUPPORT_SRC_BOUNDS_BLOAT_FOR_IMAGEFILTERS | |
129 // This is a workaround for skia:3194. | |
130 *dst = src; | |
131 dst->join(fDstRect); | |
132 #else | |
133 *dst = fDstRect; | 125 *dst = fDstRect; |
134 #endif | |
135 } | 126 } |
136 | 127 |
137 SkFlattenable* SkTileImageFilter::CreateProc(SkReadBuffer& buffer) { | 128 SkFlattenable* SkTileImageFilter::CreateProc(SkReadBuffer& buffer) { |
138 SK_IMAGEFILTER_UNFLATTEN_COMMON(common, 1); | 129 SK_IMAGEFILTER_UNFLATTEN_COMMON(common, 1); |
139 SkRect src, dst; | 130 SkRect src, dst; |
140 buffer.readRect(&src); | 131 buffer.readRect(&src); |
141 buffer.readRect(&dst); | 132 buffer.readRect(&dst); |
142 return Create(src, dst, common.getInput(0)); | 133 return Create(src, dst, common.getInput(0)); |
143 } | 134 } |
144 | 135 |
(...skipping 11 matching lines...) Expand all Loading... |
156 str->appendf(" dst: %.2f %.2f %.2f %.2f", | 147 str->appendf(" dst: %.2f %.2f %.2f %.2f", |
157 fDstRect.fLeft, fDstRect.fTop, fDstRect.fRight, fDstRect.fBotto
m); | 148 fDstRect.fLeft, fDstRect.fTop, fDstRect.fRight, fDstRect.fBotto
m); |
158 if (this->getInput(0)) { | 149 if (this->getInput(0)) { |
159 str->appendf("input: ("); | 150 str->appendf("input: ("); |
160 this->getInput(0)->toString(str); | 151 this->getInput(0)->toString(str); |
161 str->appendf(")"); | 152 str->appendf(")"); |
162 } | 153 } |
163 str->append(")"); | 154 str->append(")"); |
164 } | 155 } |
165 #endif | 156 #endif |
OLD | NEW |