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

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

Issue 2186073002: Rename GrContext's newDrawContext & drawContext to makeDrawContext (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: Created 4 years, 4 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/effects/SkDisplacementMapEffect.cpp ('k') | src/effects/SkLightingImageFilter.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 2013 Google Inc. 2 * Copyright 2013 Google Inc.
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 "SkGpuBlurUtils.h" 8 #include "SkGpuBlurUtils.h"
9 9
10 #include "SkRect.h" 10 #include "SkRect.h"
(...skipping 208 matching lines...) Expand 10 before | Expand all | Expand 10 after
219 SkASSERT(kBGRA_8888_GrPixelConfig == srcTexture->config() || 219 SkASSERT(kBGRA_8888_GrPixelConfig == srcTexture->config() ||
220 kRGBA_8888_GrPixelConfig == srcTexture->config() || 220 kRGBA_8888_GrPixelConfig == srcTexture->config() ||
221 kSRGBA_8888_GrPixelConfig == srcTexture->config() || 221 kSRGBA_8888_GrPixelConfig == srcTexture->config() ||
222 kSBGRA_8888_GrPixelConfig == srcTexture->config() || 222 kSBGRA_8888_GrPixelConfig == srcTexture->config() ||
223 kAlpha_8_GrPixelConfig == srcTexture->config()); 223 kAlpha_8_GrPixelConfig == srcTexture->config());
224 224
225 const int width = dstBounds.width(); 225 const int width = dstBounds.width();
226 const int height = dstBounds.height(); 226 const int height = dstBounds.height();
227 const GrPixelConfig config = srcTexture->config(); 227 const GrPixelConfig config = srcTexture->config();
228 228
229 sk_sp<GrDrawContext> dstDrawContext(context->newDrawContext(SkBackingFit::kA pprox, 229 sk_sp<GrDrawContext> dstDrawContext(context->makeDrawContext(SkBackingFit::k Approx,
230 width, height, c onfig, colorSpace, 230 width, height, config, colorSpace,
231 0, kDefault_GrSu rfaceOrigin)); 231 0, kDefault_GrS urfaceOrigin));
232 if (!dstDrawContext) { 232 if (!dstDrawContext) {
233 return nullptr; 233 return nullptr;
234 } 234 }
235 235
236 // For really small blurs (certainly no wider than 5x5 on desktop gpus) it i s faster to just 236 // For really small blurs (certainly no wider than 5x5 on desktop gpus) it i s faster to just
237 // launch a single non separable kernel vs two launches 237 // launch a single non separable kernel vs two launches
238 if (sigmaX > 0.0f && sigmaY > 0.0f && 238 if (sigmaX > 0.0f && sigmaY > 0.0f &&
239 (2 * radiusX + 1) * (2 * radiusY + 1) <= MAX_KERNEL_SIZE) { 239 (2 * radiusX + 1) * (2 * radiusY + 1) <= MAX_KERNEL_SIZE) {
240 // We shouldn't be scaling because this is a small size blur 240 // We shouldn't be scaling because this is a small size blur
241 SkASSERT((1 == scaleFactorX) && (1 == scaleFactorY)); 241 SkASSERT((1 == scaleFactorX) && (1 == scaleFactorY));
242 242
243 convolve_gaussian_2d(dstDrawContext.get(), clip, localDstBounds, srcOffs et, 243 convolve_gaussian_2d(dstDrawContext.get(), clip, localDstBounds, srcOffs et,
244 srcTexture.get(), radiusX, radiusY, sigmaX, sigmaY, srcBounds); 244 srcTexture.get(), radiusX, radiusY, sigmaX, sigmaY, srcBounds);
245 245
246 return dstDrawContext; 246 return dstDrawContext;
247 } 247 }
248 248
249 sk_sp<GrDrawContext> tmpDrawContext(context->newDrawContext(SkBackingFit::kA pprox, 249 sk_sp<GrDrawContext> tmpDrawContext(context->makeDrawContext(SkBackingFit::k Approx,
250 width, height, c onfig, colorSpace, 250 width, height, config, colorSpace,
251 0, kDefault_GrSu rfaceOrigin)); 251 0, kDefault_GrS urfaceOrigin));
252 if (!tmpDrawContext) { 252 if (!tmpDrawContext) {
253 return nullptr; 253 return nullptr;
254 } 254 }
255 255
256 sk_sp<GrDrawContext> srcDrawContext; 256 sk_sp<GrDrawContext> srcDrawContext;
257 257
258 SkASSERT(SkIsPow2(scaleFactorX) && SkIsPow2(scaleFactorY)); 258 SkASSERT(SkIsPow2(scaleFactorX) && SkIsPow2(scaleFactorY));
259 259
260 for (int i = 1; i < scaleFactorX || i < scaleFactorY; i *= 2) { 260 for (int i = 1; i < scaleFactorX || i < scaleFactorY; i *= 2) {
261 GrPaint paint; 261 GrPaint paint;
(...skipping 109 matching lines...) Expand 10 before | Expand all | Expand 10 after
371 dstDrawContext.swap(tmpDrawContext); 371 dstDrawContext.swap(tmpDrawContext);
372 } 372 }
373 373
374 return srcDrawContext; 374 return srcDrawContext;
375 } 375 }
376 376
377 } 377 }
378 378
379 #endif 379 #endif
380 380
OLDNEW
« no previous file with comments | « src/effects/SkDisplacementMapEffect.cpp ('k') | src/effects/SkLightingImageFilter.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698