OLD | NEW |
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 189 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
200 SkMatrix matrix; | 200 SkMatrix matrix; |
201 matrix.setIDiv(srcTexture->width(), srcTexture->height()); | 201 matrix.setIDiv(srcTexture->width(), srcTexture->height()); |
202 context->setRenderTarget(dstTexture->asRenderTarget()); | 202 context->setRenderTarget(dstTexture->asRenderTarget()); |
203 SkRect dstRect(srcRect); | 203 SkRect dstRect(srcRect); |
204 if (cropToRect && i == 1) { | 204 if (cropToRect && i == 1) { |
205 dstRect.offset(-dstRect.fLeft, -dstRect.fTop); | 205 dstRect.offset(-dstRect.fLeft, -dstRect.fTop); |
206 SkRect domain; | 206 SkRect domain; |
207 matrix.mapRect(&domain, rect); | 207 matrix.mapRect(&domain, rect); |
208 domain.inset(i < scaleFactorX ? SK_ScalarHalf / srcTexture->width()
: 0.0f, | 208 domain.inset(i < scaleFactorX ? SK_ScalarHalf / srcTexture->width()
: 0.0f, |
209 i < scaleFactorY ? SK_ScalarHalf / srcTexture->height()
: 0.0f); | 209 i < scaleFactorY ? SK_ScalarHalf / srcTexture->height()
: 0.0f); |
210 SkAutoTUnref<GrFragmentProcessor> fp(GrTextureDomainEffect::Create( | 210 SkAutoTUnref<GrFragmentProcessor> fp( GrTextureDomainEffect::Creat
e( |
211 srcTexture, | 211 srcTexture, |
212 matrix, | 212 matrix, |
213 domain, | 213 domain, |
214 GrTextureDomain::kDecal_Mode, | 214 GrTextureDomain::kDecal_Mode, |
215 GrTextureParams::kBilerp_FilterMode)); | 215 GrTextureParams::kBilerp_FilterMode)); |
216 paint.addColorProcessor(fp); | 216 paint.addColorProcessor(fp); |
217 } else { | 217 } else { |
218 GrTextureParams params(SkShader::kClamp_TileMode, GrTextureParams::k
Bilerp_FilterMode); | 218 GrTextureParams params(SkShader::kClamp_TileMode, GrTextureParams::k
Bilerp_FilterMode); |
219 paint.addColorTextureProcessor(srcTexture, matrix, params); | 219 paint.addColorTextureProcessor(srcTexture, matrix, params); |
220 } | 220 } |
(...skipping 81 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
302 context->drawRectToRect(paint, dstRect, srcRect); | 302 context->drawRectToRect(paint, dstRect, srcRect); |
303 srcRect = dstRect; | 303 srcRect = dstRect; |
304 srcTexture = dstTexture; | 304 srcTexture = dstTexture; |
305 SkTSwap(dstTexture, tempTexture); | 305 SkTSwap(dstTexture, tempTexture); |
306 } | 306 } |
307 return SkRef(srcTexture); | 307 return SkRef(srcTexture); |
308 } | 308 } |
309 #endif | 309 #endif |
310 | 310 |
311 } | 311 } |
OLD | NEW |