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