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

Unified Diff: mojo/services/gfx/composition/cpp/logging.cc

Issue 1552963002: Initial checkin of the new Mozart compositor. (Closed) Base URL: git@github.com:domokit/mojo.git@moz-11
Patch Set: Created 4 years, 12 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: mojo/services/gfx/composition/cpp/logging.cc
diff --git a/mojo/services/gfx/composition/cpp/logging.cc b/mojo/services/gfx/composition/cpp/logging.cc
new file mode 100644
index 0000000000000000000000000000000000000000..3388e7626a72fa03976a058b9faa0ea9de185e91
--- /dev/null
+++ b/mojo/services/gfx/composition/cpp/logging.cc
@@ -0,0 +1,197 @@
+// Copyright 2015 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 "mojo/services/gfx/composition/cpp/logging.h"
+
+#include <ostream>
+
+namespace mojo {
+namespace gfx {
+namespace composition {
+
+class Delimiter {
+ public:
+ Delimiter(std::ostream& os) : os_(os) {}
+
+ std::ostream& Append() {
+ if (need_comma_)
+ os_ << ", ";
+ else
+ need_comma_ = true;
+ return os_;
+ }
+
+ private:
+ std::ostream& os_;
+ bool need_comma_ = false;
+};
+
+std::ostream& operator<<(std::ostream& os,
+ const mojo::gfx::composition::SceneToken& value) {
+ return os << "{value=" << value.value << "}";
+}
+
+std::ostream& operator<<(std::ostream& os,
+ const mojo::gfx::composition::SceneUpdate& value) {
+ os << "{";
+ Delimiter d(os);
+ if (value.clear_resources) {
+ d.Append() << "clear_resources=true";
+ }
+ if (value.clear_nodes) {
+ d.Append() << "clear_nodes=true";
+ }
+ if (value.resources) {
+ d.Append() << "resources=" << value.resources;
+ }
+ if (value.nodes) {
+ d.Append() << "nodes=" << value.nodes;
+ }
+ os << "}";
+ return os;
+}
+
+std::ostream& operator<<(std::ostream& os,
+ const mojo::gfx::composition::SceneMetadata& value) {
+ return os << "{version=" << value.version
+ << ", presentation_time=" << value.presentation_time << "}";
+}
+
+std::ostream& operator<<(std::ostream& os,
+ const mojo::gfx::composition::Resource& value) {
+ os << "{";
+ if (value.is_scene()) {
+ os << "scene=" << value.get_scene();
+ } else if (value.is_mailbox_texture()) {
+ os << "mailbox_texture=" << value.get_mailbox_texture();
+ } else {
+ os << "???";
+ }
+ return os << "}";
+}
+
+std::ostream& operator<<(std::ostream& os,
+ const mojo::gfx::composition::SceneResource& value) {
+ return os << "{scene_token=" << value.scene_token << "}";
+}
+
+std::ostream& operator<<(
+ std::ostream& os,
+ const mojo::gfx::composition::MailboxTextureResource& value) {
+ return os << "{sync_point=" << value.sync_point << ", size=" << value.size
+ << "}";
+}
+
+std::ostream& operator<<(std::ostream& os,
+ const mojo::gfx::composition::Node& value) {
+ os << "{";
+ Delimiter d(os);
+ if (value.content_transform)
+ d.Append() << "content_transform=" << value.content_transform;
+ if (value.content_clip)
+ d.Append() << "content_clip=" << value.content_clip;
+ if (value.hit_id != mojo::gfx::composition::kHitIdNone)
+ d.Append() << "hit_id=" << value.hit_id;
+ if (value.op)
+ d.Append() << "op=" << value.op;
+ d.Append() << "combinator=" << &value.combinator;
+ if (value.child_node_ids)
+ d.Append() << "child_node_ids=" << value.child_node_ids;
+ return os << "}";
+}
+
+std::ostream& operator<<(
+ std::ostream& os,
+ const mojo::gfx::composition::Node::Combinator* value) {
+ switch (*value) {
+ case mojo::gfx::composition::Node::Combinator::MERGE:
+ return os << "MERGE";
+ case mojo::gfx::composition::Node::Combinator::PRUNE:
+ return os << "PRUNE";
+ case mojo::gfx::composition::Node::Combinator::FALLBACK:
+ return os << "FALLBACK";
+ default:
+ return os << "???";
+ }
+}
+
+std::ostream& operator<<(std::ostream& os,
+ const mojo::gfx::composition::NodeOp& value) {
+ os << "{";
+ if (value.is_rect()) {
+ os << "rect=" << value.get_rect();
+ } else if (value.is_image()) {
+ os << "image=" << value.get_image();
+ } else if (value.is_scene()) {
+ os << "scene=" << value.get_scene();
+ } else if (value.is_layer()) {
+ os << "layer=" << value.get_layer();
+ } else {
+ os << "???";
+ }
+ return os << "}";
+}
+
+std::ostream& operator<<(std::ostream& os,
+ const mojo::gfx::composition::RectNodeOp& value) {
+ return os << "{content_rect=" << value.content_rect
+ << ", color=" << value.color << "}";
+}
+
+std::ostream& operator<<(std::ostream& os,
+ const mojo::gfx::composition::ImageNodeOp& value) {
+ return os << "{content_rect=" << value.content_rect
+ << ", image_rect=" << value.image_rect
+ << ", image_resource_id=" << value.image_resource_id
+ << ", blend=" << value.blend << "}";
+}
+
+std::ostream& operator<<(std::ostream& os,
+ const mojo::gfx::composition::SceneNodeOp& value) {
+ return os << "{scene_resource_id=" << value.scene_resource_id
+ << ", scene_version=" << value.scene_version << "}";
+}
+
+std::ostream& operator<<(std::ostream& os,
+ const mojo::gfx::composition::LayerNodeOp& value) {
+ return os << "{layer_size=" << value.layer_size << ", blend=" << value.blend
+ << "}";
+}
+
+std::ostream& operator<<(std::ostream& os,
+ const mojo::gfx::composition::Color& value) {
+ return os << "{red=" << static_cast<int>(value.red)
+ << ", green=" << static_cast<int>(value.green)
+ << ", blue=" << static_cast<int>(value.blue)
+ << ", alpha=" << static_cast<int>(value.alpha) << "}";
+}
+
+std::ostream& operator<<(std::ostream& os,
+ const mojo::gfx::composition::Clip& value) {
+ os << "{";
+ if (value.is_rect()) {
+ os << "rect=" << value.get_rect();
+ } else if (value.is_rrect()) {
+ os << "rrect=" << value.get_rrect();
+ } else {
+ os << "???";
+ }
+ return os << "}";
+}
+
+std::ostream& operator<<(std::ostream& os,
+ const mojo::gfx::composition::Blend& value) {
+ return os << "{alpha=" << static_cast<int>(value.alpha) << "}";
+}
+
+std::ostream& operator<<(std::ostream& os,
+ const mojo::gfx::composition::FrameInfo& value) {
+ return os << "{frame_time=" << value.frame_time
+ << ", frame_interval=" << value.frame_interval
+ << ", frame_deadline=" << value.frame_deadline << "}";
+}
+
+} // namespace composition
+} // namespace gfx
+} // namespace mojo

Powered by Google App Engine
This is Rietveld 408576698