OLD | NEW |
1 /* | 1 /* |
2 * Copyright 2015 Google Inc. | 2 * Copyright 2015 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 "GrTextureParamsAdjuster.h" | 8 #include "GrTextureParamsAdjuster.h" |
9 | 9 |
10 #include "GrCaps.h" | 10 #include "GrCaps.h" |
(...skipping 334 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
345 | 345 |
346 // We only expect MIP maps to require a tight copy. | 346 // We only expect MIP maps to require a tight copy. |
347 SkASSERT(filterOrNullForBicubic && | 347 SkASSERT(filterOrNullForBicubic && |
348 GrTextureParams::kMipMap_FilterMode == *filterOrNullForBicubic)
; | 348 GrTextureParams::kMipMap_FilterMode == *filterOrNullForBicubic)
; |
349 static const GrTextureParams::FilterMode kBilerp = GrTextureParams::kBil
erp_FilterMode; | 349 static const GrTextureParams::FilterMode kBilerp = GrTextureParams::kBil
erp_FilterMode; |
350 domainMode = | 350 domainMode = |
351 determine_domain_mode(constraintRect, filterConstraint, coordsLimite
dToConstraintRect, | 351 determine_domain_mode(constraintRect, filterConstraint, coordsLimite
dToConstraintRect, |
352 texture->width(), texture->height(), | 352 texture->width(), texture->height(), |
353 contentArea, &kBilerp, &domain); | 353 contentArea, &kBilerp, &domain); |
354 SkASSERT(kTightCopy_DomainMode != domainMode); | 354 SkASSERT(kTightCopy_DomainMode != domainMode); |
355 filterOrNullForBicubic = &kBilerp; | |
356 } | 355 } |
357 SkASSERT(kNoDomain_DomainMode == domainMode || | 356 SkASSERT(kNoDomain_DomainMode == domainMode || |
358 (domain.fLeft <= domain.fRight && domain.fTop <= domain.fBottom)); | 357 (domain.fLeft <= domain.fRight && domain.fTop <= domain.fBottom)); |
359 if (filterOrNullForBicubic) { | 358 if (filterOrNullForBicubic) { |
360 if (kDomain_DomainMode == domainMode) { | 359 if (kDomain_DomainMode == domainMode) { |
361 SkASSERT(*filterOrNullForBicubic != GrTextureParams::kMipMap_FilterM
ode); | |
362 return GrTextureDomainEffect::Create(texture, textureMatrix, domain, | 360 return GrTextureDomainEffect::Create(texture, textureMatrix, domain, |
363 GrTextureDomain::kClamp_Mode, | 361 GrTextureDomain::kClamp_Mode, |
364 *filterOrNullForBicubic); | 362 *filterOrNullForBicubic); |
365 } else { | 363 } else { |
366 GrTextureParams params(SkShader::kClamp_TileMode, *filterOrNullForBi
cubic); | 364 GrTextureParams params(SkShader::kClamp_TileMode, *filterOrNullForBi
cubic); |
367 return GrSimpleTextureEffect::Create(texture, textureMatrix, params)
; | 365 return GrSimpleTextureEffect::Create(texture, textureMatrix, params)
; |
368 } | 366 } |
369 } else { | 367 } else { |
370 if (kDomain_DomainMode == domainMode) { | 368 if (kDomain_DomainMode == domainMode) { |
371 return GrBicubicEffect::Create(texture, textureMatrix, domain); | 369 return GrBicubicEffect::Create(texture, textureMatrix, domain); |
(...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
406 return result; | 404 return result; |
407 } | 405 } |
408 | 406 |
409 GrTexture* GrTextureMaker::generateTextureForParams(GrContext* ctx, const CopyPa
rams& copyParams) { | 407 GrTexture* GrTextureMaker::generateTextureForParams(GrContext* ctx, const CopyPa
rams& copyParams) { |
410 SkAutoTUnref<GrTexture> original(this->refOriginalTexture(ctx)); | 408 SkAutoTUnref<GrTexture> original(this->refOriginalTexture(ctx)); |
411 if (!original) { | 409 if (!original) { |
412 return nullptr; | 410 return nullptr; |
413 } | 411 } |
414 return copy_on_gpu(original, nullptr, copyParams); | 412 return copy_on_gpu(original, nullptr, copyParams); |
415 } | 413 } |
OLD | NEW |