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

Unified Diff: src/gpu/SkGr.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/SkGpuDevice_drawTexture.cpp ('k') | src/gpu/SkGrPriv.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/gpu/SkGr.cpp
diff --git a/src/gpu/SkGr.cpp b/src/gpu/SkGr.cpp
index 60736da5723e430237c6d8b18b60d2831deaf759..fb2916daff117fe697aa4633b5b50f70e2779272 100644
--- a/src/gpu/SkGr.cpp
+++ b/src/gpu/SkGr.cpp
@@ -329,7 +329,8 @@ void GrInstallBitmapUniqueKeyInvalidator(const GrUniqueKey& key, SkPixelRef* pix
pixelRef->addGenIDChangeListener(new Invalidator(key));
}
-GrTexture* GrGenerateMipMapsAndUploadToTexture(GrContext* ctx, const SkBitmap& bitmap)
+GrTexture* GrGenerateMipMapsAndUploadToTexture(GrContext* ctx, const SkBitmap& bitmap,
+ SkSourceGammaTreatment gammaTreatment)
{
GrSurfaceDesc desc = GrImageInfoToSurfaceDesc(bitmap.info(), *ctx->caps());
if (kIndex_8_SkColorType != bitmap.colorType() && !bitmap.readyToDraw()) {
@@ -403,11 +404,13 @@ GrTexture* GrUploadMipMapToTexture(GrContext* ctx, const SkImageInfo& info,
}
GrTexture* GrRefCachedBitmapTexture(GrContext* ctx, const SkBitmap& bitmap,
- const GrTextureParams& params) {
+ const GrTextureParams& params,
+ SkSourceGammaTreatment gammaTreatment) {
if (bitmap.getTexture()) {
- return GrBitmapTextureAdjuster(&bitmap).refTextureSafeForParams(params, nullptr);
+ return GrBitmapTextureAdjuster(&bitmap).refTextureSafeForParams(params, gammaTreatment,
+ nullptr);
}
- return GrBitmapTextureMaker(ctx, bitmap).refTextureForParams(params);
+ return GrBitmapTextureMaker(ctx, bitmap).refTextureForParams(params, gammaTreatment);
}
///////////////////////////////////////////////////////////////////////////////
@@ -519,8 +522,10 @@ static inline bool skpaint_to_grpaint_impl(GrContext* context,
if (shaderProcessor) {
shaderFP = *shaderProcessor;
} else if (const SkShader* shader = skPaint.getShader()) {
+ SkSourceGammaTreatment gammaTreatment = allowSRGBInputs
+ ? SkSourceGammaTreatment::kRespect : SkSourceGammaTreatment::kIgnore;
aufp.reset(shader->asFragmentProcessor(context, viewM, nullptr,
- skPaint.getFilterQuality()));
+ skPaint.getFilterQuality(), gammaTreatment));
shaderFP = aufp;
if (!shaderFP) {
return false;
@@ -689,10 +694,13 @@ bool SkPaintToGrPaintWithTexture(GrContext* context,
SkAutoTUnref<const GrFragmentProcessor> shaderFP;
if (textureIsAlphaOnly) {
if (const SkShader* shader = paint.getShader()) {
+ SkSourceGammaTreatment gammaTreatment = allowSRGBInputs
+ ? SkSourceGammaTreatment::kRespect : SkSourceGammaTreatment::kIgnore;
shaderFP.reset(shader->asFragmentProcessor(context,
viewM,
nullptr,
- paint.getFilterQuality()));
+ paint.getFilterQuality(),
+ gammaTreatment));
if (!shaderFP) {
return false;
}
« no previous file with comments | « src/gpu/SkGpuDevice_drawTexture.cpp ('k') | src/gpu/SkGrPriv.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698