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

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: Fix DM compilation 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
« no previous file with comments | « src/gpu/GrTextureParamsAdjuster.h ('k') | src/gpu/SkGpuDevice.cpp » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/gpu/GrTextureParamsAdjuster.cpp
diff --git a/src/gpu/GrTextureParamsAdjuster.cpp b/src/gpu/GrTextureParamsAdjuster.cpp
index a91ba8a5e37e65199944393bc30767d60c919cbc..076750ee5a9c530c06d85fc9f565aad9ac35cde2 100644
--- a/src/gpu/GrTextureParamsAdjuster.cpp
+++ b/src/gpu/GrTextureParamsAdjuster.cpp
@@ -158,6 +158,7 @@ GrTexture* GrTextureAdjuster::refCopy(const CopyParams& copyParams) {
}
GrTexture* GrTextureAdjuster::refTextureSafeForParams(const GrTextureParams& params,
+ SkSourceGammaTreatment gammaTreatment,
SkIPoint* outOffset) {
GrTexture* texture = this->originalTexture();
GrContext* context = texture->getContext();
@@ -373,7 +374,8 @@ const GrFragmentProcessor* GrTextureAdjuster::createFragmentProcessor(
const SkRect& origConstraintRect,
FilterConstraint filterConstraint,
bool coordsLimitedToConstraintRect,
- const GrTextureParams::FilterMode* filterOrNullForBicubic) {
+ const GrTextureParams::FilterMode* filterOrNullForBicubic,
+ SkSourceGammaTreatment gammaTreatment) {
SkMatrix textureMatrix = origTextureMatrix;
const SkIRect* contentArea = this->contentAreaOrNull();
@@ -392,7 +394,7 @@ const GrFragmentProcessor* GrTextureAdjuster::createFragmentProcessor(
if (filterOrNullForBicubic) {
params.setFilterMode(*filterOrNullForBicubic);
}
- SkAutoTUnref<GrTexture> texture(this->refTextureSafeForParams(params, nullptr));
+ SkAutoTUnref<GrTexture> texture(this->refTextureSafeForParams(params, gammaTreatment, nullptr));
if (!texture) {
return nullptr;
}
@@ -431,7 +433,8 @@ const GrFragmentProcessor* GrTextureAdjuster::createFragmentProcessor(
//////////////////////////////////////////////////////////////////////////////
-GrTexture* GrTextureMaker::refTextureForParams(const GrTextureParams& params) {
+GrTexture* GrTextureMaker::refTextureForParams(const GrTextureParams& params,
+ SkSourceGammaTreatment gammaTreatment) {
CopyParams copyParams;
bool willBeMipped = params.filterMode() == GrTextureParams::kMipMap_FilterMode;
@@ -441,7 +444,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, gammaTreatment);
}
GrUniqueKey copyKey;
this->makeCopyKey(copyParams, &copyKey);
@@ -452,7 +455,7 @@ GrTexture* GrTextureMaker::refTextureForParams(const GrTextureParams& params) {
}
}
- GrTexture* result = this->generateTextureForParams(copyParams, willBeMipped);
+ GrTexture* result = this->generateTextureForParams(copyParams, willBeMipped, gammaTreatment);
if (!result) {
return nullptr;
}
@@ -469,7 +472,8 @@ const GrFragmentProcessor* GrTextureMaker::createFragmentProcessor(
const SkRect& constraintRect,
FilterConstraint filterConstraint,
bool coordsLimitedToConstraintRect,
- const GrTextureParams::FilterMode* filterOrNullForBicubic) {
+ const GrTextureParams::FilterMode* filterOrNullForBicubic,
+ SkSourceGammaTreatment gammaTreatment) {
const GrTextureParams::FilterMode* fmForDetermineDomain = filterOrNullForBicubic;
if (filterOrNullForBicubic && GrTextureParams::kMipMap_FilterMode == *filterOrNullForBicubic &&
@@ -490,7 +494,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, gammaTreatment));
if (!texture) {
return nullptr;
}
@@ -506,9 +510,9 @@ const GrFragmentProcessor* GrTextureMaker::createFragmentProcessor(
filterOrNullForBicubic);
}
-GrTexture* GrTextureMaker::generateTextureForParams(const CopyParams& copyParams,
- bool willBeMipped) {
- SkAutoTUnref<GrTexture> original(this->refOriginalTexture(willBeMipped));
+GrTexture* GrTextureMaker::generateTextureForParams(const CopyParams& copyParams, bool willBeMipped,
+ SkSourceGammaTreatment gammaTreatment) {
+ SkAutoTUnref<GrTexture> original(this->refOriginalTexture(willBeMipped, gammaTreatment));
if (!original) {
return nullptr;
}
« no previous file with comments | « src/gpu/GrTextureParamsAdjuster.h ('k') | src/gpu/SkGpuDevice.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698