OLD | NEW |
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_on_swap_complete(false), | 23 release_overlay_resources_after_gpu_query(false), |
24 refresh_rate(60.0), | 24 refresh_rate(60.0), |
25 highp_threshold_min(0), | 25 highp_threshold_min(0), |
26 texture_id_allocation_chunk_size(64), | 26 texture_id_allocation_chunk_size(64), |
27 use_gpu_memory_buffer_resources(false), | 27 use_gpu_memory_buffer_resources(false), |
28 preferred_tile_format(PlatformColor::BestTextureFormat()) {} | 28 preferred_tile_format(PlatformColor::BestTextureFormat()) {} |
29 | 29 |
30 RendererSettings::RendererSettings(const RendererSettings& other) = default; | 30 RendererSettings::RendererSettings(const RendererSettings& other) = default; |
31 | 31 |
32 RendererSettings::~RendererSettings() { | 32 RendererSettings::~RendererSettings() { |
33 } | 33 } |
34 | 34 |
35 void RendererSettings::ToProtobuf(proto::RendererSettings* proto) const { | 35 void RendererSettings::ToProtobuf(proto::RendererSettings* proto) const { |
36 proto->set_allow_antialiasing(allow_antialiasing); | 36 proto->set_allow_antialiasing(allow_antialiasing); |
37 proto->set_force_antialiasing(force_antialiasing); | 37 proto->set_force_antialiasing(force_antialiasing); |
38 proto->set_force_blending_with_shaders(force_blending_with_shaders); | 38 proto->set_force_blending_with_shaders(force_blending_with_shaders); |
39 proto->set_partial_swap_enabled(partial_swap_enabled); | 39 proto->set_partial_swap_enabled(partial_swap_enabled); |
40 proto->set_finish_rendering_on_resize(finish_rendering_on_resize); | 40 proto->set_finish_rendering_on_resize(finish_rendering_on_resize); |
41 proto->set_should_clear_root_render_pass(should_clear_root_render_pass); | 41 proto->set_should_clear_root_render_pass(should_clear_root_render_pass); |
42 proto->set_disable_display_vsync(disable_display_vsync); | 42 proto->set_disable_display_vsync(disable_display_vsync); |
43 proto->set_release_overlay_resources_on_swap_complete( | 43 proto->set_release_overlay_resources_after_gpu_query( |
44 release_overlay_resources_on_swap_complete); | 44 release_overlay_resources_after_gpu_query); |
45 proto->set_refresh_rate(refresh_rate); | 45 proto->set_refresh_rate(refresh_rate); |
46 proto->set_highp_threshold_min(highp_threshold_min); | 46 proto->set_highp_threshold_min(highp_threshold_min); |
47 proto->set_texture_id_allocation_chunk_size(texture_id_allocation_chunk_size); | 47 proto->set_texture_id_allocation_chunk_size(texture_id_allocation_chunk_size); |
48 proto->set_use_gpu_memory_buffer_resources(use_gpu_memory_buffer_resources); | 48 proto->set_use_gpu_memory_buffer_resources(use_gpu_memory_buffer_resources); |
49 proto->set_preferred_tile_format(preferred_tile_format); | 49 proto->set_preferred_tile_format(preferred_tile_format); |
50 } | 50 } |
51 | 51 |
52 void RendererSettings::FromProtobuf(const proto::RendererSettings& proto) { | 52 void RendererSettings::FromProtobuf(const proto::RendererSettings& proto) { |
53 allow_antialiasing = proto.allow_antialiasing(); | 53 allow_antialiasing = proto.allow_antialiasing(); |
54 force_antialiasing = proto.force_antialiasing(); | 54 force_antialiasing = proto.force_antialiasing(); |
55 force_blending_with_shaders = proto.force_blending_with_shaders(); | 55 force_blending_with_shaders = proto.force_blending_with_shaders(); |
56 partial_swap_enabled = proto.partial_swap_enabled(); | 56 partial_swap_enabled = proto.partial_swap_enabled(); |
57 finish_rendering_on_resize = proto.finish_rendering_on_resize(); | 57 finish_rendering_on_resize = proto.finish_rendering_on_resize(); |
58 should_clear_root_render_pass = proto.should_clear_root_render_pass(); | 58 should_clear_root_render_pass = proto.should_clear_root_render_pass(); |
59 disable_display_vsync = proto.disable_display_vsync(); | 59 disable_display_vsync = proto.disable_display_vsync(); |
60 release_overlay_resources_on_swap_complete = | 60 release_overlay_resources_after_gpu_query = |
61 proto.release_overlay_resources_on_swap_complete(); | 61 proto.release_overlay_resources_after_gpu_query(); |
62 refresh_rate = proto.refresh_rate(); | 62 refresh_rate = proto.refresh_rate(); |
63 highp_threshold_min = proto.highp_threshold_min(); | 63 highp_threshold_min = proto.highp_threshold_min(); |
64 texture_id_allocation_chunk_size = proto.texture_id_allocation_chunk_size(); | 64 texture_id_allocation_chunk_size = proto.texture_id_allocation_chunk_size(); |
65 use_gpu_memory_buffer_resources = proto.use_gpu_memory_buffer_resources(); | 65 use_gpu_memory_buffer_resources = proto.use_gpu_memory_buffer_resources(); |
66 | 66 |
67 DCHECK_LE(proto.preferred_tile_format(), | 67 DCHECK_LE(proto.preferred_tile_format(), |
68 static_cast<uint32_t>(RESOURCE_FORMAT_MAX)); | 68 static_cast<uint32_t>(RESOURCE_FORMAT_MAX)); |
69 preferred_tile_format = | 69 preferred_tile_format = |
70 static_cast<ResourceFormat>(proto.preferred_tile_format()); | 70 static_cast<ResourceFormat>(proto.preferred_tile_format()); |
71 } | 71 } |
72 | 72 |
73 bool RendererSettings::operator==(const RendererSettings& other) const { | 73 bool RendererSettings::operator==(const RendererSettings& other) const { |
74 return allow_antialiasing == other.allow_antialiasing && | 74 return allow_antialiasing == other.allow_antialiasing && |
75 force_antialiasing == other.force_antialiasing && | 75 force_antialiasing == other.force_antialiasing && |
76 force_blending_with_shaders == other.force_blending_with_shaders && | 76 force_blending_with_shaders == other.force_blending_with_shaders && |
77 partial_swap_enabled == other.partial_swap_enabled && | 77 partial_swap_enabled == other.partial_swap_enabled && |
78 finish_rendering_on_resize == other.finish_rendering_on_resize && | 78 finish_rendering_on_resize == other.finish_rendering_on_resize && |
79 should_clear_root_render_pass == other.should_clear_root_render_pass && | 79 should_clear_root_render_pass == other.should_clear_root_render_pass && |
80 disable_display_vsync == other.disable_display_vsync && | 80 disable_display_vsync == other.disable_display_vsync && |
81 release_overlay_resources_on_swap_complete == | 81 release_overlay_resources_after_gpu_query == |
82 other.release_overlay_resources_on_swap_complete && | 82 other.release_overlay_resources_after_gpu_query && |
83 refresh_rate == other.refresh_rate && | 83 refresh_rate == other.refresh_rate && |
84 highp_threshold_min == other.highp_threshold_min && | 84 highp_threshold_min == other.highp_threshold_min && |
85 texture_id_allocation_chunk_size == | 85 texture_id_allocation_chunk_size == |
86 other.texture_id_allocation_chunk_size && | 86 other.texture_id_allocation_chunk_size && |
87 use_gpu_memory_buffer_resources == | 87 use_gpu_memory_buffer_resources == |
88 other.use_gpu_memory_buffer_resources && | 88 other.use_gpu_memory_buffer_resources && |
89 preferred_tile_format == other.preferred_tile_format; | 89 preferred_tile_format == other.preferred_tile_format; |
90 } | 90 } |
91 | 91 |
92 } // namespace cc | 92 } // namespace cc |
OLD | NEW |