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

Unified Diff: src/gpu/GrTextureParamsAdjuster.cpp

Issue 2037413002: Add SkSourceGammaTreatment enum so we know how to create mips (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: Remove leftover comments Created 4 years, 6 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 side-by-side diff with in-line comments
Download patch
Index: src/gpu/GrTextureParamsAdjuster.cpp
diff --git a/src/gpu/GrTextureParamsAdjuster.cpp b/src/gpu/GrTextureParamsAdjuster.cpp
index a91ba8a5e37e65199944393bc30767d60c919cbc..62b2912e0585bef54442b4afa58529c78d6f0b87 100644
--- a/src/gpu/GrTextureParamsAdjuster.cpp
+++ b/src/gpu/GrTextureParamsAdjuster.cpp
@@ -158,7 +158,7 @@ GrTexture* GrTextureAdjuster::refCopy(const CopyParams& copyParams) {
}
GrTexture* GrTextureAdjuster::refTextureSafeForParams(const GrTextureParams& params,
- SkIPoint* outOffset) {
+ bool gammaCorrect, SkIPoint* outOffset) {
GrTexture* texture = this->originalTexture();
GrContext* context = texture->getContext();
CopyParams copyParams;
@@ -373,7 +373,8 @@ const GrFragmentProcessor* GrTextureAdjuster::createFragmentProcessor(
const SkRect& origConstraintRect,
FilterConstraint filterConstraint,
bool coordsLimitedToConstraintRect,
- const GrTextureParams::FilterMode* filterOrNullForBicubic) {
+ const GrTextureParams::FilterMode* filterOrNullForBicubic,
+ bool gammaCorrect) {
SkMatrix textureMatrix = origTextureMatrix;
const SkIRect* contentArea = this->contentAreaOrNull();
@@ -392,7 +393,7 @@ const GrFragmentProcessor* GrTextureAdjuster::createFragmentProcessor(
if (filterOrNullForBicubic) {
params.setFilterMode(*filterOrNullForBicubic);
}
- SkAutoTUnref<GrTexture> texture(this->refTextureSafeForParams(params, nullptr));
+ SkAutoTUnref<GrTexture> texture(this->refTextureSafeForParams(params, gammaCorrect, nullptr));
if (!texture) {
return nullptr;
}
@@ -431,7 +432,7 @@ const GrFragmentProcessor* GrTextureAdjuster::createFragmentProcessor(
//////////////////////////////////////////////////////////////////////////////
-GrTexture* GrTextureMaker::refTextureForParams(const GrTextureParams& params) {
+GrTexture* GrTextureMaker::refTextureForParams(const GrTextureParams& params, bool gammaCorrect) {
CopyParams copyParams;
bool willBeMipped = params.filterMode() == GrTextureParams::kMipMap_FilterMode;
@@ -441,7 +442,7 @@ GrTexture* GrTextureMaker::refTextureForParams(const GrTextureParams& params) {
if (!fContext->getGpu()->makeCopyForTextureParams(this->width(), this->height(), params,
&copyParams)) {
- return this->refOriginalTexture(willBeMipped);
+ return this->refOriginalTexture(willBeMipped, gammaCorrect);
}
GrUniqueKey copyKey;
this->makeCopyKey(copyParams, &copyKey);
@@ -452,7 +453,7 @@ GrTexture* GrTextureMaker::refTextureForParams(const GrTextureParams& params) {
}
}
- GrTexture* result = this->generateTextureForParams(copyParams, willBeMipped);
+ GrTexture* result = this->generateTextureForParams(copyParams, willBeMipped, gammaCorrect);
if (!result) {
return nullptr;
}
@@ -469,7 +470,8 @@ const GrFragmentProcessor* GrTextureMaker::createFragmentProcessor(
const SkRect& constraintRect,
FilterConstraint filterConstraint,
bool coordsLimitedToConstraintRect,
- const GrTextureParams::FilterMode* filterOrNullForBicubic) {
+ const GrTextureParams::FilterMode* filterOrNullForBicubic,
+ bool gammaCorrect) {
const GrTextureParams::FilterMode* fmForDetermineDomain = filterOrNullForBicubic;
if (filterOrNullForBicubic && GrTextureParams::kMipMap_FilterMode == *filterOrNullForBicubic &&
@@ -490,7 +492,7 @@ const GrFragmentProcessor* GrTextureMaker::createFragmentProcessor(
// Bicubic doesn't use filtering for it's texture accesses.
params.reset(SkShader::kClamp_TileMode, GrTextureParams::kNone_FilterMode);
}
- SkAutoTUnref<GrTexture> texture(this->refTextureForParams(params));
+ SkAutoTUnref<GrTexture> texture(this->refTextureForParams(params, gammaCorrect));
if (!texture) {
return nullptr;
}
@@ -507,8 +509,8 @@ const GrFragmentProcessor* GrTextureMaker::createFragmentProcessor(
}
GrTexture* GrTextureMaker::generateTextureForParams(const CopyParams& copyParams,
- bool willBeMipped) {
- SkAutoTUnref<GrTexture> original(this->refOriginalTexture(willBeMipped));
+ bool willBeMipped, bool gammaCorrect) {
+ SkAutoTUnref<GrTexture> original(this->refOriginalTexture(willBeMipped, gammaCorrect));
if (!original) {
return nullptr;
}
« no previous file with comments | « src/gpu/GrTextureParamsAdjuster.h ('k') | src/gpu/SkGpuDevice.cpp » ('j') | src/gpu/SkGr.cpp » ('J')

Powered by Google App Engine
This is Rietveld 408576698