[email protected] | d76806f8 | 2012-12-05 21:41:50 | [diff] [blame] | 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 |
| 3 | // found in the LICENSE file. |
| 4 | |
[email protected] | cc3cfaa | 2013-03-18 09:05:52 | [diff] [blame] | 5 | #ifndef CC_LAYERS_DRAW_PROPERTIES_H_ |
| 6 | #define CC_LAYERS_DRAW_PROPERTIES_H_ |
[email protected] | d76806f8 | 2012-12-05 21:41:50 | [diff] [blame] | 7 | |
avi | 02a4d17 | 2015-12-21 06:14:36 | [diff] [blame^] | 8 | #include <stddef.h> |
| 9 | |
[email protected] | d76806f8 | 2012-12-05 21:41:50 | [diff] [blame] | 10 | #include "base/memory/scoped_ptr.h" |
danakj | 4902c30 | 2015-02-13 22:12:16 | [diff] [blame] | 11 | #include "cc/trees/occlusion.h" |
rosca | 948d29d | 2014-11-09 10:25:13 | [diff] [blame] | 12 | #include "third_party/skia/include/core/SkXfermode.h" |
heejin.r.chung | d28506ba | 2014-10-23 16:36:20 | [diff] [blame] | 13 | #include "ui/gfx/geometry/rect.h" |
[email protected] | d76806f8 | 2012-12-05 21:41:50 | [diff] [blame] | 14 | #include "ui/gfx/transform.h" |
| 15 | |
| 16 | namespace cc { |
enne | fffb119c | 2015-08-29 09:17:30 | [diff] [blame] | 17 | class LayerImpl; |
[email protected] | d76806f8 | 2012-12-05 21:41:50 | [diff] [blame] | 18 | |
| 19 | // Container for properties that layers need to compute before they can be |
| 20 | // drawn. |
[email protected] | d76806f8 | 2012-12-05 21:41:50 | [diff] [blame] | 21 | struct CC_EXPORT DrawProperties { |
enne | fffb119c | 2015-08-29 09:17:30 | [diff] [blame] | 22 | DrawProperties(); |
| 23 | ~DrawProperties(); |
[email protected] | d76806f8 | 2012-12-05 21:41:50 | [diff] [blame] | 24 | |
[email protected] | 7af0d79 | 2013-03-24 09:38:57 | [diff] [blame] | 25 | // Transforms objects from content space to target surface space, where |
| 26 | // this layer would be drawn. |
| 27 | gfx::Transform target_space_transform; |
[email protected] | d76806f8 | 2012-12-05 21:41:50 | [diff] [blame] | 28 | |
[email protected] | 7af0d79 | 2013-03-24 09:38:57 | [diff] [blame] | 29 | // Transforms objects from content space to screen space (viewport space). |
| 30 | gfx::Transform screen_space_transform; |
[email protected] | d76806f8 | 2012-12-05 21:41:50 | [diff] [blame] | 31 | |
danakj | 4902c30 | 2015-02-13 22:12:16 | [diff] [blame] | 32 | // Known occlusion above the layer mapped to the content space of the layer. |
| 33 | Occlusion occlusion_in_content_space; |
| 34 | |
enne | fffb119c | 2015-08-29 09:17:30 | [diff] [blame] | 35 | // DrawProperties::opacity may be different than LayerImpl::opacity, |
[email protected] | ed511b8d | 2013-03-25 03:29:29 | [diff] [blame] | 36 | // particularly in the case when a RenderSurface re-parents the layer's |
[email protected] | 7af0d79 | 2013-03-24 09:38:57 | [diff] [blame] | 37 | // opacity, or when opacity is compounded by the hierarchy. |
| 38 | float opacity; |
[email protected] | d76806f8 | 2012-12-05 21:41:50 | [diff] [blame] | 39 | |
[email protected] | 7af0d79 | 2013-03-24 09:38:57 | [diff] [blame] | 40 | // xxx_is_animating flags are used to indicate whether the DrawProperties |
| 41 | // 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 |
| 43 | // to draw. |
[email protected] | 7af0d79 | 2013-03-24 09:38:57 | [diff] [blame] | 44 | bool screen_space_transform_is_animating; |
[email protected] | d76806f8 | 2012-12-05 21:41:50 | [diff] [blame] | 45 | |
[email protected] | 7af0d79 | 2013-03-24 09:38:57 | [diff] [blame] | 46 | // True if the layer can use LCD text. |
| 47 | bool can_use_lcd_text; |
[email protected] | 10aabcc3 | 2012-12-13 09:18:59 | [diff] [blame] | 48 | |
ajuma | e2b7a5c | 2015-09-30 21:41:42 | [diff] [blame] | 49 | // True if the layer needs to be clipped by clip_rect. |
| 50 | bool is_clipped; |
| 51 | |
[email protected] | 7af0d79 | 2013-03-24 09:38:57 | [diff] [blame] | 52 | // The layer whose coordinate space this layer draws into. This can be |
| 53 | // either the same layer (draw_properties_.render_target == this) or an |
| 54 | // ancestor of this layer. |
enne | fffb119c | 2015-08-29 09:17:30 | [diff] [blame] | 55 | LayerImpl* render_target; |
[email protected] | d76806f8 | 2012-12-05 21:41:50 | [diff] [blame] | 56 | |
danakj | 64767d90 | 2015-06-19 00:10:43 | [diff] [blame] | 57 | // This rect is a bounding box around what part of the layer is visible, in |
| 58 | // the layer's coordinate space. |
| 59 | gfx::Rect visible_layer_rect; |
[email protected] | d76806f8 | 2012-12-05 21:41:50 | [diff] [blame] | 60 | |
[email protected] | 7af0d79 | 2013-03-24 09:38:57 | [diff] [blame] | 61 | // In target surface space, the rect that encloses the clipped, drawable |
| 62 | // content of the layer. |
| 63 | gfx::Rect drawable_content_rect; |
[email protected] | d76806f8 | 2012-12-05 21:41:50 | [diff] [blame] | 64 | |
[email protected] | 7af0d79 | 2013-03-24 09:38:57 | [diff] [blame] | 65 | // In target surface space, the original rect that clipped this layer. This |
| 66 | // value is used to avoid unnecessarily changing GL scissor state. |
| 67 | gfx::Rect clip_rect; |
[email protected] | b5b1fce | 2012-12-12 22:49:36 | [diff] [blame] | 68 | |
[email protected] | 420fdf6e | 2013-08-26 20:36:38 | [diff] [blame] | 69 | // Number of descendants with a clip parent that is our ancestor. NB - this |
| 70 | // does not include our clip children because they are clipped by us. |
vmpstr | 762e70d | 2015-06-10 02:12:57 | [diff] [blame] | 71 | size_t num_unclipped_descendants; |
[email protected] | 420fdf6e | 2013-08-26 20:36:38 | [diff] [blame] | 72 | |
vollick | eb19494 | 2014-09-12 17:45:27 | [diff] [blame] | 73 | // This is true if the layer has any direct child that has a scroll parent. |
| 74 | // This layer will not be the scroll parent in this case. This information |
| 75 | // lets us avoid work in CalculateDrawPropertiesInternal -- if none of our |
| 76 | // children have scroll parents, we will not need to recur out of order. |
| 77 | bool has_child_with_a_scroll_parent; |
| 78 | |
[email protected] | 390bb1ff | 2014-05-09 17:14:40 | [diff] [blame] | 79 | // Each time we generate a new render surface layer list, an ID is used to |
| 80 | // identify it. |last_drawn_render_surface_layer_list_id| is set to the ID |
| 81 | // that marked the render surface layer list generation which last updated |
| 82 | // these draw properties and determined that this layer will draw itself. |
| 83 | // If these draw properties are not a part of the render surface layer list, |
| 84 | // or the layer doesn't contribute anything, then this ID will be either out |
| 85 | // of date or 0. |
| 86 | int last_drawn_render_surface_layer_list_id; |
[email protected] | 18e6965 | 2014-06-13 12:50:58 | [diff] [blame] | 87 | |
[email protected] | 18e6965 | 2014-06-13 12:50:58 | [diff] [blame] | 88 | // The maximum scale during the layers current animation at which content |
| 89 | // should be rastered at to be crisp. |
| 90 | float maximum_animation_contents_scale; |
| 91 | |
behara.ms | f0ebecee | 2015-05-05 02:52:12 | [diff] [blame] | 92 | // The scale during the layer animation start at which content should be |
| 93 | // rastered at to be crisp. |
| 94 | float starting_animation_contents_scale; |
[email protected] | d76806f8 | 2012-12-05 21:41:50 | [diff] [blame] | 95 | }; |
| 96 | |
| 97 | } // namespace cc |
| 98 | |
[email protected] | cc3cfaa | 2013-03-18 09:05:52 | [diff] [blame] | 99 | #endif // CC_LAYERS_DRAW_PROPERTIES_H_ |