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

Unified Diff: content/common/render_widget_surface_properties.cc

Issue 2882303002: Factor FrameData out of RendererCompositorFrameSink (Closed)
Patch Set: c Created 3 years, 7 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 side-by-side diff with in-line comments
Download patch
Index: content/common/render_widget_surface_properties.cc
diff --git a/content/common/render_widget_surface_properties.cc b/content/common/render_widget_surface_properties.cc
new file mode 100644
index 0000000000000000000000000000000000000000..187ee7c58e584deb0c466a12cb7a54f928ee8719
--- /dev/null
+++ b/content/common/render_widget_surface_properties.cc
@@ -0,0 +1,58 @@
+// Copyright 2017 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 "content/common/render_widget_surface_properties.h"
+
+namespace content {
+
+// static
+RenderWidgetSurfaceProperties
+RenderWidgetSurfaceProperties::FromCompositorFrame(
+ const cc::CompositorFrame& frame) {
+ RenderWidgetSurfaceProperties properties;
+ properties.size = frame.render_pass_list.back()->output_rect.size();
+ properties.device_scale_factor = frame.metadata.device_scale_factor;
+#ifdef OS_ANDROID
+ properties.top_controls_height = frame.metadata.top_controls_height;
+ properties.top_controls_shown_ratio = frame.metadata.top_controls_shown_ratio;
+ properties.bottom_controls_height = frame.metadata.bottom_controls_height;
+ properties.bottom_controls_shown_ratio =
+ frame.metadata.bottom_controls_shown_ratio;
+ properties.selection = frame.metadata.selection;
+ properties.has_transparent_background =
+ frame.render_pass_list.back()->has_transparent_background;
+#endif
+ return properties;
+}
+
+RenderWidgetSurfaceProperties::RenderWidgetSurfaceProperties() = default;
+
+RenderWidgetSurfaceProperties::RenderWidgetSurfaceProperties(
+ const RenderWidgetSurfaceProperties& other) = default;
+
+RenderWidgetSurfaceProperties::~RenderWidgetSurfaceProperties() = default;
+
+RenderWidgetSurfaceProperties& RenderWidgetSurfaceProperties::operator=(
+ const RenderWidgetSurfaceProperties& other) = default;
+
+bool RenderWidgetSurfaceProperties::operator==(
+ const RenderWidgetSurfaceProperties& other) const {
+ return other.device_scale_factor == device_scale_factor &&
+#ifdef OS_ANDROID
+ other.top_controls_height == top_controls_height &&
+ other.top_controls_shown_ratio == top_controls_shown_ratio &&
+ other.bottom_controls_height == bottom_controls_height &&
+ other.bottom_controls_shown_ratio == bottom_controls_shown_ratio &&
+ other.selection == selection &&
+ other.has_transparent_background == has_transparent_background &&
+#endif
+ other.size == size;
+}
+
+bool RenderWidgetSurfaceProperties::operator!=(
+ const RenderWidgetSurfaceProperties& other) const {
+ return !(*this == other);
+}
+
+} // namespace content
« no previous file with comments | « content/common/render_widget_surface_properties.h ('k') | content/renderer/gpu/renderer_compositor_frame_sink.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698