OLD | NEW |
1 /* | 1 /* |
2 * Copyright 2011 The Android Open Source Project | 2 * Copyright 2011 The Android Open Source Project |
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 "SkBlurImageFilter.h" | 8 #include "SkBlurImageFilter.h" |
9 | 9 |
10 #include "SkAutoPixmapStorage.h" | 10 #include "SkAutoPixmapStorage.h" |
(...skipping 115 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
126 false, | 126 false, |
127 source->props()
.isGammaCorrect(), | 127 source->props()
.isGammaCorrect(), |
128 SkRect::Make(ds
tBounds), | 128 SkRect::Make(ds
tBounds), |
129 &inputBoundsF, | 129 &inputBoundsF, |
130 sigma.x(), | 130 sigma.x(), |
131 sigma.y())); | 131 sigma.y())); |
132 if (!tex) { | 132 if (!tex) { |
133 return nullptr; | 133 return nullptr; |
134 } | 134 } |
135 | 135 |
136 return SkSpecialImage::MakeFromGpu(source->internal_getProxy(), | 136 return SkSpecialImage::MakeFromGpu(SkIRect::MakeWH(dstBounds.width(), ds
tBounds.height()), |
137 SkIRect::MakeWH(dstBounds.width(), ds
tBounds.height()), | |
138 kNeedNewImageUniqueID_SpecialImage, | 137 kNeedNewImageUniqueID_SpecialImage, |
139 tex, &source->props()); | 138 tex, &source->props()); |
140 } | 139 } |
141 #endif | 140 #endif |
142 | 141 |
143 int kernelSizeX, kernelSizeX3, lowOffsetX, highOffsetX; | 142 int kernelSizeX, kernelSizeX3, lowOffsetX, highOffsetX; |
144 int kernelSizeY, kernelSizeY3, lowOffsetY, highOffsetY; | 143 int kernelSizeY, kernelSizeY3, lowOffsetY, highOffsetY; |
145 get_box3_params(sigma.x(), &kernelSizeX, &kernelSizeX3, &lowOffsetX, &highOf
fsetX); | 144 get_box3_params(sigma.x(), &kernelSizeX, &kernelSizeX3, &lowOffsetX, &highOf
fsetX); |
146 get_box3_params(sigma.y(), &kernelSizeY, &kernelSizeY3, &lowOffsetY, &highOf
fsetY); | 145 get_box3_params(sigma.y(), &kernelSizeY, &kernelSizeY3, &lowOffsetY, &highOf
fsetY); |
147 | 146 |
(...skipping 70 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
218 } else if (kernelSizeX > 0) { | 217 } else if (kernelSizeX > 0) { |
219 SkOpts::box_blur_xx(s, sw, inputBounds, d, kernelSizeX, lowOffsetX,
highOffsetX, w, h); | 218 SkOpts::box_blur_xx(s, sw, inputBounds, d, kernelSizeX, lowOffsetX,
highOffsetX, w, h); |
220 SkOpts::box_blur_xx(d, w, dstBounds, t, kernelSizeX, highOffsetX,
lowOffsetX, w, h); | 219 SkOpts::box_blur_xx(d, w, dstBounds, t, kernelSizeX, highOffsetX,
lowOffsetX, w, h); |
221 SkOpts::box_blur_xx(t, w, dstBounds, d, kernelSizeX3, highOffsetX,
highOffsetX, w, h); | 220 SkOpts::box_blur_xx(t, w, dstBounds, d, kernelSizeX3, highOffsetX,
highOffsetX, w, h); |
222 } else if (kernelSizeY > 0) { | 221 } else if (kernelSizeY > 0) { |
223 SkOpts::box_blur_yx(s, sw, inputBoundsT, d, kernelSizeY, lowOffsetY,
highOffsetY, h, w); | 222 SkOpts::box_blur_yx(s, sw, inputBoundsT, d, kernelSizeY, lowOffsetY,
highOffsetY, h, w); |
224 SkOpts::box_blur_xx(d, h, dstBoundsT, t, kernelSizeY, highOffsetY,
lowOffsetY, h, w); | 223 SkOpts::box_blur_xx(d, h, dstBoundsT, t, kernelSizeY, highOffsetY,
lowOffsetY, h, w); |
225 SkOpts::box_blur_xy(t, h, dstBoundsT, d, kernelSizeY3, highOffsetY,
highOffsetY, h, w); | 224 SkOpts::box_blur_xy(t, h, dstBoundsT, d, kernelSizeY3, highOffsetY,
highOffsetY, h, w); |
226 } | 225 } |
227 | 226 |
228 return SkSpecialImage::MakeFromRaster(source->internal_getProxy(), | 227 return SkSpecialImage::MakeFromRaster(SkIRect::MakeWH(dstBounds.width(), |
229 SkIRect::MakeWH(dstBounds.width(), | |
230 dstBounds.height()), | 228 dstBounds.height()), |
231 dst, &source->props()); | 229 dst, &source->props()); |
232 } | 230 } |
233 | 231 |
234 | 232 |
235 SkRect SkBlurImageFilter::computeFastBounds(const SkRect& src) const { | 233 SkRect SkBlurImageFilter::computeFastBounds(const SkRect& src) const { |
236 SkRect bounds = this->getInput(0) ? this->getInput(0)->computeFastBounds(src
) : src; | 234 SkRect bounds = this->getInput(0) ? this->getInput(0)->computeFastBounds(src
) : src; |
237 bounds.outset(SkScalarMul(fSigma.width(), SkIntToScalar(3)), | 235 bounds.outset(SkScalarMul(fSigma.width(), SkIntToScalar(3)), |
238 SkScalarMul(fSigma.height(), SkIntToScalar(3))); | 236 SkScalarMul(fSigma.height(), SkIntToScalar(3))); |
239 return bounds; | 237 return bounds; |
(...skipping 11 matching lines...) Expand all Loading... |
251 str->appendf("SkBlurImageFilter: ("); | 249 str->appendf("SkBlurImageFilter: ("); |
252 str->appendf("sigma: (%f, %f) input (", fSigma.fWidth, fSigma.fHeight); | 250 str->appendf("sigma: (%f, %f) input (", fSigma.fWidth, fSigma.fHeight); |
253 | 251 |
254 if (this->getInput(0)) { | 252 if (this->getInput(0)) { |
255 this->getInput(0)->toString(str); | 253 this->getInput(0)->toString(str); |
256 } | 254 } |
257 | 255 |
258 str->append("))"); | 256 str->append("))"); |
259 } | 257 } |
260 #endif | 258 #endif |
OLD | NEW |