OLD | NEW |
(Empty) | |
| 1 // Copyright 2016 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. |
| 4 |
| 5 #ifndef CC_TREES_CLIP_NODE_H_ |
| 6 #define CC_TREES_CLIP_NODE_H_ |
| 7 |
| 8 #include "cc/base/cc_export.h" |
| 9 #include "ui/gfx/geometry/rect_f.h" |
| 10 |
| 11 namespace base { |
| 12 namespace trace_event { |
| 13 class TracedValue; |
| 14 } // namespace trace_event |
| 15 } // namespace base |
| 16 |
| 17 namespace cc { |
| 18 |
| 19 namespace proto { |
| 20 class TreeNode; |
| 21 } // namespace proto |
| 22 |
| 23 struct CC_EXPORT ClipNode { |
| 24 ClipNode(); |
| 25 ClipNode(const ClipNode& other); |
| 26 |
| 27 int id; |
| 28 int parent_id; |
| 29 int owner_id; |
| 30 |
| 31 // The clip rect that this node contributes, expressed in the space of its |
| 32 // transform node. |
| 33 gfx::RectF clip; |
| 34 |
| 35 // Clip nodes are uses for two reasons. First, they are used for determining |
| 36 // which parts of each layer are visible. Second, they are used for |
| 37 // determining whether a clip needs to be applied when drawing a layer, and if |
| 38 // so, the rect that needs to be used. These can be different since not all |
| 39 // clips need to be applied directly to each layer. For example, a layer is |
| 40 // implicitly clipped by the bounds of its target render surface and by clips |
| 41 // applied to this surface. |combined_clip_in_target_space| is used for |
| 42 // computing visible rects, and |clip_in_target_space| is used for computing |
| 43 // clips applied at draw time. Both rects are expressed in the space of the |
| 44 // target transform node, and may include clips contributed by ancestors. |
| 45 gfx::RectF combined_clip_in_target_space; |
| 46 gfx::RectF clip_in_target_space; |
| 47 |
| 48 // The id of the transform node that defines the clip node's local space. |
| 49 int transform_id; |
| 50 |
| 51 // The id of the transform node that defines the clip node's target space. |
| 52 int target_id; |
| 53 |
| 54 // Whether this node contributes a new clip (that is, whether |clip| needs to |
| 55 // be applied), rather than only inheriting ancestor clips. |
| 56 bool applies_local_clip : 1; |
| 57 |
| 58 // When true, |clip_in_target_space| does not include clips from ancestor |
| 59 // nodes. |
| 60 bool layer_clipping_uses_only_local_clip : 1; |
| 61 |
| 62 // True if target surface needs to be drawn with a clip applied. |
| 63 bool target_is_clipped : 1; |
| 64 |
| 65 // True if layers with this clip tree node need to be drawn with a clip |
| 66 // applied. |
| 67 bool layers_are_clipped : 1; |
| 68 bool layers_are_clipped_when_surfaces_disabled : 1; |
| 69 |
| 70 // Nodes that correspond to unclipped surfaces disregard ancestor clips. |
| 71 bool resets_clip : 1; |
| 72 |
| 73 bool operator==(const ClipNode& other) const; |
| 74 |
| 75 void ToProtobuf(proto::TreeNode* proto) const; |
| 76 void FromProtobuf(const proto::TreeNode& proto); |
| 77 void AsValueInto(base::trace_event::TracedValue* value) const; |
| 78 }; |
| 79 |
| 80 } // namespace cc |
| 81 |
| 82 #endif // CC_TREES_CLIP_NODE_H_ |
OLD | NEW |