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/geometry/rect.h" | 10 #include "ui/gfx/geometry/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), |
| 21 blend_mode(SkXfermode::kSrcOver_Mode), |
20 opacity_is_animating(false), | 22 opacity_is_animating(false), |
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(nullptr), | 28 render_target(nullptr), |
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), |
(...skipping 16 matching lines...) Expand all Loading... |
46 gfx::Transform target_space_transform; | 48 gfx::Transform target_space_transform; |
47 | 49 |
48 // Transforms objects from content space to screen space (viewport space). | 50 // Transforms objects from content space to screen space (viewport space). |
49 gfx::Transform screen_space_transform; | 51 gfx::Transform screen_space_transform; |
50 | 52 |
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 |
| 58 // DrawProperties::blend_mode may be different than LayerType::blend_mode, |
| 59 // when a RenderSurface re-parents the layer's blend_mode. |
| 60 SkXfermode::Mode blend_mode; |
| 61 |
56 // xxx_is_animating flags are used to indicate whether the DrawProperties | 62 // xxx_is_animating flags are used to indicate whether the DrawProperties |
57 // are actually meaningful on the main thread. When the properties are | 63 // 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 | 64 // animating, the main thread may not have the same values that are used |
59 // to draw. | 65 // to draw. |
60 bool opacity_is_animating; | 66 bool opacity_is_animating; |
61 bool screen_space_opacity_is_animating; | 67 bool screen_space_opacity_is_animating; |
62 bool target_space_transform_is_animating; | 68 bool target_space_transform_is_animating; |
63 bool screen_space_transform_is_animating; | 69 bool screen_space_transform_is_animating; |
64 | 70 |
65 // True if the layer can use LCD text. | 71 // True if the layer can use LCD text. |
(...skipping 79 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
145 // have page scale applied and others not, this may differ between layers. | 151 // have page scale applied and others not, this may differ between layers. |
146 float page_scale_factor; | 152 float page_scale_factor; |
147 | 153 |
148 // The device scale factor that is applied to the layer. | 154 // The device scale factor that is applied to the layer. |
149 float device_scale_factor; | 155 float device_scale_factor; |
150 }; | 156 }; |
151 | 157 |
152 } // namespace cc | 158 } // namespace cc |
153 | 159 |
154 #endif // CC_LAYERS_DRAW_PROPERTIES_H_ | 160 #endif // CC_LAYERS_DRAW_PROPERTIES_H_ |
OLD | NEW |