static const GrTextureParams gParams(SkShader::kClamp_TileMode, kBilerp_FilterMode);
return gParams;
}
- static const GrTextureParams& ClampNoFilterForceAllowSRGB() {
- static const GrTextureParams gParams(SkShader::kClamp_TileMode, kNone_FilterMode,
- kForceAllowSRGB_SRGBMode);
- return gParams;
- }
GrTextureParams() {
this->reset();
kMipMap_FilterMode
};
- enum SRGBMode {
- kRespectDestination_SRGBMode,
- kForceAllowSRGB_SRGBMode,
- };
-
GrTextureParams(SkShader::TileMode tileXAndY, FilterMode filterMode) {
this->reset(tileXAndY, filterMode);
}
- GrTextureParams(SkShader::TileMode tileXandY, FilterMode filterMode, SRGBMode srgbMode) {
- this->reset(tileXandY, filterMode, srgbMode);
- }
-
GrTextureParams(const SkShader::TileMode tileModes[2], FilterMode filterMode) {
this->reset(tileModes, filterMode);
}
fTileModes[0] = params.fTileModes[0];
fTileModes[1] = params.fTileModes[1];
fFilterMode = params.fFilterMode;
- fSRGBMode = params.fSRGBMode;
return *this;
}
void reset(SkShader::TileMode tileXAndY, FilterMode filterMode) {
fTileModes[0] = fTileModes[1] = tileXAndY;
fFilterMode = filterMode;
- fSRGBMode = kRespectDestination_SRGBMode;
- }
-
- void reset(SkShader::TileMode tileXandY, FilterMode filterMode, SRGBMode srgbMode) {
- fTileModes[0] = fTileModes[1] = tileXandY;
- fFilterMode = filterMode;
- fSRGBMode = srgbMode;
}
void reset(const SkShader::TileMode tileModes[2], FilterMode filterMode) {
fTileModes[0] = tileModes[0];
fTileModes[1] = tileModes[1];
fFilterMode = filterMode;
- fSRGBMode = kRespectDestination_SRGBMode;
}
void setClampNoFilter() {
void setTileModeY(const SkShader::TileMode tm) { fTileModes[1] = tm; }
void setTileModeXAndY(const SkShader::TileMode tm) { fTileModes[0] = fTileModes[1] = tm; }
- void setSRGBMode(SRGBMode srgbMode) { fSRGBMode = srgbMode; }
-
SkShader::TileMode getTileModeX() const { return fTileModes[0]; }
SkShader::TileMode getTileModeY() const { return fTileModes[1]; }
FilterMode filterMode() const { return fFilterMode; }
- SRGBMode srgbMode() const { return fSRGBMode; }
-
bool operator== (const GrTextureParams& other) const {
return fTileModes[0] == other.fTileModes[0] &&
fTileModes[1] == other.fTileModes[1] &&
- fFilterMode == other.fFilterMode &&
- fSRGBMode == other.fSRGBMode;
+ fFilterMode == other.fFilterMode;
}
bool operator!= (const GrTextureParams& other) const { return !(*this == other); }
private:
SkShader::TileMode fTileModes[2];
FilterMode fFilterMode;
- SRGBMode fSRGBMode;
};
#endif
if (!drawContext) {
return false;
}
- // SRGBTODO: AllowSRGBInputs? (We could force it on here, so we don't need the
- // per-texture override in config conversion effect?)
GrPaint paint;
paint.addColorFragmentProcessor(fp);
paint.setPorterDuffXPFactory(SkXfermode::kSrc_Mode);
+ paint.setAllowSRGBInputs(true);
SkRect rect = SkRect::MakeWH(SkIntToScalar(width), SkIntToScalar(height));
drawContext->drawRect(GrNoClip(), paint, matrix, rect, nullptr);
GrConfigConversionEffect::kNone_PMConversion, textureMatrix));
}
if (fp) {
- // SRGBTODO: AllowSRGBInputs? (We could force it on here, so we don't need the
- // per-texture override in config conversion effect?)
GrPaint paint;
paint.addColorFragmentProcessor(fp);
paint.setPorterDuffXPFactory(SkXfermode::kSrc_Mode);
+ paint.setAllowSRGBInputs(true);
SkRect rect = SkRect::MakeWH(SkIntToScalar(width), SkIntToScalar(height));
sk_sp<GrDrawContext> drawContext(
this->drawContext(sk_ref_sp(temp->asRenderTarget())));
const GrSwizzle& swizzle,
PMConversion pmConversion,
const SkMatrix& matrix)
- : INHERITED(texture, matrix, GrTextureParams::ClampNoFilterForceAllowSRGB())
+ : INHERITED(texture, matrix)
, fSwizzle(swizzle)
, fPMConversion(pmConversion) {
this->initClassID<GrConfigConversionEffect>();
// If we returned a GrConfigConversionEffect that was equivalent to a GrSimpleTextureEffect
// then we may pollute our texture cache with redundant shaders. So in the case that no
// conversions were requested we instead return a GrSimpleTextureEffect.
- return GrSimpleTextureEffect::Create(texture, matrix,
- GrTextureParams::ClampNoFilterForceAllowSRGB());
+ return GrSimpleTextureEffect::Create(texture, matrix);
} else {
if (kRGBA_8888_GrPixelConfig != texture->config() &&
kBGRA_8888_GrPixelConfig != texture->config() &&
}
}
-void GrGLGpu::bindTexture(int unitIdx, const GrTextureParams& params, bool dstConfigAllowsSRGB,
+void GrGLGpu::bindTexture(int unitIdx, const GrTextureParams& params, bool allowSRGBInputs,
GrGLTexture* texture) {
SkASSERT(texture);
if (this->caps()->srgbSupport()) {
// By default, the decision to allow SRGB decode is based on the destination config.
// A texture can override that by specifying a value in GrTextureParams.
- newTexParams.fSRGBDecode =
- (dstConfigAllowsSRGB || GrTextureParams::kForceAllowSRGB_SRGBMode == params.srgbMode())
- ? GR_GL_DECODE_EXT : GR_GL_SKIP_DECODE_EXT;
+ newTexParams.fSRGBDecode = allowSRGBInputs ? GR_GL_DECODE_EXT : GR_GL_SKIP_DECODE_EXT;
if (setAll || newTexParams.fSRGBDecode != oldTexParams.fSRGBDecode) {
this->setTextureUnit(unitIdx);
void discard(GrRenderTarget*) override;
// Used by GrGLProgram to configure OpenGL state.
- void bindTexture(int unitIdx, const GrTextureParams& params, bool dstConfigAllowsSRGB,
+ void bindTexture(int unitIdx, const GrTextureParams& params, bool allowSRGBInputs,
GrGLTexture* texture);
void bindTexelBuffer(int unitIdx, intptr_t offsetInBytes, GrPixelConfig, GrGLBuffer*);