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 "SkAutoPixmapStorage.h" | 8 #include "SkAutoPixmapStorage.h" |
9 #include "SkColorPriv.h" | 9 #include "SkColorPriv.h" |
10 #include "SkGpuBlurUtils.h" | 10 #include "SkGpuBlurUtils.h" |
(...skipping 139 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
150 offset->fX = inputBounds.x(); | 150 offset->fX = inputBounds.x(); |
151 offset->fY = inputBounds.y(); | 151 offset->fY = inputBounds.y(); |
152 return input->makeSubset(inputBounds.makeOffset(-inputOffset.x(), | 152 return input->makeSubset(inputBounds.makeOffset(-inputOffset.x(), |
153 -inputOffset.y())); | 153 -inputOffset.y())); |
154 } | 154 } |
155 | 155 |
156 offset->fX = dstBounds.fLeft; | 156 offset->fX = dstBounds.fLeft; |
157 offset->fY = dstBounds.fTop; | 157 offset->fY = dstBounds.fTop; |
158 inputBounds.offset(-inputOffset); | 158 inputBounds.offset(-inputOffset); |
159 dstBounds.offset(-inputOffset); | 159 dstBounds.offset(-inputOffset); |
| 160 // We intentionally use the source's color space, not the destination's
(from ctx). We |
| 161 // always blur in the source's config, so we need a compatible color spa
ce. We also want to |
| 162 // avoid doing gamut conversion on every fetch of the texture. |
160 sk_sp<GrDrawContext> drawContext(SkGpuBlurUtils::GaussianBlur( | 163 sk_sp<GrDrawContext> drawContext(SkGpuBlurUtils::GaussianBlur( |
161 context, | 164 context, |
162 inputTexture.get
(), | 165 inputTexture.get
(), |
163 sk_ref_sp(source
->getColorSpace()), | 166 sk_ref_sp(source
->getColorSpace()), |
164 dstBounds, | 167 dstBounds, |
165 &inputBounds, | 168 &inputBounds, |
166 sigma.x(), | 169 sigma.x(), |
167 sigma.y())); | 170 sigma.y())); |
168 if (!drawContext) { | 171 if (!drawContext) { |
169 return nullptr; | 172 return nullptr; |
(...skipping 117 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
287 str->appendf("SkBlurImageFilterImpl: ("); | 290 str->appendf("SkBlurImageFilterImpl: ("); |
288 str->appendf("sigma: (%f, %f) input (", fSigma.fWidth, fSigma.fHeight); | 291 str->appendf("sigma: (%f, %f) input (", fSigma.fWidth, fSigma.fHeight); |
289 | 292 |
290 if (this->getInput(0)) { | 293 if (this->getInput(0)) { |
291 this->getInput(0)->toString(str); | 294 this->getInput(0)->toString(str); |
292 } | 295 } |
293 | 296 |
294 str->append("))"); | 297 str->append("))"); |
295 } | 298 } |
296 #endif | 299 #endif |
OLD | NEW |