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

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

Issue 2423483003: cc: Make visible rect computation aware of pixel-moving filters (Closed)
Patch Set: It's 2017 -- update copyright for new files Created 3 years, 11 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 unified diff | Download patch
« no previous file with comments | « cc/trees/clip_expander.cc ('k') | cc/trees/clip_node.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 struct CC_EXPORT ClipNode { 22 struct CC_EXPORT ClipNode {
20 ClipNode(); 23 ClipNode();
21 ClipNode(const ClipNode& other); 24 ClipNode(const ClipNode& other);
22 25
26 ClipNode& operator=(const ClipNode& other);
27
28 ~ClipNode();
29
23 // The node index of this node in the clip tree node vector. 30 // The node index of this node in the clip tree node vector.
24 int id; 31 int id;
25 // The node index of the parent node in the clip tree node vector. 32 // The node index of the parent node in the clip tree node vector.
26 int parent_id; 33 int parent_id;
27 // The layer id of the layer that owns this node. 34 // The layer id of the layer that owns this node.
28 int owning_layer_id; 35 int owning_layer_id;
29 36
30 enum class ClipType { 37 enum class ClipType {
31 // The node doesn't contribute a new clip. It exists only for caching clips 38 // The node doesn't contribute a new clip. It exists only for caching clips
32 // or for resetting clipping state. 39 // or for resetting clipping state.
33 NONE, 40 NONE,
34 41
35 // The node contributes a new clip (that is, |clip| needs to be applied). 42 // The node contributes a new clip (that is, |clip| needs to be applied).
36 APPLIES_LOCAL_CLIP 43 APPLIES_LOCAL_CLIP,
44
45 // This node represents a space expansion. When computing visible rects,
46 // the accumulated clip inherited by this node gets expanded. Similarly,
47 // when mapping a rect in descendant space to the rect in ancestor space
48 // that depends on the descendant rect's contents, this node expands the
49 // descendant rect. This is used for effects like pixel-moving filters,
50 // where clipped-out content can affect visible output.
51 EXPANDS_CLIP
37 }; 52 };
38 53
39 ClipType clip_type; 54 ClipType clip_type;
40 55
41 // The clip rect that this node contributes, expressed in the space of its 56 // The clip rect that this node contributes, expressed in the space of its
42 // transform node. 57 // transform node.
43 gfx::RectF clip; 58 gfx::RectF clip;
44 59
60 // For nodes that expand, this represents the amount of expansion.
61 std::unique_ptr<ClipExpander> clip_expander;
62
45 // Clip nodes are used for two reasons. First, they are used for determining 63 // Clip nodes are used for two reasons. First, they are used for determining
46 // which parts of each layer are visible. Second, they are used for 64 // which parts of each layer are visible. Second, they are used for
47 // determining whether a clip needs to be applied when drawing a layer, and if 65 // determining whether a clip needs to be applied when drawing a layer, and if
48 // so, the rect that needs to be used. These can be different since not all 66 // so, the rect that needs to be used. These can be different since not all
49 // clips need to be applied directly to each layer. For example, a layer is 67 // clips need to be applied directly to each layer. For example, a layer is
50 // implicitly clipped by the bounds of its target render surface and by clips 68 // implicitly clipped by the bounds of its target render surface and by clips
51 // applied to this surface. |combined_clip_in_target_space| is used for 69 // applied to this surface. |combined_clip_in_target_space| is used for
52 // computing visible rects, and |clip_in_target_space| is used for computing 70 // computing visible rects, and |clip_in_target_space| is used for computing
53 // clips applied at draw time. Both rects are expressed in the space of the 71 // clips applied at draw time. Both rects are expressed in the space of the
54 // target transform node, and may include clips contributed by ancestors. 72 // target transform node, and may include clips contributed by ancestors.
(...skipping 25 matching lines...) Expand all
80 bool resets_clip : 1; 98 bool resets_clip : 1;
81 99
82 bool operator==(const ClipNode& other) const; 100 bool operator==(const ClipNode& other) const;
83 101
84 void AsValueInto(base::trace_event::TracedValue* value) const; 102 void AsValueInto(base::trace_event::TracedValue* value) const;
85 }; 103 };
86 104
87 } // namespace cc 105 } // namespace cc
88 106
89 #endif // CC_TREES_CLIP_NODE_H_ 107 #endif // CC_TREES_CLIP_NODE_H_
OLDNEW
« no previous file with comments | « 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