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

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

Issue 20362002: make the filter mode for GrTextureAccess an enum so we can plumb down (Closed) Base URL: https://skia.googlecode.com/svn/trunk
Patch Set: fall back to mipmaps for HQ sampling (for now) Created 7 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 | Annotate | Revision Log
« no previous file with comments | « src/core/SkBitmapProcShader.cpp ('k') | src/effects/gradients/SkGradientShader.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 114 matching lines...) Expand 10 before | Expand all | Expand 10 after
125 dstRect.offset(-dstRect.fLeft, -dstRect.fTop); 125 dstRect.offset(-dstRect.fLeft, -dstRect.fTop);
126 SkRect domain; 126 SkRect domain;
127 matrix.mapRect(&domain, rect); 127 matrix.mapRect(&domain, rect);
128 domain.inset(i < scaleFactorX ? SK_ScalarHalf / srcTexture->width() : 0.0f, 128 domain.inset(i < scaleFactorX ? SK_ScalarHalf / srcTexture->width() : 0.0f,
129 i < scaleFactorY ? SK_ScalarHalf / srcTexture->height() : 0.0f); 129 i < scaleFactorY ? SK_ScalarHalf / srcTexture->height() : 0.0f);
130 SkAutoTUnref<GrEffectRef> effect(GrTextureDomainEffect::Create( 130 SkAutoTUnref<GrEffectRef> effect(GrTextureDomainEffect::Create(
131 srcTexture, 131 srcTexture,
132 matrix, 132 matrix,
133 domain, 133 domain,
134 GrTextureDomainEffect::kDecal_WrapMode, 134 GrTextureDomainEffect::kDecal_WrapMode,
135 true)); 135 GrTextureParams::kBilerp_FilterMode));
136 paint.addColorEffect(effect); 136 paint.addColorEffect(effect);
137 } else { 137 } else {
138 GrTextureParams params(SkShader::kClamp_TileMode, true); 138 GrTextureParams params(SkShader::kClamp_TileMode, GrTextureParams::k Bilerp_FilterMode);
139 paint.addColorTextureEffect(srcTexture, matrix, params); 139 paint.addColorTextureEffect(srcTexture, matrix, params);
140 } 140 }
141 scale_rect(&dstRect, i < scaleFactorX ? 0.5f : 1.0f, 141 scale_rect(&dstRect, i < scaleFactorX ? 0.5f : 1.0f,
142 i < scaleFactorY ? 0.5f : 1.0f); 142 i < scaleFactorY ? 0.5f : 1.0f);
143 context->drawRectToRect(paint, dstRect, srcRect); 143 context->drawRectToRect(paint, dstRect, srcRect);
144 srcRect = dstRect; 144 srcRect = dstRect;
145 srcTexture = dstTexture; 145 srcTexture = dstTexture;
146 SkTSwap(dstTexture, tempTexture); 146 SkTSwap(dstTexture, tempTexture);
147 } 147 }
148 148
(...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after
192 context->clear(&clearRect, 0x0); 192 context->clear(&clearRect, 0x0);
193 clearRect = SkIRect::MakeXYWH(srcIRect.fRight, srcIRect.fTop, 193 clearRect = SkIRect::MakeXYWH(srcIRect.fRight, srcIRect.fTop,
194 1, srcIRect.height()); 194 1, srcIRect.height());
195 context->clear(&clearRect, 0x0); 195 context->clear(&clearRect, 0x0);
196 SkMatrix matrix; 196 SkMatrix matrix;
197 matrix.setIDiv(srcTexture->width(), srcTexture->height()); 197 matrix.setIDiv(srcTexture->width(), srcTexture->height());
198 context->setRenderTarget(dstTexture->asRenderTarget()); 198 context->setRenderTarget(dstTexture->asRenderTarget());
199 199
200 GrPaint paint; 200 GrPaint paint;
201 // FIXME: this should be mitchell, not bilinear. 201 // FIXME: this should be mitchell, not bilinear.
202 GrTextureParams params(SkShader::kClamp_TileMode, true); 202 GrTextureParams params(SkShader::kClamp_TileMode, GrTextureParams::kBile rp_FilterMode);
203 paint.addColorTextureEffect(srcTexture, matrix, params); 203 paint.addColorTextureEffect(srcTexture, matrix, params);
204 204
205 SkRect dstRect(srcRect); 205 SkRect dstRect(srcRect);
206 scale_rect(&dstRect, (float) scaleFactorX, (float) scaleFactorY); 206 scale_rect(&dstRect, (float) scaleFactorX, (float) scaleFactorY);
207 context->drawRectToRect(paint, dstRect, srcRect); 207 context->drawRectToRect(paint, dstRect, srcRect);
208 srcRect = dstRect; 208 srcRect = dstRect;
209 srcTexture = dstTexture; 209 srcTexture = dstTexture;
210 SkTSwap(dstTexture, tempTexture); 210 SkTSwap(dstTexture, tempTexture);
211 } 211 }
212 if (srcTexture == temp1.texture()) { 212 if (srcTexture == temp1.texture()) {
213 return temp1.detach(); 213 return temp1.detach();
214 } else if (srcTexture == temp2.texture()) { 214 } else if (srcTexture == temp2.texture()) {
215 return temp2.detach(); 215 return temp2.detach();
216 } else { 216 } else {
217 srcTexture->ref(); 217 srcTexture->ref();
218 return srcTexture; 218 return srcTexture;
219 } 219 }
220 } 220 }
221 #endif 221 #endif
222 222
223 } 223 }
OLDNEW
« no previous file with comments | « src/core/SkBitmapProcShader.cpp ('k') | src/effects/gradients/SkGradientShader.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698