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

Unified Diff: cc/trees/clip_node.h

Issue 2118993002: Detemplatize cc property nodes (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: rebase Created 4 years, 5 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
« no previous file with comments | « cc/layers/viewport.cc ('k') | cc/trees/clip_node.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: cc/trees/clip_node.h
diff --git a/cc/trees/clip_node.h b/cc/trees/clip_node.h
new file mode 100644
index 0000000000000000000000000000000000000000..289930be06ecab91b627957040e8abdc3c5b2034
--- /dev/null
+++ b/cc/trees/clip_node.h
@@ -0,0 +1,82 @@
+// Copyright 2016 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.
+
+#ifndef CC_TREES_CLIP_NODE_H_
+#define CC_TREES_CLIP_NODE_H_
+
+#include "cc/base/cc_export.h"
+#include "ui/gfx/geometry/rect_f.h"
+
+namespace base {
+namespace trace_event {
+class TracedValue;
+} // namespace trace_event
+} // namespace base
+
+namespace cc {
+
+namespace proto {
+class TreeNode;
+} // namespace proto
+
+struct CC_EXPORT ClipNode {
+ ClipNode();
+ ClipNode(const ClipNode& other);
+
+ int id;
+ int parent_id;
+ int owner_id;
+
+ // The clip rect that this node contributes, expressed in the space of its
+ // transform node.
+ gfx::RectF clip;
+
+ // Clip nodes are uses for two reasons. First, they are used for determining
+ // which parts of each layer are visible. Second, they are used for
+ // determining whether a clip needs to be applied when drawing a layer, and if
+ // so, the rect that needs to be used. These can be different since not all
+ // clips need to be applied directly to each layer. For example, a layer is
+ // implicitly clipped by the bounds of its target render surface and by clips
+ // applied to this surface. |combined_clip_in_target_space| is used for
+ // computing visible rects, and |clip_in_target_space| is used for computing
+ // clips applied at draw time. Both rects are expressed in the space of the
+ // target transform node, and may include clips contributed by ancestors.
+ gfx::RectF combined_clip_in_target_space;
+ gfx::RectF clip_in_target_space;
+
+ // The id of the transform node that defines the clip node's local space.
+ int transform_id;
+
+ // The id of the transform node that defines the clip node's target space.
+ int target_id;
+
+ // Whether this node contributes a new clip (that is, whether |clip| needs to
+ // be applied), rather than only inheriting ancestor clips.
+ bool applies_local_clip : 1;
+
+ // When true, |clip_in_target_space| does not include clips from ancestor
+ // nodes.
+ bool layer_clipping_uses_only_local_clip : 1;
+
+ // True if target surface needs to be drawn with a clip applied.
+ bool target_is_clipped : 1;
+
+ // True if layers with this clip tree node need to be drawn with a clip
+ // applied.
+ bool layers_are_clipped : 1;
+ bool layers_are_clipped_when_surfaces_disabled : 1;
+
+ // Nodes that correspond to unclipped surfaces disregard ancestor clips.
+ bool resets_clip : 1;
+
+ bool operator==(const ClipNode& other) const;
+
+ void ToProtobuf(proto::TreeNode* proto) const;
+ void FromProtobuf(const proto::TreeNode& proto);
+ void AsValueInto(base::trace_event::TracedValue* value) const;
+};
+
+} // namespace cc
+
+#endif // CC_TREES_CLIP_NODE_H_
« no previous file with comments | « cc/layers/viewport.cc ('k') | cc/trees/clip_node.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698