Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(2)

Side by Side Diff: src/effects/SkBlurImageFilter.cpp

Issue 1584933002: Refactor to use GrWrapTextureInBitmap more (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: Fix no-gpu build Created 4 years, 11 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « src/core/SkMaskFilter.cpp ('k') | src/effects/SkBlurMaskFilter.cpp » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 "SkDevice.h" 11 #include "SkDevice.h"
12 #include "SkGpuBlurUtils.h" 12 #include "SkGpuBlurUtils.h"
13 #include "SkOpts.h" 13 #include "SkOpts.h"
14 #include "SkReadBuffer.h" 14 #include "SkReadBuffer.h"
15 #include "SkWriteBuffer.h" 15 #include "SkWriteBuffer.h"
16 #if SK_SUPPORT_GPU 16 #if SK_SUPPORT_GPU
17 #include "GrContext.h" 17 #include "GrContext.h"
18 #include "SkGr.h"
18 #endif 19 #endif
19 20
20 // This rather arbitrary-looking value results in a maximum box blur kernel size 21 // This rather arbitrary-looking value results in a maximum box blur kernel size
21 // of 1000 pixels on the raster path, which matches the WebKit and Firefox 22 // of 1000 pixels on the raster path, which matches the WebKit and Firefox
22 // implementations. Since the GPU path does not compute a box blur, putting 23 // implementations. Since the GPU path does not compute a box blur, putting
23 // the limit on sigma ensures consistent behaviour between the GPU and 24 // the limit on sigma ensures consistent behaviour between the GPU and
24 // raster paths. 25 // raster paths.
25 #define MAX_SIGMA SkIntToScalar(532) 26 #define MAX_SIGMA SkIntToScalar(532)
26 27
27 static SkVector mapSigma(const SkSize& localSigma, const SkMatrix& ctm) { 28 static SkVector mapSigma(const SkSize& localSigma, const SkMatrix& ctm) {
(...skipping 192 matching lines...) Expand 10 before | Expand all | Expand 10 after
220 SkAutoTUnref<GrTexture> tex(SkGpuBlurUtils::GaussianBlur(source->getContext( ), 221 SkAutoTUnref<GrTexture> tex(SkGpuBlurUtils::GaussianBlur(source->getContext( ),
221 source, 222 source,
222 false, 223 false,
223 SkRect::Make(dstBou nds), 224 SkRect::Make(dstBou nds),
224 &srcBoundsF, 225 &srcBoundsF,
225 sigma.x(), 226 sigma.x(),
226 sigma.y())); 227 sigma.y()));
227 if (!tex) { 228 if (!tex) {
228 return false; 229 return false;
229 } 230 }
230 WrapTexture(tex, dstBounds.width(), dstBounds.height(), result); 231 GrWrapTextureInBitmap(tex, dstBounds.width(), dstBounds.height(), false, res ult);
231 return true; 232 return true;
232 #else 233 #else
233 SkDEBUGFAIL("Should not call in GPU-less build"); 234 SkDEBUGFAIL("Should not call in GPU-less build");
234 return false; 235 return false;
235 #endif 236 #endif
236 } 237 }
237 238
238 #ifndef SK_IGNORE_TO_STRING 239 #ifndef SK_IGNORE_TO_STRING
239 void SkBlurImageFilter::toString(SkString* str) const { 240 void SkBlurImageFilter::toString(SkString* str) const {
240 str->appendf("SkBlurImageFilter: ("); 241 str->appendf("SkBlurImageFilter: (");
241 str->appendf("sigma: (%f, %f) input (", fSigma.fWidth, fSigma.fHeight); 242 str->appendf("sigma: (%f, %f) input (", fSigma.fWidth, fSigma.fHeight);
242 243
243 if (this->getInput(0)) { 244 if (this->getInput(0)) {
244 this->getInput(0)->toString(str); 245 this->getInput(0)->toString(str);
245 } 246 }
246 247
247 str->append("))"); 248 str->append("))");
248 } 249 }
249 #endif 250 #endif
OLDNEW
« no previous file with comments | « src/core/SkMaskFilter.cpp ('k') | src/effects/SkBlurMaskFilter.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698