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_LAYERS_DRAW_PROPERTIES_H_ | 5 #ifndef CC_LAYERS_DRAW_PROPERTIES_H_ |
6 #define CC_LAYERS_DRAW_PROPERTIES_H_ | 6 #define CC_LAYERS_DRAW_PROPERTIES_H_ |
7 | 7 |
8 #include "base/memory/scoped_ptr.h" | 8 #include "base/memory/scoped_ptr.h" |
| 9 #include "third_party/skia/include/core/SkXfermode.h" |
9 #include "ui/gfx/rect.h" | 10 #include "ui/gfx/rect.h" |
10 #include "ui/gfx/transform.h" | 11 #include "ui/gfx/transform.h" |
11 | 12 |
12 namespace cc { | 13 namespace cc { |
13 | 14 |
14 // Container for properties that layers need to compute before they can be | 15 // Container for properties that layers need to compute before they can be |
15 // drawn. | 16 // drawn. |
16 template <typename LayerType> | 17 template <typename LayerType> |
17 struct CC_EXPORT DrawProperties { | 18 struct CC_EXPORT DrawProperties { |
18 DrawProperties() | 19 DrawProperties() |
19 : opacity(0.f), | 20 : opacity(0.f), |
20 opacity_is_animating(false), | 21 opacity_is_animating(false), |
| 22 blend_mode(SkXfermode::kSrcOver_Mode), |
21 screen_space_opacity_is_animating(false), | 23 screen_space_opacity_is_animating(false), |
22 target_space_transform_is_animating(false), | 24 target_space_transform_is_animating(false), |
23 screen_space_transform_is_animating(false), | 25 screen_space_transform_is_animating(false), |
24 can_use_lcd_text(false), | 26 can_use_lcd_text(false), |
25 is_clipped(false), | 27 is_clipped(false), |
26 render_target(NULL), | 28 render_target(NULL), |
27 contents_scale_x(1.f), | 29 contents_scale_x(1.f), |
28 contents_scale_y(1.f), | 30 contents_scale_y(1.f), |
29 num_unclipped_descendants(0), | 31 num_unclipped_descendants(0), |
30 layer_or_descendant_has_copy_request(false), | 32 layer_or_descendant_has_copy_request(false), |
(...skipping 20 matching lines...) Expand all Loading... |
51 // DrawProperties::opacity may be different than LayerType::opacity, | 53 // DrawProperties::opacity may be different than LayerType::opacity, |
52 // particularly in the case when a RenderSurface re-parents the layer's | 54 // particularly in the case when a RenderSurface re-parents the layer's |
53 // opacity, or when opacity is compounded by the hierarchy. | 55 // opacity, or when opacity is compounded by the hierarchy. |
54 float opacity; | 56 float opacity; |
55 | 57 |
56 // xxx_is_animating flags are used to indicate whether the DrawProperties | 58 // xxx_is_animating flags are used to indicate whether the DrawProperties |
57 // are actually meaningful on the main thread. When the properties are | 59 // are actually meaningful on the main thread. When the properties are |
58 // animating, the main thread may not have the same values that are used | 60 // animating, the main thread may not have the same values that are used |
59 // to draw. | 61 // to draw. |
60 bool opacity_is_animating; | 62 bool opacity_is_animating; |
| 63 |
| 64 // DrawProperties::blend_mode may be different than LayerType::blend_mode, |
| 65 // particularly in the case when the LayerType has it own RenderSurface which |
| 66 // will take the responsibility to blend the entire subtree. |
| 67 SkXfermode::Mode blend_mode; |
| 68 |
61 bool screen_space_opacity_is_animating; | 69 bool screen_space_opacity_is_animating; |
62 bool target_space_transform_is_animating; | 70 bool target_space_transform_is_animating; |
63 bool screen_space_transform_is_animating; | 71 bool screen_space_transform_is_animating; |
64 | 72 |
65 // True if the layer can use LCD text. | 73 // True if the layer can use LCD text. |
66 bool can_use_lcd_text; | 74 bool can_use_lcd_text; |
67 | 75 |
68 // True if the layer needs to be clipped by clip_rect. | 76 // True if the layer needs to be clipped by clip_rect. |
69 bool is_clipped; | 77 bool is_clipped; |
70 | 78 |
(...skipping 74 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
145 // have page scale applied and others not, this may differ between layers. | 153 // have page scale applied and others not, this may differ between layers. |
146 float page_scale_factor; | 154 float page_scale_factor; |
147 | 155 |
148 // The device scale factor that is applied to the layer. | 156 // The device scale factor that is applied to the layer. |
149 float device_scale_factor; | 157 float device_scale_factor; |
150 }; | 158 }; |
151 | 159 |
152 } // namespace cc | 160 } // namespace cc |
153 | 161 |
154 #endif // CC_LAYERS_DRAW_PROPERTIES_H_ | 162 #endif // CC_LAYERS_DRAW_PROPERTIES_H_ |
OLD | NEW |