summaryrefslogtreecommitdiffstats
path: root/cc/output/renderer_settings.cc
blob: da79a48dafd535c4a7a4cf5db9fc23a1e51b97d7 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
// Copyright 2014 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.

#include "cc/output/renderer_settings.h"

#include <limits>

#include "base/logging.h"
#include "cc/proto/renderer_settings.pb.h"

namespace cc {

RendererSettings::RendererSettings()
    : allow_antialiasing(true),
      force_antialiasing(false),
      force_blending_with_shaders(false),
      partial_swap_enabled(false),
      finish_rendering_on_resize(false),
      should_clear_root_render_pass(true),
      disable_display_vsync(false),
      delay_releasing_overlay_resources(false),
      refresh_rate(60.0),
      highp_threshold_min(0),
      use_rgba_4444_textures(false),
      texture_id_allocation_chunk_size(64),
      use_gpu_memory_buffer_resources(false) {}

RendererSettings::~RendererSettings() {
}

void RendererSettings::ToProtobuf(proto::RendererSettings* proto) const {
  proto->set_allow_antialiasing(allow_antialiasing);
  proto->set_force_antialiasing(force_antialiasing);
  proto->set_force_blending_with_shaders(force_blending_with_shaders);
  proto->set_partial_swap_enabled(partial_swap_enabled);
  proto->set_finish_rendering_on_resize(finish_rendering_on_resize);
  proto->set_should_clear_root_render_pass(should_clear_root_render_pass);
  proto->set_disable_display_vsync(disable_display_vsync);
  proto->set_delay_releasing_overlay_resources(
      delay_releasing_overlay_resources);
  proto->set_refresh_rate(refresh_rate);
  proto->set_highp_threshold_min(highp_threshold_min);
  proto->set_use_rgba_4444_textures(use_rgba_4444_textures);
  proto->set_texture_id_allocation_chunk_size(texture_id_allocation_chunk_size);
  proto->set_use_gpu_memory_buffer_resources(use_gpu_memory_buffer_resources);
}

void RendererSettings::FromProtobuf(const proto::RendererSettings& proto) {
  allow_antialiasing = proto.allow_antialiasing();
  force_antialiasing = proto.force_antialiasing();
  force_blending_with_shaders = proto.force_blending_with_shaders();
  partial_swap_enabled = proto.partial_swap_enabled();
  finish_rendering_on_resize = proto.finish_rendering_on_resize();
  should_clear_root_render_pass = proto.should_clear_root_render_pass();
  disable_display_vsync = proto.disable_display_vsync();
  delay_releasing_overlay_resources = proto.delay_releasing_overlay_resources();
  refresh_rate = proto.refresh_rate();
  highp_threshold_min = proto.highp_threshold_min();
  use_rgba_4444_textures = proto.use_rgba_4444_textures();
  texture_id_allocation_chunk_size = proto.texture_id_allocation_chunk_size();
  use_gpu_memory_buffer_resources = proto.use_gpu_memory_buffer_resources();
}

bool RendererSettings::operator==(const RendererSettings& other) const {
  return allow_antialiasing == other.allow_antialiasing &&
         force_antialiasing == other.force_antialiasing &&
         force_blending_with_shaders == other.force_blending_with_shaders &&
         partial_swap_enabled == other.partial_swap_enabled &&
         finish_rendering_on_resize == other.finish_rendering_on_resize &&
         should_clear_root_render_pass == other.should_clear_root_render_pass &&
         disable_display_vsync == other.disable_display_vsync &&
         delay_releasing_overlay_resources ==
             other.delay_releasing_overlay_resources &&
         refresh_rate == other.refresh_rate &&
         highp_threshold_min == other.highp_threshold_min &&
         use_rgba_4444_textures == other.use_rgba_4444_textures &&
         texture_id_allocation_chunk_size ==
             other.texture_id_allocation_chunk_size &&
         use_gpu_memory_buffer_resources ==
             other.use_gpu_memory_buffer_resources;
}

}  // namespace cc