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 "SkBitmap.h" | 8 #include "SkBitmap.h" |
9 #include "SkBlurImageFilter.h" | 9 #include "SkBlurImageFilter.h" |
10 #include "SkColorPriv.h" | 10 #include "SkColorPriv.h" |
(...skipping 118 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
129 *kernelSize3 = d; | 129 *kernelSize3 = d; |
130 } else { | 130 } else { |
131 *highOffset = d / 2; | 131 *highOffset = d / 2; |
132 *lowOffset = *highOffset - 1; | 132 *lowOffset = *highOffset - 1; |
133 *kernelSize3 = d + 1; | 133 *kernelSize3 = d + 1; |
134 } | 134 } |
135 } | 135 } |
136 | 136 |
137 bool SkBlurImageFilter::onFilterImage(Proxy* proxy, | 137 bool SkBlurImageFilter::onFilterImage(Proxy* proxy, |
138 const SkBitmap& source, const SkMatrix& ct
m, | 138 const SkBitmap& source, const SkMatrix& ct
m, |
139 SkBitmap* dst, SkIPoint* offset) { | 139 SkBitmap* dst, SkIPoint* offset) const { |
140 SkBitmap src = source; | 140 SkBitmap src = source; |
141 SkIPoint srcOffset = SkIPoint::Make(0, 0); | 141 SkIPoint srcOffset = SkIPoint::Make(0, 0); |
142 if (getInput(0) && !getInput(0)->filterImage(proxy, source, ctm, &src, &srcO
ffset)) { | 142 if (getInput(0) && !getInput(0)->filterImage(proxy, source, ctm, &src, &srcO
ffset)) { |
143 return false; | 143 return false; |
144 } | 144 } |
145 | 145 |
146 if (src.config() != SkBitmap::kARGB_8888_Config) { | 146 if (src.config() != SkBitmap::kARGB_8888_Config) { |
147 return false; | 147 return false; |
148 } | 148 } |
149 | 149 |
(...skipping 95 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
245 } | 245 } |
246 SkVector sigma, localSigma = SkVector::Make(fSigma.width(), fSigma.height())
; | 246 SkVector sigma, localSigma = SkVector::Make(fSigma.width(), fSigma.height())
; |
247 ctm.mapVectors(&sigma, &localSigma, 1); | 247 ctm.mapVectors(&sigma, &localSigma, 1); |
248 bounds.outset(SkScalarCeilToInt(SkScalarMul(sigma.x(), SkIntToScalar(3))), | 248 bounds.outset(SkScalarCeilToInt(SkScalarMul(sigma.x(), SkIntToScalar(3))), |
249 SkScalarCeilToInt(SkScalarMul(sigma.y(), SkIntToScalar(3)))); | 249 SkScalarCeilToInt(SkScalarMul(sigma.y(), SkIntToScalar(3)))); |
250 *dst = bounds; | 250 *dst = bounds; |
251 return true; | 251 return true; |
252 } | 252 } |
253 | 253 |
254 bool SkBlurImageFilter::filterImageGPU(Proxy* proxy, const SkBitmap& src, const
SkMatrix& ctm, | 254 bool SkBlurImageFilter::filterImageGPU(Proxy* proxy, const SkBitmap& src, const
SkMatrix& ctm, |
255 SkBitmap* result, SkIPoint* offset) { | 255 SkBitmap* result, SkIPoint* offset) const
{ |
256 #if SK_SUPPORT_GPU | 256 #if SK_SUPPORT_GPU |
257 SkBitmap input; | 257 SkBitmap input; |
258 SkIPoint srcOffset = SkIPoint::Make(0, 0); | 258 SkIPoint srcOffset = SkIPoint::Make(0, 0); |
259 if (!SkImageFilterUtils::GetInputResultGPU(getInput(0), proxy, src, ctm, &in
put, &srcOffset)) { | 259 if (!SkImageFilterUtils::GetInputResultGPU(getInput(0), proxy, src, ctm, &in
put, &srcOffset)) { |
260 return false; | 260 return false; |
261 } | 261 } |
262 GrTexture* source = input.getTexture(); | 262 GrTexture* source = input.getTexture(); |
263 SkIRect rect; | 263 SkIRect rect; |
264 src.getBounds(&rect); | 264 src.getBounds(&rect); |
265 rect.offset(srcOffset); | 265 rect.offset(srcOffset); |
(...skipping 11 matching lines...) Expand all Loading... |
277 SkRect::Make(rect), | 277 SkRect::Make(rect), |
278 true, | 278 true, |
279 sigma.x(), | 279 sigma.x(), |
280 sigma.y())); | 280 sigma.y())); |
281 return SkImageFilterUtils::WrapTexture(tex, rect.width(), rect.height(), res
ult); | 281 return SkImageFilterUtils::WrapTexture(tex, rect.width(), rect.height(), res
ult); |
282 #else | 282 #else |
283 SkDEBUGFAIL("Should not call in GPU-less build"); | 283 SkDEBUGFAIL("Should not call in GPU-less build"); |
284 return false; | 284 return false; |
285 #endif | 285 #endif |
286 } | 286 } |
OLD | NEW |