| OLD | NEW |
| 1 // Copyright 2010 The Chromium Authors. All rights reserved. | 1 // Copyright 2010 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #include "cc/output/gl_renderer.h" | 5 #include "cc/output/gl_renderer.h" |
| 6 | 6 |
| 7 #include <stddef.h> | 7 #include <stddef.h> |
| 8 #include <stdint.h> | 8 #include <stdint.h> |
| 9 | 9 |
| 10 #include <algorithm> | 10 #include <algorithm> |
| (...skipping 2986 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2997 void GLRenderer::SetUseProgram(const ProgramKey& program_key, | 2997 void GLRenderer::SetUseProgram(const ProgramKey& program_key, |
| 2998 const gfx::ColorSpace& src_color_space) { | 2998 const gfx::ColorSpace& src_color_space) { |
| 2999 // Ensure that we do not apply any color conversion unless the color correct | 2999 // Ensure that we do not apply any color conversion unless the color correct |
| 3000 // rendering flag has been specified. This is because media mailboxes will | 3000 // rendering flag has been specified. This is because media mailboxes will |
| 3001 // provide YUV color spaces despite YUV to RGB conversion already having been | 3001 // provide YUV color spaces despite YUV to RGB conversion already having been |
| 3002 // performed. | 3002 // performed. |
| 3003 // TODO(ccameron): Ensure that media mailboxes be accurate. | 3003 // TODO(ccameron): Ensure that media mailboxes be accurate. |
| 3004 // https://crbug.com/699243 | 3004 // https://crbug.com/699243 |
| 3005 // The source color space for non-YUV draw quads should always be full-range | 3005 // The source color space for non-YUV draw quads should always be full-range |
| 3006 // RGB. | 3006 // RGB. |
| 3007 DCHECK_EQ(src_color_space, src_color_space.GetAsFullRangeRGB()); | |
| 3008 if (settings_->enable_color_correct_rendering) { | 3007 if (settings_->enable_color_correct_rendering) { |
| 3009 SetUseProgram(program_key, src_color_space, | 3008 SetUseProgram(program_key, src_color_space, |
| 3010 current_frame()->current_render_pass->color_space); | 3009 current_frame()->current_render_pass->color_space); |
| 3011 } else { | 3010 } else { |
| 3011 DCHECK_EQ(src_color_space, src_color_space.GetAsFullRangeRGB()); |
| 3012 SetUseProgram(program_key, gfx::ColorSpace(), gfx::ColorSpace()); | 3012 SetUseProgram(program_key, gfx::ColorSpace(), gfx::ColorSpace()); |
| 3013 } | 3013 } |
| 3014 } | 3014 } |
| 3015 | 3015 |
| 3016 void GLRenderer::SetUseProgram(const ProgramKey& program_key_no_color, | 3016 void GLRenderer::SetUseProgram(const ProgramKey& program_key_no_color, |
| 3017 const gfx::ColorSpace& src_color_space, | 3017 const gfx::ColorSpace& src_color_space, |
| 3018 const gfx::ColorSpace& dst_color_space) { | 3018 const gfx::ColorSpace& dst_color_space) { |
| 3019 ProgramKey program_key = program_key_no_color; | 3019 ProgramKey program_key = program_key_no_color; |
| 3020 const gfx::ColorTransform* color_transform = | 3020 const gfx::ColorTransform* color_transform = |
| 3021 GetColorTransform(src_color_space, dst_color_space); | 3021 GetColorTransform(src_color_space, dst_color_space); |
| (...skipping 564 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3586 return; | 3586 return; |
| 3587 | 3587 |
| 3588 // Report GPU overdraw as a percentage of |max_result|. | 3588 // Report GPU overdraw as a percentage of |max_result|. |
| 3589 TRACE_COUNTER1( | 3589 TRACE_COUNTER1( |
| 3590 TRACE_DISABLED_BY_DEFAULT("cc.debug.overdraw"), "GPU Overdraw", | 3590 TRACE_DISABLED_BY_DEFAULT("cc.debug.overdraw"), "GPU Overdraw", |
| 3591 (std::accumulate(overdraw->begin(), overdraw->end(), 0) * 100) / | 3591 (std::accumulate(overdraw->begin(), overdraw->end(), 0) * 100) / |
| 3592 max_result); | 3592 max_result); |
| 3593 } | 3593 } |
| 3594 | 3594 |
| 3595 } // namespace cc | 3595 } // namespace cc |
| OLD | NEW |