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" |
11 #include "SkFlattenableBuffers.h" | 11 #include "SkFlattenableBuffers.h" |
| 12 #include "SkGpuBlurUtils.h" |
12 #if SK_SUPPORT_GPU | 13 #if SK_SUPPORT_GPU |
13 #include "GrContext.h" | 14 #include "GrContext.h" |
14 #include "SkImageFilterUtils.h" | 15 #include "SkImageFilterUtils.h" |
15 #endif | 16 #endif |
16 | 17 |
17 SkBlurImageFilter::SkBlurImageFilter(SkFlattenableReadBuffer& buffer) | 18 SkBlurImageFilter::SkBlurImageFilter(SkFlattenableReadBuffer& buffer) |
18 : INHERITED(buffer) { | 19 : INHERITED(buffer) { |
19 fSigma.fWidth = buffer.readScalar(); | 20 fSigma.fWidth = buffer.readScalar(); |
20 fSigma.fHeight = buffer.readScalar(); | 21 fSigma.fHeight = buffer.readScalar(); |
21 } | 22 } |
(...skipping 174 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
196 bool SkBlurImageFilter::filterImageGPU(Proxy* proxy, const SkBitmap& src, SkBitm
ap* result, | 197 bool SkBlurImageFilter::filterImageGPU(Proxy* proxy, const SkBitmap& src, SkBitm
ap* result, |
197 SkIPoint* offset) { | 198 SkIPoint* offset) { |
198 #if SK_SUPPORT_GPU | 199 #if SK_SUPPORT_GPU |
199 SkBitmap input; | 200 SkBitmap input; |
200 if (!SkImageFilterUtils::GetInputResultGPU(getInput(0), proxy, src, &input,
offset)) { | 201 if (!SkImageFilterUtils::GetInputResultGPU(getInput(0), proxy, src, &input,
offset)) { |
201 return false; | 202 return false; |
202 } | 203 } |
203 GrTexture* source = input.getTexture(); | 204 GrTexture* source = input.getTexture(); |
204 SkRect rect; | 205 SkRect rect; |
205 src.getBounds(&rect); | 206 src.getBounds(&rect); |
206 SkAutoTUnref<GrTexture> tex(source->getContext()->gaussianBlur(source, false
, rect, | 207 SkAutoTUnref<GrTexture> tex(SkGpuBlurUtils::GaussianBlur(source->getContext(
), |
207 fSigma.width(), fSigma.height())); | 208 source, false, rect
, |
| 209 fSigma.width(), fSi
gma.height())); |
208 return SkImageFilterUtils::WrapTexture(tex, src.width(), src.height(), resul
t); | 210 return SkImageFilterUtils::WrapTexture(tex, src.width(), src.height(), resul
t); |
209 #else | 211 #else |
210 SkDEBUGFAIL("Should not call in GPU-less build"); | 212 SkDEBUGFAIL("Should not call in GPU-less build"); |
211 return false; | 213 return false; |
212 #endif | 214 #endif |
213 } | 215 } |
OLD | NEW |