OLD | NEW |
1 // Copyright 2011 The Chromium Authors. All rights reserved. | 1 // Copyright 2011 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_LAYER_IMPL_H_ | 5 #ifndef CC_LAYERS_LAYER_IMPL_H_ |
6 #define CC_LAYERS_LAYER_IMPL_H_ | 6 #define CC_LAYERS_LAYER_IMPL_H_ |
7 | 7 |
8 #include <stddef.h> | 8 #include <stddef.h> |
9 #include <stdint.h> | 9 #include <stdint.h> |
10 | 10 |
(...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
63 class Tile; | 63 class Tile; |
64 | 64 |
65 | 65 |
66 enum DrawMode { | 66 enum DrawMode { |
67 DRAW_MODE_NONE, | 67 DRAW_MODE_NONE, |
68 DRAW_MODE_HARDWARE, | 68 DRAW_MODE_HARDWARE, |
69 DRAW_MODE_SOFTWARE, | 69 DRAW_MODE_SOFTWARE, |
70 DRAW_MODE_RESOURCELESS_SOFTWARE | 70 DRAW_MODE_RESOURCELESS_SOFTWARE |
71 }; | 71 }; |
72 | 72 |
| 73 enum ViewportLayerType { |
| 74 NOT_VIEWPORT_LAYER, |
| 75 INNER_VIEWPORT_CONTAINER, |
| 76 OUTER_VIEWPORT_CONTAINER, |
| 77 INNER_VIEWPORT_SCROLL, |
| 78 OUTER_VIEWPORT_SCROLL, |
| 79 LAST_VIEWPORT_LAYER_TYPE = OUTER_VIEWPORT_SCROLL, |
| 80 }; |
| 81 |
73 class CC_EXPORT LayerImpl { | 82 class CC_EXPORT LayerImpl { |
74 public: | 83 public: |
75 static std::unique_ptr<LayerImpl> Create(LayerTreeImpl* tree_impl, int id) { | 84 static std::unique_ptr<LayerImpl> Create(LayerTreeImpl* tree_impl, int id) { |
76 return base::WrapUnique(new LayerImpl(tree_impl, id)); | 85 return base::WrapUnique(new LayerImpl(tree_impl, id)); |
77 } | 86 } |
78 | 87 |
79 virtual ~LayerImpl(); | 88 virtual ~LayerImpl(); |
80 | 89 |
81 int id() const { return layer_id_; } | 90 int id() const { return layer_id_; } |
82 | 91 |
(...skipping 174 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
257 // The client should be responsible for setting bounds, content bounds and | 266 // The client should be responsible for setting bounds, content bounds and |
258 // contents scale to appropriate values. LayerImpl doesn't calculate any of | 267 // contents scale to appropriate values. LayerImpl doesn't calculate any of |
259 // them from the other values. | 268 // them from the other values. |
260 | 269 |
261 void SetBounds(const gfx::Size& bounds); | 270 void SetBounds(const gfx::Size& bounds); |
262 gfx::Size bounds() const; | 271 gfx::Size bounds() const; |
263 // Like bounds() but doesn't snap to int. Lossy on giant pages (e.g. millions | 272 // Like bounds() but doesn't snap to int. Lossy on giant pages (e.g. millions |
264 // of pixels) due to use of single precision float. | 273 // of pixels) due to use of single precision float. |
265 gfx::SizeF BoundsForScrolling() const; | 274 gfx::SizeF BoundsForScrolling() const; |
266 | 275 |
267 // Viewport bounds delta are used for viewport layers and accounts for changes | 276 // Viewport bounds delta are only used for viewport layers and account for |
268 // in the viewport layers from browser controls and page scale factors. These | 277 // changes in the viewport layers from browser controls and page scale |
269 // deltas are only set on the active tree. | 278 // factors. These deltas are only set on the active tree. |
270 void SetViewportBoundsDelta(const gfx::Vector2dF& bounds_delta); | 279 void SetViewportBoundsDelta(const gfx::Vector2dF& bounds_delta); |
271 gfx::Vector2dF ViewportBoundsDelta() const; | 280 gfx::Vector2dF ViewportBoundsDelta() const; |
272 | 281 |
| 282 void SetViewportLayerType(ViewportLayerType type) { |
| 283 // Once set as a viewport layer type, the viewport type should not change. |
| 284 DCHECK(viewport_layer_type() == NOT_VIEWPORT_LAYER || |
| 285 viewport_layer_type() == type); |
| 286 viewport_layer_type_ = type; |
| 287 } |
| 288 ViewportLayerType viewport_layer_type() const { |
| 289 return static_cast<ViewportLayerType>(viewport_layer_type_); |
| 290 } |
| 291 |
273 void SetCurrentScrollOffset(const gfx::ScrollOffset& scroll_offset); | 292 void SetCurrentScrollOffset(const gfx::ScrollOffset& scroll_offset); |
274 gfx::ScrollOffset CurrentScrollOffset() const; | 293 gfx::ScrollOffset CurrentScrollOffset() const; |
275 | 294 |
276 gfx::ScrollOffset MaxScrollOffset() const; | 295 gfx::ScrollOffset MaxScrollOffset() const; |
277 gfx::ScrollOffset ClampScrollOffsetToLimits(gfx::ScrollOffset offset) const; | 296 gfx::ScrollOffset ClampScrollOffsetToLimits(gfx::ScrollOffset offset) const; |
278 gfx::Vector2dF ClampScrollToMaxScrollOffset(); | 297 gfx::Vector2dF ClampScrollToMaxScrollOffset(); |
279 | 298 |
280 // Returns the delta of the scroll that was outside of the bounds of the | 299 // Returns the delta of the scroll that was outside of the bounds of the |
281 // initial scroll | 300 // initial scroll |
282 gfx::Vector2dF ScrollBy(const gfx::Vector2dF& scroll); | 301 gfx::Vector2dF ScrollBy(const gfx::Vector2dF& scroll); |
(...skipping 213 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
496 bool use_parent_backface_visibility_ : 1; | 515 bool use_parent_backface_visibility_ : 1; |
497 bool use_local_transform_for_backface_visibility_ : 1; | 516 bool use_local_transform_for_backface_visibility_ : 1; |
498 bool should_check_backface_visibility_ : 1; | 517 bool should_check_backface_visibility_ : 1; |
499 bool draws_content_ : 1; | 518 bool draws_content_ : 1; |
500 bool contributes_to_drawn_render_surface_ : 1; | 519 bool contributes_to_drawn_render_surface_ : 1; |
501 | 520 |
502 // This is true if and only if the layer was ever ready since it last animated | 521 // This is true if and only if the layer was ever ready since it last animated |
503 // (all content was complete). | 522 // (all content was complete). |
504 bool was_ever_ready_since_last_transform_animation_ : 1; | 523 bool was_ever_ready_since_last_transform_animation_ : 1; |
505 | 524 |
| 525 static_assert(LAST_VIEWPORT_LAYER_TYPE < (1u << 3), |
| 526 "enough bits for ViewportLayerType (viewport_layer_type_)"); |
| 527 uint8_t viewport_layer_type_ : 3; // ViewportLayerType |
| 528 |
506 Region non_fast_scrollable_region_; | 529 Region non_fast_scrollable_region_; |
507 Region touch_event_handler_region_; | 530 Region touch_event_handler_region_; |
508 SkColor background_color_; | 531 SkColor background_color_; |
509 SkColor safe_opaque_background_color_; | 532 SkColor safe_opaque_background_color_; |
510 | 533 |
511 gfx::PointF position_; | 534 gfx::PointF position_; |
512 | 535 |
513 gfx::Rect clip_rect_in_target_space_; | 536 gfx::Rect clip_rect_in_target_space_; |
514 int transform_tree_index_; | 537 int transform_tree_index_; |
515 int effect_tree_index_; | 538 int effect_tree_index_; |
(...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
558 bool needs_show_scrollbars_ : 1; | 581 bool needs_show_scrollbars_ : 1; |
559 | 582 |
560 bool raster_even_if_not_in_rsll_ : 1; | 583 bool raster_even_if_not_in_rsll_ : 1; |
561 | 584 |
562 DISALLOW_COPY_AND_ASSIGN(LayerImpl); | 585 DISALLOW_COPY_AND_ASSIGN(LayerImpl); |
563 }; | 586 }; |
564 | 587 |
565 } // namespace cc | 588 } // namespace cc |
566 | 589 |
567 #endif // CC_LAYERS_LAYER_IMPL_H_ | 590 #endif // CC_LAYERS_LAYER_IMPL_H_ |
OLD | NEW |