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

Side by Side Diff: src/gpu/GrTextureParamsAdjuster.cpp

Issue 1249543003: Creating functions for uploading a mipmapped texture. (Closed) Base URL: https://chromium.googlesource.com/skia.git@master
Patch Set: Rebasing. Created 4 years, 10 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/gpu/GrTextureParamsAdjuster.h ('k') | src/gpu/GrTexturePriv.h » ('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 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 414 matching lines...) Expand 10 before | Expand all | Expand 10 after
425 (domain.fLeft <= domain.fRight && domain.fTop <= domain.fBottom)); 425 (domain.fLeft <= domain.fRight && domain.fTop <= domain.fBottom));
426 textureMatrix.postIDiv(texture->width(), texture->height()); 426 textureMatrix.postIDiv(texture->width(), texture->height());
427 return create_fp_for_domain_and_filter(texture, textureMatrix, domainMode, d omain, 427 return create_fp_for_domain_and_filter(texture, textureMatrix, domainMode, d omain,
428 filterOrNullForBicubic); 428 filterOrNullForBicubic);
429 } 429 }
430 430
431 ////////////////////////////////////////////////////////////////////////////// 431 //////////////////////////////////////////////////////////////////////////////
432 432
433 GrTexture* GrTextureMaker::refTextureForParams(const GrTextureParams& params) { 433 GrTexture* GrTextureMaker::refTextureForParams(const GrTextureParams& params) {
434 CopyParams copyParams; 434 CopyParams copyParams;
435 bool willBeMipped = params.filterMode() == GrTextureParams::kMipMap_FilterMo de;
436
437 if (!fContext->caps()->mipMapSupport()) {
438 willBeMipped = false;
439 }
440
435 if (!fContext->getGpu()->makeCopyForTextureParams(this->width(), this->heigh t(), params, 441 if (!fContext->getGpu()->makeCopyForTextureParams(this->width(), this->heigh t(), params,
436 &copyParams)) { 442 &copyParams)) {
437 return this->refOriginalTexture(); 443 return this->refOriginalTexture(willBeMipped);
438 } 444 }
439 GrUniqueKey copyKey; 445 GrUniqueKey copyKey;
440 this->makeCopyKey(copyParams, &copyKey); 446 this->makeCopyKey(copyParams, &copyKey);
441 if (copyKey.isValid()) { 447 if (copyKey.isValid()) {
442 GrTexture* result = fContext->textureProvider()->findAndRefTextureByUniq ueKey(copyKey); 448 GrTexture* result = fContext->textureProvider()->findAndRefTextureByUniq ueKey(copyKey);
443 if (result) { 449 if (result) {
444 return result; 450 return result;
445 } 451 }
446 } 452 }
447 453
448 GrTexture* result = this->generateTextureForParams(copyParams); 454 GrTexture* result = this->generateTextureForParams(copyParams, willBeMipped) ;
449 if (!result) { 455 if (!result) {
450 return nullptr; 456 return nullptr;
451 } 457 }
452 458
453 if (copyKey.isValid()) { 459 if (copyKey.isValid()) {
454 fContext->textureProvider()->assignUniqueKeyToTexture(copyKey, result); 460 fContext->textureProvider()->assignUniqueKeyToTexture(copyKey, result);
455 this->didCacheCopy(copyKey); 461 this->didCacheCopy(copyKey);
456 } 462 }
457 return result; 463 return result;
458 } 464 }
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after
492 determine_domain_mode(constraintRect, filterConstraint, coordsLimitedToC onstraintRect, 498 determine_domain_mode(constraintRect, filterConstraint, coordsLimitedToC onstraintRect,
493 texture->width(), texture->height(), nullptr, fmFo rDetermineDomain, 499 texture->width(), texture->height(), nullptr, fmFo rDetermineDomain,
494 &domain); 500 &domain);
495 SkASSERT(kTightCopy_DomainMode != domainMode); 501 SkASSERT(kTightCopy_DomainMode != domainMode);
496 SkMatrix normalizedTextureMatrix = textureMatrix; 502 SkMatrix normalizedTextureMatrix = textureMatrix;
497 normalizedTextureMatrix.postIDiv(texture->width(), texture->height()); 503 normalizedTextureMatrix.postIDiv(texture->width(), texture->height());
498 return create_fp_for_domain_and_filter(texture, normalizedTextureMatrix, dom ainMode, domain, 504 return create_fp_for_domain_and_filter(texture, normalizedTextureMatrix, dom ainMode, domain,
499 filterOrNullForBicubic); 505 filterOrNullForBicubic);
500 } 506 }
501 507
502 GrTexture* GrTextureMaker::generateTextureForParams(const CopyParams& copyParams ) { 508 GrTexture* GrTextureMaker::generateTextureForParams(const CopyParams& copyParams ,
503 SkAutoTUnref<GrTexture> original(this->refOriginalTexture()); 509 bool willBeMipped) {
510 SkAutoTUnref<GrTexture> original(this->refOriginalTexture(willBeMipped));
504 if (!original) { 511 if (!original) {
505 return nullptr; 512 return nullptr;
506 } 513 }
507 return copy_on_gpu(original, nullptr, copyParams); 514 return copy_on_gpu(original, nullptr, copyParams);
508 } 515 }
OLDNEW
« no previous file with comments | « src/gpu/GrTextureParamsAdjuster.h ('k') | src/gpu/GrTexturePriv.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698