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

Unified Diff: cc/output/gl_renderer.cc

Issue 2738713003: color: Ensure that VideoResourceUpdater give consistent colors (Closed)
Patch Set: Rebase Created 3 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | cc/resources/video_resource_updater.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: cc/output/gl_renderer.cc
diff --git a/cc/output/gl_renderer.cc b/cc/output/gl_renderer.cc
index c8557607b3085a9f1aed152aab291a4490d0966a..a25c080a31a0a1f80491a7af5177e34928410803 100644
--- a/cc/output/gl_renderer.cc
+++ b/cc/output/gl_renderer.cc
@@ -2080,11 +2080,17 @@ void GLRenderer::DrawYUVVideoQuad(const YUVVideoDrawQuad* quad,
if (!src_color_space.IsValid())
src_color_space = gfx::ColorSpace::CreateREC709();
+ // The source color space should never be RGB.
+ DCHECK_NE(src_color_space, src_color_space.GetAsFullRangeRGB());
+
ResourceProvider::ScopedSamplerGL y_plane_lock(
resource_provider_, quad->y_plane_resource_id(), GL_TEXTURE1, GL_LINEAR);
+ if (base::FeatureList::IsEnabled(media::kVideoColorManagement))
+ DCHECK_EQ(src_color_space, y_plane_lock.color_space());
ResourceProvider::ScopedSamplerGL u_plane_lock(
resource_provider_, quad->u_plane_resource_id(), GL_TEXTURE2, GL_LINEAR);
DCHECK_EQ(y_plane_lock.target(), u_plane_lock.target());
+ DCHECK_EQ(y_plane_lock.color_space(), u_plane_lock.color_space());
// TODO(jbauman): Use base::Optional when available.
std::unique_ptr<ResourceProvider::ScopedSamplerGL> v_plane_lock;
@@ -2093,6 +2099,7 @@ void GLRenderer::DrawYUVVideoQuad(const YUVVideoDrawQuad* quad,
resource_provider_, quad->v_plane_resource_id(), GL_TEXTURE3,
GL_LINEAR));
DCHECK_EQ(y_plane_lock.target(), v_plane_lock->target());
+ DCHECK_EQ(y_plane_lock.color_space(), v_plane_lock->color_space());
}
std::unique_ptr<ResourceProvider::ScopedSamplerGL> a_plane_lock;
if (alpha_texture_mode == YUV_HAS_ALPHA_TEXTURE) {
@@ -2990,6 +2997,9 @@ void GLRenderer::SetUseProgram(const ProgramKey& program_key,
// performed.
// TODO(ccameron): Ensure that media mailboxes be accurate.
// https://crbug.com/699243
+ // The source color space for non-YUV draw quads should always be full-range
+ // RGB.
+ DCHECK_EQ(src_color_space, src_color_space.GetAsFullRangeRGB());
if (settings_->enable_color_correct_rendering) {
SetUseProgram(program_key, src_color_space,
current_frame()->current_render_pass->color_space);
« no previous file with comments | « no previous file | cc/resources/video_resource_updater.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698