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

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

Issue 2329553002: Cleanup GPU gamut transformation code (Closed)
Patch Set: Switch from float[16] to SkMatrix44 Created 4 years, 3 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/GrColorSpaceXform.cpp ('k') | src/gpu/SkGpuDevice.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 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 406 matching lines...) Expand 10 before | Expand all | Expand 10 after
417 domainMode = 417 domainMode =
418 determine_domain_mode(*constraintRect, filterConstraint, coordsLimit edToConstraintRect, 418 determine_domain_mode(*constraintRect, filterConstraint, coordsLimit edToConstraintRect,
419 texture->width(), texture->height(), 419 texture->width(), texture->height(),
420 contentArea, &kBilerp, &domain); 420 contentArea, &kBilerp, &domain);
421 SkASSERT(kTightCopy_DomainMode != domainMode); 421 SkASSERT(kTightCopy_DomainMode != domainMode);
422 } 422 }
423 SkASSERT(kNoDomain_DomainMode == domainMode || 423 SkASSERT(kNoDomain_DomainMode == domainMode ||
424 (domain.fLeft <= domain.fRight && domain.fTop <= domain.fBottom)); 424 (domain.fLeft <= domain.fRight && domain.fTop <= domain.fBottom));
425 textureMatrix.postIDiv(texture->width(), texture->height()); 425 textureMatrix.postIDiv(texture->width(), texture->height());
426 sk_sp<GrColorSpaceXform> colorSpaceXform = GrColorSpaceXform::Make(this->get ColorSpace(), 426 sk_sp<GrColorSpaceXform> colorSpaceXform = GrColorSpaceXform::Make(this->get ColorSpace(),
427 dstColorS pace, 427 dstColorS pace);
428 this->alp haType());
429 return create_fp_for_domain_and_filter(texture, std::move(colorSpaceXform), textureMatrix, 428 return create_fp_for_domain_and_filter(texture, std::move(colorSpaceXform), textureMatrix,
430 domainMode, domain, filterOrNullForBi cubic); 429 domainMode, domain, filterOrNullForBi cubic);
431 } 430 }
432 431
433 ////////////////////////////////////////////////////////////////////////////// 432 //////////////////////////////////////////////////////////////////////////////
434 433
435 GrTexture* GrTextureMaker::refTextureForParams(const GrTextureParams& params, 434 GrTexture* GrTextureMaker::refTextureForParams(const GrTextureParams& params,
436 SkSourceGammaTreatment gammaTreat ment) { 435 SkSourceGammaTreatment gammaTreat ment) {
437 CopyParams copyParams; 436 CopyParams copyParams;
438 bool willBeMipped = params.filterMode() == GrTextureParams::kMipMap_FilterMo de; 437 bool willBeMipped = params.filterMode() == GrTextureParams::kMipMap_FilterMo de;
(...skipping 61 matching lines...) Expand 10 before | Expand all | Expand 10 after
500 } 499 }
501 SkRect domain; 500 SkRect domain;
502 DomainMode domainMode = 501 DomainMode domainMode =
503 determine_domain_mode(constraintRect, filterConstraint, coordsLimitedToC onstraintRect, 502 determine_domain_mode(constraintRect, filterConstraint, coordsLimitedToC onstraintRect,
504 texture->width(), texture->height(), nullptr, fmFo rDetermineDomain, 503 texture->width(), texture->height(), nullptr, fmFo rDetermineDomain,
505 &domain); 504 &domain);
506 SkASSERT(kTightCopy_DomainMode != domainMode); 505 SkASSERT(kTightCopy_DomainMode != domainMode);
507 SkMatrix normalizedTextureMatrix = textureMatrix; 506 SkMatrix normalizedTextureMatrix = textureMatrix;
508 normalizedTextureMatrix.postIDiv(texture->width(), texture->height()); 507 normalizedTextureMatrix.postIDiv(texture->width(), texture->height());
509 sk_sp<GrColorSpaceXform> colorSpaceXform = GrColorSpaceXform::Make(this->get ColorSpace(), 508 sk_sp<GrColorSpaceXform> colorSpaceXform = GrColorSpaceXform::Make(this->get ColorSpace(),
510 dstColorS pace, 509 dstColorS pace);
511 this->alp haType());
512 return create_fp_for_domain_and_filter(texture, std::move(colorSpaceXform), 510 return create_fp_for_domain_and_filter(texture, std::move(colorSpaceXform),
513 normalizedTextureMatrix, domainMode, domain, 511 normalizedTextureMatrix, domainMode, domain,
514 filterOrNullForBicubic); 512 filterOrNullForBicubic);
515 } 513 }
516 514
517 GrTexture* GrTextureMaker::generateTextureForParams(const CopyParams& copyParams , bool willBeMipped, 515 GrTexture* GrTextureMaker::generateTextureForParams(const CopyParams& copyParams , bool willBeMipped,
518 SkSourceGammaTreatment gamma Treatment) { 516 SkSourceGammaTreatment gamma Treatment) {
519 SkAutoTUnref<GrTexture> original(this->refOriginalTexture(willBeMipped, gamm aTreatment)); 517 SkAutoTUnref<GrTexture> original(this->refOriginalTexture(willBeMipped, gamm aTreatment));
520 if (!original) { 518 if (!original) {
521 return nullptr; 519 return nullptr;
522 } 520 }
523 return copy_on_gpu(original, nullptr, copyParams); 521 return copy_on_gpu(original, nullptr, copyParams);
524 } 522 }
OLDNEW
« no previous file with comments | « src/gpu/GrColorSpaceXform.cpp ('k') | src/gpu/SkGpuDevice.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698