| 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 119 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 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) { |
| 140 SkBitmap src = this->getInputResult(0, proxy, source, ctm, offset); | 140 SkBitmap src = source; |
| 141 if (getInput(0) && !getInput(0)->filterImage(proxy, source, ctm, &src, offse
t)) { |
| 142 return false; |
| 143 } |
| 144 |
| 141 if (src.config() != SkBitmap::kARGB_8888_Config) { | 145 if (src.config() != SkBitmap::kARGB_8888_Config) { |
| 142 return false; | 146 return false; |
| 143 } | 147 } |
| 144 | 148 |
| 145 SkAutoLockPixels alp(src); | 149 SkAutoLockPixels alp(src); |
| 146 if (!src.getPixels()) { | 150 if (!src.getPixels()) { |
| 147 return false; | 151 return false; |
| 148 } | 152 } |
| 149 | 153 |
| 150 dst->setConfig(src.config(), src.width(), src.height()); | 154 dst->setConfig(src.config(), src.width(), src.height()); |
| (...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 198 SkRect rect; | 202 SkRect rect; |
| 199 src.getBounds(&rect); | 203 src.getBounds(&rect); |
| 200 SkAutoTUnref<GrTexture> tex(source->getContext()->gaussianBlur(source, false
, rect, | 204 SkAutoTUnref<GrTexture> tex(source->getContext()->gaussianBlur(source, false
, rect, |
| 201 fSigma.width(), fSigma.height())); | 205 fSigma.width(), fSigma.height())); |
| 202 return SkImageFilterUtils::WrapTexture(tex, src.width(), src.height(), resul
t); | 206 return SkImageFilterUtils::WrapTexture(tex, src.width(), src.height(), resul
t); |
| 203 #else | 207 #else |
| 204 SkDEBUGFAIL("Should not call in GPU-less build"); | 208 SkDEBUGFAIL("Should not call in GPU-less build"); |
| 205 return false; | 209 return false; |
| 206 #endif | 210 #endif |
| 207 } | 211 } |
| OLD | NEW |