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

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

Issue 2180803005: Add color gamut xform helpers to GrGLSLShaderBuilder (Closed) Base URL: https://skia.googlesource.com/skia.git@xform-storage
Patch Set: Rebase 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
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());
428 return create_fp_for_domain_and_filter(texture, std::move(colorSpaceXform), textureMatrix, 429 return create_fp_for_domain_and_filter(texture, std::move(colorSpaceXform), textureMatrix,
429 domainMode, domain, filterOrNullForBi cubic); 430 domainMode, domain, filterOrNullForBi cubic);
430 } 431 }
431 432
432 ////////////////////////////////////////////////////////////////////////////// 433 //////////////////////////////////////////////////////////////////////////////
433 434
434 GrTexture* GrTextureMaker::refTextureForParams(const GrTextureParams& params, 435 GrTexture* GrTextureMaker::refTextureForParams(const GrTextureParams& params,
435 SkSourceGammaTreatment gammaTreat ment) { 436 SkSourceGammaTreatment gammaTreat ment) {
436 CopyParams copyParams; 437 CopyParams copyParams;
437 bool willBeMipped = params.filterMode() == GrTextureParams::kMipMap_FilterMo de; 438 bool willBeMipped = params.filterMode() == GrTextureParams::kMipMap_FilterMo de;
(...skipping 61 matching lines...) Expand 10 before | Expand all | Expand 10 after
499 } 500 }
500 SkRect domain; 501 SkRect domain;
501 DomainMode domainMode = 502 DomainMode domainMode =
502 determine_domain_mode(constraintRect, filterConstraint, coordsLimitedToC onstraintRect, 503 determine_domain_mode(constraintRect, filterConstraint, coordsLimitedToC onstraintRect,
503 texture->width(), texture->height(), nullptr, fmFo rDetermineDomain, 504 texture->width(), texture->height(), nullptr, fmFo rDetermineDomain,
504 &domain); 505 &domain);
505 SkASSERT(kTightCopy_DomainMode != domainMode); 506 SkASSERT(kTightCopy_DomainMode != domainMode);
506 SkMatrix normalizedTextureMatrix = textureMatrix; 507 SkMatrix normalizedTextureMatrix = textureMatrix;
507 normalizedTextureMatrix.postIDiv(texture->width(), texture->height()); 508 normalizedTextureMatrix.postIDiv(texture->width(), texture->height());
508 sk_sp<GrColorSpaceXform> colorSpaceXform = GrColorSpaceXform::Make(this->get ColorSpace(), 509 sk_sp<GrColorSpaceXform> colorSpaceXform = GrColorSpaceXform::Make(this->get ColorSpace(),
509 dstColorS pace); 510 dstColorS pace,
511 this->alp haType());
510 return create_fp_for_domain_and_filter(texture, std::move(colorSpaceXform), 512 return create_fp_for_domain_and_filter(texture, std::move(colorSpaceXform),
511 normalizedTextureMatrix, domainMode, domain, 513 normalizedTextureMatrix, domainMode, domain,
512 filterOrNullForBicubic); 514 filterOrNullForBicubic);
513 } 515 }
514 516
515 GrTexture* GrTextureMaker::generateTextureForParams(const CopyParams& copyParams , bool willBeMipped, 517 GrTexture* GrTextureMaker::generateTextureForParams(const CopyParams& copyParams , bool willBeMipped,
516 SkSourceGammaTreatment gamma Treatment) { 518 SkSourceGammaTreatment gamma Treatment) {
517 SkAutoTUnref<GrTexture> original(this->refOriginalTexture(willBeMipped, gamm aTreatment)); 519 SkAutoTUnref<GrTexture> original(this->refOriginalTexture(willBeMipped, gamm aTreatment));
518 if (!original) { 520 if (!original) {
519 return nullptr; 521 return nullptr;
520 } 522 }
521 return copy_on_gpu(original, nullptr, copyParams); 523 return copy_on_gpu(original, nullptr, copyParams);
522 } 524 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698