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/GrYUVProvider.cpp

Issue 1830303002: Require sRGB write control for sRGB support. Add flag to GrPaint to suppress linear -> sRGB convers… (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: Added comment to srgbSupport() Created 4 years, 9 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
« no previous file with comments | « src/gpu/GrPipelineBuilder.cpp ('k') | src/gpu/gl/GrGLCaps.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 "GrContext.h" 8 #include "GrContext.h"
9 #include "GrDrawContext.h" 9 #include "GrDrawContext.h"
10 #include "GrYUVProvider.h" 10 #include "GrYUVProvider.h"
(...skipping 105 matching lines...) Expand 10 before | Expand all | Expand 10 after
116 SkAutoTUnref<GrTexture> result(ctx->textureProvider()->createTexture(rtDesc, SkBudgeted::kYes, 116 SkAutoTUnref<GrTexture> result(ctx->textureProvider()->createTexture(rtDesc, SkBudgeted::kYes,
117 nullptr , 0)); 117 nullptr , 0));
118 if (!result) { 118 if (!result) {
119 return nullptr; 119 return nullptr;
120 } 120 }
121 121
122 GrRenderTarget* renderTarget = result->asRenderTarget(); 122 GrRenderTarget* renderTarget = result->asRenderTarget();
123 SkASSERT(renderTarget); 123 SkASSERT(renderTarget);
124 124
125 GrPaint paint; 125 GrPaint paint;
126 // We may be decoding an sRGB image, but the result of our linear math on th e YUV planes
127 // is already in sRGB in that case. Don't convert (which will make the image too bright).
128 paint.setDisableOutputConversionToSRGB(true);
126 SkAutoTUnref<const GrFragmentProcessor> yuvToRgbProcessor( 129 SkAutoTUnref<const GrFragmentProcessor> yuvToRgbProcessor(
127 GrYUVEffect::CreateYUVToRGB(yuvTextures[ 0], 130 GrYUVEffect::CreateYUVToRGB(yuvTextures[ 0],
128 yuvTextures[ 1], 131 yuvTextures[ 1],
129 yuvTextures[ 2], 132 yuvTextures[ 2],
130 yuvInfo.fSiz eInfo.fSizes, 133 yuvInfo.fSiz eInfo.fSizes,
131 yuvInfo.fCol orSpace)); 134 yuvInfo.fCol orSpace));
132 paint.addColorFragmentProcessor(yuvToRgbProcessor); 135 paint.addColorFragmentProcessor(yuvToRgbProcessor);
133 paint.setPorterDuffXPFactory(SkXfermode::kSrc_Mode); 136 paint.setPorterDuffXPFactory(SkXfermode::kSrc_Mode);
134 const SkRect r = SkRect::MakeIWH(yuvInfo.fSizeInfo.fSizes[SkYUVSizeInfo::kY] .fWidth, 137 const SkRect r = SkRect::MakeIWH(yuvInfo.fSizeInfo.fSizes[SkYUVSizeInfo::kY] .fWidth,
135 yuvInfo.fSizeInfo.fSizes[SkYUVSizeInfo::kY].fHeight); 138 yuvInfo.fSizeInfo.fSizes[SkYUVSizeInfo::kY].fHeight);
136 139
137 SkAutoTUnref<GrDrawContext> drawContext(ctx->drawContext(renderTarget)); 140 SkAutoTUnref<GrDrawContext> drawContext(ctx->drawContext(renderTarget));
138 if (!drawContext) { 141 if (!drawContext) {
139 return nullptr; 142 return nullptr;
140 } 143 }
141 144
142 drawContext->drawRect(GrClip::WideOpen(), paint, SkMatrix::I(), r); 145 drawContext->drawRect(GrClip::WideOpen(), paint, SkMatrix::I(), r);
143 146
144 return result.release(); 147 return result.release();
145 } 148 }
146 149
OLDNEW
« no previous file with comments | « src/gpu/GrPipelineBuilder.cpp ('k') | src/gpu/gl/GrGLCaps.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698