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

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

Issue 781153002: Fix Morphology effects sourcing outside of the crop rect. (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: Created 6 years 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
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 38 matching lines...) Expand 10 before | Expand all | Expand 10 after
49 GrTexture* texture, 49 GrTexture* texture,
50 Gr1DKernelEffect::Direction direction, 50 Gr1DKernelEffect::Direction direction,
51 int radius, 51 int radius,
52 float sigma, 52 float sigma,
53 bool useBounds, 53 bool useBounds,
54 float bounds[2]) { 54 float bounds[2]) {
55 GrPaint paint; 55 GrPaint paint;
56 paint.reset(); 56 paint.reset();
57 SkAutoTUnref<GrFragmentProcessor> conv(GrConvolutionEffect::CreateGaussian( 57 SkAutoTUnref<GrFragmentProcessor> conv(GrConvolutionEffect::CreateGaussian(
58 texture, direction, radius, sigma, useBounds, bounds)); 58 texture, direction, radius, sigma, useBounds, bounds));
59 paint.reset();
Justin Novosad 2014/12/22 20:11:11 This seems unrelated. Should go in a separate CL.
cwallez 2015/01/19 21:34:38 Done.
60 paint.addColorProcessor(conv); 59 paint.addColorProcessor(conv);
61 context->drawRectToRect(paint, dstRect, srcRect); 60 context->drawRectToRect(paint, dstRect, srcRect);
62 } 61 }
63 62
64 static void convolve_gaussian_2d(GrContext* context, 63 static void convolve_gaussian_2d(GrContext* context,
65 const SkRect& srcRect, 64 const SkRect& srcRect,
66 const SkRect& dstRect, 65 const SkRect& dstRect,
67 GrTexture* texture, 66 GrTexture* texture,
68 int radiusX, 67 int radiusX,
69 int radiusY, 68 int radiusY,
70 SkScalar sigmaX, 69 SkScalar sigmaX,
71 SkScalar sigmaY, 70 SkScalar sigmaY,
72 bool useBounds, 71 bool useBounds,
73 SkIRect bounds) { 72 SkIRect bounds) {
74 SkISize size = SkISize::Make(2 * radiusX + 1, 2 * radiusY + 1); 73 SkISize size = SkISize::Make(2 * radiusX + 1, 2 * radiusY + 1);
75 SkIPoint kernelOffset = SkIPoint::Make(radiusX, radiusY); 74 SkIPoint kernelOffset = SkIPoint::Make(radiusX, radiusY);
76 GrPaint paint; 75 GrPaint paint;
77 paint.reset(); 76 paint.reset();
78 SkAutoTUnref<GrFragmentProcessor> conv(GrMatrixConvolutionEffect::CreateGaus sian( 77 SkAutoTUnref<GrFragmentProcessor> conv(GrMatrixConvolutionEffect::CreateGaus sian(
79 texture, bounds, size, 1.0, 0.0, kernelOffset, 78 texture, bounds, size, 1.0, 0.0, kernelOffset,
80 useBounds ? GrTextureDomain::kClamp_Mode : GrTextureDomain::kIgnore_ Mode, 79 useBounds ? GrTextureDomain::kClamp_Mode : GrTextureDomain::kIgnore_ Mode,
81 true, sigmaX, sigmaY)); 80 true, sigmaX, sigmaY));
82 paint.reset();
83 paint.addColorProcessor(conv); 81 paint.addColorProcessor(conv);
84 context->drawRectToRect(paint, dstRect, srcRect); 82 context->drawRectToRect(paint, dstRect, srcRect);
85 } 83 }
86 84
87 static void convolve_gaussian(GrContext* context, 85 static void convolve_gaussian(GrContext* context,
88 const SkRect& srcRect, 86 const SkRect& srcRect,
89 const SkRect& dstRect, 87 const SkRect& dstRect,
90 GrTexture* texture, 88 GrTexture* texture,
91 Gr1DKernelEffect::Direction direction, 89 Gr1DKernelEffect::Direction direction,
92 int radius, 90 int radius,
(...skipping 209 matching lines...) Expand 10 before | Expand all | Expand 10 after
302 context->drawRectToRect(paint, dstRect, srcRect); 300 context->drawRectToRect(paint, dstRect, srcRect);
303 srcRect = dstRect; 301 srcRect = dstRect;
304 srcTexture = dstTexture; 302 srcTexture = dstTexture;
305 SkTSwap(dstTexture, tempTexture); 303 SkTSwap(dstTexture, tempTexture);
306 } 304 }
307 return SkRef(srcTexture); 305 return SkRef(srcTexture);
308 } 306 }
309 #endif 307 #endif
310 308
311 } 309 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698