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

Side by Side Diff: cc/output/renderer_settings.cc

Issue 2328133002: Add cc::LayerTreeSettings for color correct rendering (Closed)
Patch Set: Created 4 years, 3 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
OLDNEW
1 // Copyright 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 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/renderer_settings.h" 5 #include "cc/output/renderer_settings.h"
6 6
7 #include <limits> 7 #include <limits>
8 8
9 #include "base/logging.h" 9 #include "base/logging.h"
10 #include "cc/proto/renderer_settings.pb.h" 10 #include "cc/proto/renderer_settings.pb.h"
11 #include "cc/resources/platform_color.h" 11 #include "cc/resources/platform_color.h"
12 12
13 namespace cc { 13 namespace cc {
14 14
15 RendererSettings::RendererSettings() 15 RendererSettings::RendererSettings()
16 : allow_antialiasing(true), 16 : allow_antialiasing(true),
17 force_antialiasing(false), 17 force_antialiasing(false),
18 force_blending_with_shaders(false), 18 force_blending_with_shaders(false),
19 partial_swap_enabled(false), 19 partial_swap_enabled(false),
20 finish_rendering_on_resize(false), 20 finish_rendering_on_resize(false),
21 should_clear_root_render_pass(true), 21 should_clear_root_render_pass(true),
22 disable_display_vsync(false), 22 disable_display_vsync(false),
23 release_overlay_resources_after_gpu_query(false), 23 release_overlay_resources_after_gpu_query(false),
24 gl_composited_texture_quad_border(false), 24 gl_composited_texture_quad_border(false),
25 refresh_rate(60.0), 25 refresh_rate(60.0),
26 highp_threshold_min(0), 26 highp_threshold_min(0),
27 texture_id_allocation_chunk_size(64), 27 texture_id_allocation_chunk_size(64),
28 use_gpu_memory_buffer_resources(false), 28 use_gpu_memory_buffer_resources(false),
29 enable_color_correct_rendering(false),
29 preferred_tile_format(PlatformColor::BestTextureFormat()) {} 30 preferred_tile_format(PlatformColor::BestTextureFormat()) {}
30 31
31 RendererSettings::RendererSettings(const RendererSettings& other) = default; 32 RendererSettings::RendererSettings(const RendererSettings& other) = default;
32 33
33 RendererSettings::~RendererSettings() { 34 RendererSettings::~RendererSettings() {
34 } 35 }
35 36
36 void RendererSettings::ToProtobuf(proto::RendererSettings* proto) const { 37 void RendererSettings::ToProtobuf(proto::RendererSettings* proto) const {
37 proto->set_allow_antialiasing(allow_antialiasing); 38 proto->set_allow_antialiasing(allow_antialiasing);
38 proto->set_force_antialiasing(force_antialiasing); 39 proto->set_force_antialiasing(force_antialiasing);
39 proto->set_force_blending_with_shaders(force_blending_with_shaders); 40 proto->set_force_blending_with_shaders(force_blending_with_shaders);
40 proto->set_partial_swap_enabled(partial_swap_enabled); 41 proto->set_partial_swap_enabled(partial_swap_enabled);
41 proto->set_finish_rendering_on_resize(finish_rendering_on_resize); 42 proto->set_finish_rendering_on_resize(finish_rendering_on_resize);
42 proto->set_should_clear_root_render_pass(should_clear_root_render_pass); 43 proto->set_should_clear_root_render_pass(should_clear_root_render_pass);
43 proto->set_disable_display_vsync(disable_display_vsync); 44 proto->set_disable_display_vsync(disable_display_vsync);
44 proto->set_release_overlay_resources_after_gpu_query( 45 proto->set_release_overlay_resources_after_gpu_query(
45 release_overlay_resources_after_gpu_query); 46 release_overlay_resources_after_gpu_query);
46 proto->set_refresh_rate(refresh_rate); 47 proto->set_refresh_rate(refresh_rate);
47 proto->set_highp_threshold_min(highp_threshold_min); 48 proto->set_highp_threshold_min(highp_threshold_min);
48 proto->set_texture_id_allocation_chunk_size(texture_id_allocation_chunk_size); 49 proto->set_texture_id_allocation_chunk_size(texture_id_allocation_chunk_size);
49 proto->set_use_gpu_memory_buffer_resources(use_gpu_memory_buffer_resources); 50 proto->set_use_gpu_memory_buffer_resources(use_gpu_memory_buffer_resources);
51 proto->set_enable_color_correct_rendering(enable_color_correct_rendering);
50 proto->set_preferred_tile_format(preferred_tile_format); 52 proto->set_preferred_tile_format(preferred_tile_format);
51 53
52 for (const auto& target : buffer_to_texture_target_map) { 54 for (const auto& target : buffer_to_texture_target_map) {
53 auto* proto_target = proto->add_buffer_to_texture_target(); 55 auto* proto_target = proto->add_buffer_to_texture_target();
54 proto_target->set_buffer_usage(static_cast<uint32_t>(target.first.first)); 56 proto_target->set_buffer_usage(static_cast<uint32_t>(target.first.first));
55 proto_target->set_buffer_format(static_cast<uint32_t>(target.first.second)); 57 proto_target->set_buffer_format(static_cast<uint32_t>(target.first.second));
56 proto_target->set_texture_target(target.second); 58 proto_target->set_texture_target(target.second);
57 } 59 }
58 } 60 }
59 61
60 void RendererSettings::FromProtobuf(const proto::RendererSettings& proto) { 62 void RendererSettings::FromProtobuf(const proto::RendererSettings& proto) {
61 allow_antialiasing = proto.allow_antialiasing(); 63 allow_antialiasing = proto.allow_antialiasing();
62 force_antialiasing = proto.force_antialiasing(); 64 force_antialiasing = proto.force_antialiasing();
63 force_blending_with_shaders = proto.force_blending_with_shaders(); 65 force_blending_with_shaders = proto.force_blending_with_shaders();
64 partial_swap_enabled = proto.partial_swap_enabled(); 66 partial_swap_enabled = proto.partial_swap_enabled();
65 finish_rendering_on_resize = proto.finish_rendering_on_resize(); 67 finish_rendering_on_resize = proto.finish_rendering_on_resize();
66 should_clear_root_render_pass = proto.should_clear_root_render_pass(); 68 should_clear_root_render_pass = proto.should_clear_root_render_pass();
67 disable_display_vsync = proto.disable_display_vsync(); 69 disable_display_vsync = proto.disable_display_vsync();
68 release_overlay_resources_after_gpu_query = 70 release_overlay_resources_after_gpu_query =
69 proto.release_overlay_resources_after_gpu_query(); 71 proto.release_overlay_resources_after_gpu_query();
70 refresh_rate = proto.refresh_rate(); 72 refresh_rate = proto.refresh_rate();
71 highp_threshold_min = proto.highp_threshold_min(); 73 highp_threshold_min = proto.highp_threshold_min();
72 texture_id_allocation_chunk_size = proto.texture_id_allocation_chunk_size(); 74 texture_id_allocation_chunk_size = proto.texture_id_allocation_chunk_size();
73 use_gpu_memory_buffer_resources = proto.use_gpu_memory_buffer_resources(); 75 use_gpu_memory_buffer_resources = proto.use_gpu_memory_buffer_resources();
76 enable_color_correct_rendering = proto.enable_color_correct_rendering();
74 77
75 DCHECK_LE(proto.preferred_tile_format(), 78 DCHECK_LE(proto.preferred_tile_format(),
76 static_cast<uint32_t>(RESOURCE_FORMAT_MAX)); 79 static_cast<uint32_t>(RESOURCE_FORMAT_MAX));
77 preferred_tile_format = 80 preferred_tile_format =
78 static_cast<ResourceFormat>(proto.preferred_tile_format()); 81 static_cast<ResourceFormat>(proto.preferred_tile_format());
79 82
80 // |buffer_to_texture_target_map| may contain existing values, so clear first. 83 // |buffer_to_texture_target_map| may contain existing values, so clear first.
81 buffer_to_texture_target_map.clear(); 84 buffer_to_texture_target_map.clear();
82 for (const auto& proto_target : proto.buffer_to_texture_target()) { 85 for (const auto& proto_target : proto.buffer_to_texture_target()) {
83 buffer_to_texture_target_map.insert(BufferToTextureTargetMap::value_type( 86 buffer_to_texture_target_map.insert(BufferToTextureTargetMap::value_type(
(...skipping 13 matching lines...) Expand all
97 should_clear_root_render_pass == other.should_clear_root_render_pass && 100 should_clear_root_render_pass == other.should_clear_root_render_pass &&
98 disable_display_vsync == other.disable_display_vsync && 101 disable_display_vsync == other.disable_display_vsync &&
99 release_overlay_resources_after_gpu_query == 102 release_overlay_resources_after_gpu_query ==
100 other.release_overlay_resources_after_gpu_query && 103 other.release_overlay_resources_after_gpu_query &&
101 refresh_rate == other.refresh_rate && 104 refresh_rate == other.refresh_rate &&
102 highp_threshold_min == other.highp_threshold_min && 105 highp_threshold_min == other.highp_threshold_min &&
103 texture_id_allocation_chunk_size == 106 texture_id_allocation_chunk_size ==
104 other.texture_id_allocation_chunk_size && 107 other.texture_id_allocation_chunk_size &&
105 use_gpu_memory_buffer_resources == 108 use_gpu_memory_buffer_resources ==
106 other.use_gpu_memory_buffer_resources && 109 other.use_gpu_memory_buffer_resources &&
110 enable_color_correct_rendering ==
111 other.enable_color_correct_rendering &&
107 preferred_tile_format == other.preferred_tile_format && 112 preferred_tile_format == other.preferred_tile_format &&
108 buffer_to_texture_target_map == other.buffer_to_texture_target_map; 113 buffer_to_texture_target_map == other.buffer_to_texture_target_map;
109 } 114 }
110 115
111 } // namespace cc 116 } // namespace cc
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698