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 103 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
114 offset->fY = inputBounds.y(); | 114 offset->fY = inputBounds.y(); |
115 return input->makeSubset(inputBounds.makeOffset(-inputOffset.x(), | 115 return input->makeSubset(inputBounds.makeOffset(-inputOffset.x(), |
116 -inputOffset.y())); | 116 -inputOffset.y())); |
117 } | 117 } |
118 | 118 |
119 offset->fX = dstBounds.fLeft; | 119 offset->fX = dstBounds.fLeft; |
120 offset->fY = dstBounds.fTop; | 120 offset->fY = dstBounds.fTop; |
121 inputBounds.offset(-inputOffset); | 121 inputBounds.offset(-inputOffset); |
122 dstBounds.offset(-inputOffset); | 122 dstBounds.offset(-inputOffset); |
123 SkRect inputBoundsF(SkRect::Make(inputBounds)); | 123 SkRect inputBoundsF(SkRect::Make(inputBounds)); |
124 sk_sp<GrTexture> tex(SkGpuBlurUtils::GaussianBlur(context, | 124 sk_sp<GrDrawContext> drawContext(SkGpuBlurUtils::GaussianBlur( |
125 inputTexture.get(), | 125 context, |
126 source->props().isGamm
aCorrect(), | 126 inputTexture.g
et(), |
127 SkRect::Make(dstBounds
), | 127 source->props(
).isGammaCorrect(), |
128 &inputBoundsF, | 128 SkRect::Make(d
stBounds), |
129 sigma.x(), | 129 &inputBoundsF, |
130 sigma.y())); | 130 sigma.x(), |
131 if (!tex) { | 131 sigma.y())); |
| 132 if (!drawContext) { |
132 return nullptr; | 133 return nullptr; |
133 } | 134 } |
134 | 135 |
135 return SkSpecialImage::MakeFromGpu(SkIRect::MakeWH(dstBounds.width(), ds
tBounds.height()), | 136 return SkSpecialImage::MakeFromGpu(SkIRect::MakeWH(dstBounds.width(), ds
tBounds.height()), |
136 kNeedNewImageUniqueID_SpecialImage, | 137 kNeedNewImageUniqueID_SpecialImage, |
137 std::move(tex), &source->props()); | 138 drawContext->asTexture(), &source->pr
ops()); |
138 } | 139 } |
139 #endif | 140 #endif |
140 | 141 |
141 int kernelSizeX, kernelSizeX3, lowOffsetX, highOffsetX; | 142 int kernelSizeX, kernelSizeX3, lowOffsetX, highOffsetX; |
142 int kernelSizeY, kernelSizeY3, lowOffsetY, highOffsetY; | 143 int kernelSizeY, kernelSizeY3, lowOffsetY, highOffsetY; |
143 get_box3_params(sigma.x(), &kernelSizeX, &kernelSizeX3, &lowOffsetX, &highOf
fsetX); | 144 get_box3_params(sigma.x(), &kernelSizeX, &kernelSizeX3, &lowOffsetX, &highOf
fsetX); |
144 get_box3_params(sigma.y(), &kernelSizeY, &kernelSizeY3, &lowOffsetY, &highOf
fsetY); | 145 get_box3_params(sigma.y(), &kernelSizeY, &kernelSizeY3, &lowOffsetY, &highOf
fsetY); |
145 | 146 |
146 if (kernelSizeX < 0 || kernelSizeY < 0) { | 147 if (kernelSizeX < 0 || kernelSizeY < 0) { |
147 return nullptr; | 148 return nullptr; |
(...skipping 100 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
248 str->appendf("SkBlurImageFilter: ("); | 249 str->appendf("SkBlurImageFilter: ("); |
249 str->appendf("sigma: (%f, %f) input (", fSigma.fWidth, fSigma.fHeight); | 250 str->appendf("sigma: (%f, %f) input (", fSigma.fWidth, fSigma.fHeight); |
250 | 251 |
251 if (this->getInput(0)) { | 252 if (this->getInput(0)) { |
252 this->getInput(0)->toString(str); | 253 this->getInput(0)->toString(str); |
253 } | 254 } |
254 | 255 |
255 str->append("))"); | 256 str->append("))"); |
256 } | 257 } |
257 #endif | 258 #endif |
OLD | NEW |