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

Side by Side Diff: cc/trees/clip_node.h

Issue 2423483003: cc: Make visible rect computation aware of pixel-moving filters (Closed)
Patch Set: Rebase Created 4 years, 1 month 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 unified diff | Download patch
OLDNEW
1 // Copyright 2016 The Chromium Authors. All rights reserved. 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 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #ifndef CC_TREES_CLIP_NODE_H_ 5 #ifndef CC_TREES_CLIP_NODE_H_
6 #define CC_TREES_CLIP_NODE_H_ 6 #define CC_TREES_CLIP_NODE_H_
7 7
8 #include <memory>
9
8 #include "cc/base/cc_export.h" 10 #include "cc/base/cc_export.h"
11 #include "cc/trees/clip_expander.h"
9 #include "ui/gfx/geometry/rect_f.h" 12 #include "ui/gfx/geometry/rect_f.h"
10 13
11 namespace base { 14 namespace base {
12 namespace trace_event { 15 namespace trace_event {
13 class TracedValue; 16 class TracedValue;
14 } // namespace trace_event 17 } // namespace trace_event
15 } // namespace base 18 } // namespace base
16 19
17 namespace cc { 20 namespace cc {
18 21
19 namespace proto { 22 namespace proto {
20 class TreeNode; 23 class TreeNode;
21 } // namespace proto 24 } // namespace proto
22 25
23 struct CC_EXPORT ClipNode { 26 struct CC_EXPORT ClipNode {
24 ClipNode(); 27 ClipNode();
25 ClipNode(const ClipNode& other); 28 ClipNode(const ClipNode& other);
26 29
30 ClipNode& operator=(const ClipNode& other);
31
32 ~ClipNode();
33
27 int id; 34 int id;
28 int parent_id; 35 int parent_id;
29 int owner_id; 36 int owner_id;
30 37
31 enum class ClipType { 38 enum class ClipType {
32 // The node doesn't contribute a new clip. It exists only for caching clips 39 // The node doesn't contribute a new clip. It exists only for caching clips
33 // or for resetting clipping state. 40 // or for resetting clipping state.
34 NONE, 41 NONE,
35 42
36 // The node contributes a new clip (that is, |clip| needs to be applied). 43 // The node contributes a new clip (that is, |clip| needs to be applied).
37 APPLIES_LOCAL_CLIP 44 APPLIES_LOCAL_CLIP,
45
46 // This node represents a space expansion. When computing visible rects,
47 // the accumulated clip inherited by this node gets expanded. Similarly,
48 // when mapping a rect in descendant space to the rect in ancestor space
49 // that depends on the descendant rect's contents, this node expands the
50 // descendant rect. This is used for effects like pixel-moving filters,
51 // where clipped-out content can affect visible output.
52 EXPANDS_CLIP
38 }; 53 };
39 54
40 ClipType clip_type; 55 ClipType clip_type;
41 56
42 // The clip rect that this node contributes, expressed in the space of its 57 // The clip rect that this node contributes, expressed in the space of its
43 // transform node. 58 // transform node.
44 gfx::RectF clip; 59 gfx::RectF clip;
45 60
61 // For nodes that expand, this represents the amount of expansion.
62 std::unique_ptr<ClipExpander> clip_expander;
63
46 // Clip nodes are used for two reasons. First, they are used for determining 64 // Clip nodes are used for two reasons. First, they are used for determining
47 // which parts of each layer are visible. Second, they are used for 65 // which parts of each layer are visible. Second, they are used for
48 // determining whether a clip needs to be applied when drawing a layer, and if 66 // determining whether a clip needs to be applied when drawing a layer, and if
49 // so, the rect that needs to be used. These can be different since not all 67 // so, the rect that needs to be used. These can be different since not all
50 // clips need to be applied directly to each layer. For example, a layer is 68 // clips need to be applied directly to each layer. For example, a layer is
51 // implicitly clipped by the bounds of its target render surface and by clips 69 // implicitly clipped by the bounds of its target render surface and by clips
52 // applied to this surface. |combined_clip_in_target_space| is used for 70 // applied to this surface. |combined_clip_in_target_space| is used for
53 // computing visible rects, and |clip_in_target_space| is used for computing 71 // computing visible rects, and |clip_in_target_space| is used for computing
54 // clips applied at draw time. Both rects are expressed in the space of the 72 // clips applied at draw time. Both rects are expressed in the space of the
55 // target transform node, and may include clips contributed by ancestors. 73 // target transform node, and may include clips contributed by ancestors.
(...skipping 27 matching lines...) Expand all
83 bool operator==(const ClipNode& other) const; 101 bool operator==(const ClipNode& other) const;
84 102
85 void ToProtobuf(proto::TreeNode* proto) const; 103 void ToProtobuf(proto::TreeNode* proto) const;
86 void FromProtobuf(const proto::TreeNode& proto); 104 void FromProtobuf(const proto::TreeNode& proto);
87 void AsValueInto(base::trace_event::TracedValue* value) const; 105 void AsValueInto(base::trace_event::TracedValue* value) const;
88 }; 106 };
89 107
90 } // namespace cc 108 } // namespace cc
91 109
92 #endif // CC_TREES_CLIP_NODE_H_ 110 #endif // CC_TREES_CLIP_NODE_H_
OLDNEW
« cc/trees/clip_expander.h ('K') | « cc/trees/clip_expander.cc ('k') | cc/trees/clip_node.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698