OLD | NEW |
1 // Copyright 2012 The Chromium Authors. All rights reserved. | 1 // Copyright 2012 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_DRAW_PROPERTIES_H_ | 5 #ifndef CC_DRAW_PROPERTIES_H_ |
6 #define CC_DRAW_PROPERTIES_H_ | 6 #define CC_DRAW_PROPERTIES_H_ |
7 | 7 |
8 #include "base/memory/scoped_ptr.h" | 8 #include "base/memory/scoped_ptr.h" |
9 #include "ui/gfx/rect.h" | 9 #include "ui/gfx/rect.h" |
10 #include "ui/gfx/transform.h" | 10 #include "ui/gfx/transform.h" |
11 | 11 |
12 namespace cc { | 12 namespace cc { |
13 | 13 |
14 // Container for properties that layers need to compute before they can be | 14 // Container for properties that layers need to compute before they can be |
15 // drawn. | 15 // drawn. |
16 template<typename LayerType, typename RenderSurfaceType> | 16 template<typename LayerType, typename RenderSurfaceType> |
17 struct CC_EXPORT DrawProperties { | 17 struct CC_EXPORT DrawProperties { |
18 DrawProperties() | 18 DrawProperties() |
19 : opacity(0) | 19 : opacity(0) |
20 , opacity_is_animating(false) | 20 , opacity_is_animating(false) |
| 21 , screen_space_opacity_is_animating(false) |
21 , target_space_transform_is_animating(false) | 22 , target_space_transform_is_animating(false) |
22 , screen_space_transform_is_animating(false) | 23 , screen_space_transform_is_animating(false) |
| 24 , can_use_lcd_text(false) |
23 , is_clipped(false) | 25 , is_clipped(false) |
24 , render_target(0) | 26 , render_target(0) |
25 { | 27 { |
26 } | 28 } |
27 | 29 |
28 // Transforms objects from content space to target surface space, where | 30 // Transforms objects from content space to target surface space, where |
29 // this layer would be drawn. | 31 // this layer would be drawn. |
30 gfx::Transform target_space_transform; | 32 gfx::Transform target_space_transform; |
31 | 33 |
32 // Transforms objects from content space to screen space (viewport space). | 34 // Transforms objects from content space to screen space (viewport space). |
33 gfx::Transform screen_space_transform; | 35 gfx::Transform screen_space_transform; |
34 | 36 |
35 // DrawProperties::opacity may be different than LayerType::opacity, | 37 // DrawProperties::opacity may be different than LayerType::opacity, |
36 // particularly in the case when a renderSurface re-parents the layer's | 38 // particularly in the case when a renderSurface re-parents the layer's |
37 // opacity, or when opacity is compounded by the hierarchy. | 39 // opacity, or when opacity is compounded by the hierarchy. |
38 float opacity; | 40 float opacity; |
39 | 41 |
40 // XXXIsAnimating flags are used to indicate whether the drawProperties | 42 // XXXIsAnimating flags are used to indicate whether the drawProperties |
41 // are actually meaningful on the main thread. When the properties are | 43 // are actually meaningful on the main thread. When the properties are |
42 // animating, the main thread may not have the same values that are used | 44 // animating, the main thread may not have the same values that are used |
43 // to draw. | 45 // to draw. |
44 bool opacity_is_animating; | 46 bool opacity_is_animating; |
| 47 bool screen_space_opacity_is_animating; |
45 bool target_space_transform_is_animating; | 48 bool target_space_transform_is_animating; |
46 bool screen_space_transform_is_animating; | 49 bool screen_space_transform_is_animating; |
47 | 50 |
| 51 // True if the layer can use LCD text. |
| 52 bool can_use_lcd_text; |
| 53 |
48 // True if the layer needs to be clipped by clipRect. | 54 // True if the layer needs to be clipped by clipRect. |
49 bool is_clipped; | 55 bool is_clipped; |
50 | 56 |
51 // The layer whose coordinate space this layer draws into. This can be | 57 // The layer whose coordinate space this layer draws into. This can be |
52 // either the same layer (m_drawProperties.render_target == this) or an | 58 // either the same layer (m_drawProperties.render_target == this) or an |
53 // ancestor of this layer. | 59 // ancestor of this layer. |
54 LayerType* render_target; | 60 LayerType* render_target; |
55 | 61 |
56 // The surface that this layer and its subtree would contribute to. | 62 // The surface that this layer and its subtree would contribute to. |
57 scoped_ptr<RenderSurfaceType> render_surface; | 63 scoped_ptr<RenderSurfaceType> render_surface; |
58 | 64 |
59 // This rect is in the layer's content space. | 65 // This rect is in the layer's content space. |
60 gfx::Rect visible_content_rect; | 66 gfx::Rect visible_content_rect; |
61 | 67 |
62 // In target surface space, the rect that encloses the clipped, drawable | 68 // In target surface space, the rect that encloses the clipped, drawable |
63 // content of the layer. | 69 // content of the layer. |
64 gfx::Rect drawable_content_rect; | 70 gfx::Rect drawable_content_rect; |
65 | 71 |
66 // In target surface space, the original rect that clipped this | 72 // In target surface space, the original rect that clipped this |
67 // layer. This value is used to avoid unnecessarily changing GL scissor | 73 // layer. This value is used to avoid unnecessarily changing GL scissor |
68 // state. | 74 // state. |
69 gfx::Rect clip_rect; | 75 gfx::Rect clip_rect; |
70 }; | 76 }; |
71 | 77 |
72 } // namespace cc | 78 } // namespace cc |
73 | 79 |
74 #endif // CC_DRAW_PROPERTIES_H_ | 80 #endif // CC_DRAW_PROPERTIES_H_ |
OLD | NEW |