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

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

Issue 374923002: Goodbye GrEffectRef. (Closed) Base URL: https://skia.googlesource.com/skia.git@noref3
Patch Set: Address comments Created 6 years, 5 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 36 matching lines...) Expand 10 before | Expand all | Expand 10 after
47 const SkRect& srcRect, 47 const SkRect& srcRect,
48 const SkRect& dstRect, 48 const SkRect& dstRect,
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<GrEffectRef> conv(GrConvolutionEffect::CreateGaussian( 57 SkAutoTUnref<GrEffect> conv(GrConvolutionEffect::CreateGaussian(
58 texture, direction, radius, sigma, useBounds, bounds)); 58 texture, direction, radius, sigma, useBounds, bounds));
59 paint.reset(); 59 paint.reset();
60 paint.addColorEffect(conv); 60 paint.addColorEffect(conv);
61 context->drawRectToRect(paint, dstRect, srcRect); 61 context->drawRectToRect(paint, dstRect, srcRect);
62 } 62 }
63 63
64 static void convolve_gaussian(GrContext* context, 64 static void convolve_gaussian(GrContext* context,
65 const SkRect& srcRect, 65 const SkRect& srcRect,
66 const SkRect& dstRect, 66 const SkRect& dstRect,
67 GrTexture* texture, 67 GrTexture* texture,
(...skipping 99 matching lines...) Expand 10 before | Expand all | Expand 10 after
167 SkMatrix matrix; 167 SkMatrix matrix;
168 matrix.setIDiv(srcTexture->width(), srcTexture->height()); 168 matrix.setIDiv(srcTexture->width(), srcTexture->height());
169 context->setRenderTarget(dstTexture->asRenderTarget()); 169 context->setRenderTarget(dstTexture->asRenderTarget());
170 SkRect dstRect(srcRect); 170 SkRect dstRect(srcRect);
171 if (cropToRect && i == 1) { 171 if (cropToRect && i == 1) {
172 dstRect.offset(-dstRect.fLeft, -dstRect.fTop); 172 dstRect.offset(-dstRect.fLeft, -dstRect.fTop);
173 SkRect domain; 173 SkRect domain;
174 matrix.mapRect(&domain, rect); 174 matrix.mapRect(&domain, rect);
175 domain.inset(i < scaleFactorX ? SK_ScalarHalf / srcTexture->width() : 0.0f, 175 domain.inset(i < scaleFactorX ? SK_ScalarHalf / srcTexture->width() : 0.0f,
176 i < scaleFactorY ? SK_ScalarHalf / srcTexture->height() : 0.0f); 176 i < scaleFactorY ? SK_ScalarHalf / srcTexture->height() : 0.0f);
177 SkAutoTUnref<GrEffectRef> effect(GrTextureDomainEffect::Create( 177 SkAutoTUnref<GrEffect> effect(GrTextureDomainEffect::Create(
178 srcTexture, 178 srcTexture,
179 matrix, 179 matrix,
180 domain, 180 domain,
181 GrTextureDomain::kDecal_Mode, 181 GrTextureDomain::kDecal_Mode,
182 GrTextureParams::kBilerp_FilterMode)); 182 GrTextureParams::kBilerp_FilterMode));
183 paint.addColorEffect(effect); 183 paint.addColorEffect(effect);
184 } else { 184 } else {
185 GrTextureParams params(SkShader::kClamp_TileMode, GrTextureParams::k Bilerp_FilterMode); 185 GrTextureParams params(SkShader::kClamp_TileMode, GrTextureParams::k Bilerp_FilterMode);
186 paint.addColorTextureEffect(srcTexture, matrix, params); 186 paint.addColorTextureEffect(srcTexture, matrix, params);
187 } 187 }
(...skipping 73 matching lines...) Expand 10 before | Expand all | Expand 10 after
261 } else if (srcTexture == temp2.texture()) { 261 } else if (srcTexture == temp2.texture()) {
262 return temp2.detach(); 262 return temp2.detach();
263 } else { 263 } else {
264 srcTexture->ref(); 264 srcTexture->ref();
265 return srcTexture; 265 return srcTexture;
266 } 266 }
267 } 267 }
268 #endif 268 #endif
269 269
270 } 270 }
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