OLD | NEW |
1 // Copyright 2010 The Chromium Authors. All rights reserved. | 1 // Copyright 2010 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_H_ | 5 #ifndef CC_LAYERS_LAYER_H_ |
6 #define CC_LAYERS_LAYER_H_ | 6 #define CC_LAYERS_LAYER_H_ |
7 | 7 |
8 #include <set> | 8 #include <set> |
9 #include <string> | 9 #include <string> |
10 | 10 |
11 #include "base/callback.h" | 11 #include "base/callback.h" |
12 #include "base/memory/ref_counted.h" | 12 #include "base/memory/ref_counted.h" |
13 #include "base/observer_list.h" | 13 #include "base/observer_list.h" |
14 #include "cc/animation/layer_animation_controller.h" | 14 #include "cc/animation/layer_animation_controller.h" |
15 #include "cc/animation/layer_animation_value_observer.h" | 15 #include "cc/animation/layer_animation_value_observer.h" |
| 16 #include "cc/animation/layer_animation_value_provider.h" |
16 #include "cc/base/cc_export.h" | 17 #include "cc/base/cc_export.h" |
17 #include "cc/base/region.h" | 18 #include "cc/base/region.h" |
18 #include "cc/base/scoped_ptr_vector.h" | 19 #include "cc/base/scoped_ptr_vector.h" |
19 #include "cc/debug/micro_benchmark.h" | 20 #include "cc/debug/micro_benchmark.h" |
20 #include "cc/layers/compositing_reasons.h" | 21 #include "cc/layers/compositing_reasons.h" |
21 #include "cc/layers/draw_properties.h" | 22 #include "cc/layers/draw_properties.h" |
22 #include "cc/layers/layer_lists.h" | 23 #include "cc/layers/layer_lists.h" |
23 #include "cc/layers/layer_position_constraint.h" | 24 #include "cc/layers/layer_position_constraint.h" |
24 #include "cc/layers/paint_properties.h" | 25 #include "cc/layers/paint_properties.h" |
25 #include "cc/layers/render_surface.h" | 26 #include "cc/layers/render_surface.h" |
(...skipping 26 matching lines...) Expand all Loading... |
52 class LayerTreeImpl; | 53 class LayerTreeImpl; |
53 class PriorityCalculator; | 54 class PriorityCalculator; |
54 class RenderingStatsInstrumentation; | 55 class RenderingStatsInstrumentation; |
55 class ResourceUpdateQueue; | 56 class ResourceUpdateQueue; |
56 class ScrollbarLayerInterface; | 57 class ScrollbarLayerInterface; |
57 struct AnimationEvent; | 58 struct AnimationEvent; |
58 | 59 |
59 // Base class for composited layers. Special layer types are derived from | 60 // Base class for composited layers. Special layer types are derived from |
60 // this class. | 61 // this class. |
61 class CC_EXPORT Layer : public base::RefCounted<Layer>, | 62 class CC_EXPORT Layer : public base::RefCounted<Layer>, |
62 public LayerAnimationValueObserver { | 63 public LayerAnimationValueObserver, |
| 64 public LayerAnimationValueProvider { |
63 public: | 65 public: |
64 typedef RenderSurfaceLayerList RenderSurfaceListType; | 66 typedef RenderSurfaceLayerList RenderSurfaceListType; |
65 typedef LayerList LayerListType; | 67 typedef LayerList LayerListType; |
66 typedef RenderSurface RenderSurfaceType; | 68 typedef RenderSurface RenderSurfaceType; |
67 | 69 |
68 enum LayerIdLabels { | 70 enum LayerIdLabels { |
69 INVALID_ID = -1, | 71 INVALID_ID = -1, |
70 }; | 72 }; |
71 | 73 |
72 static scoped_refptr<Layer> Create(); | 74 static scoped_refptr<Layer> Create(); |
(...skipping 458 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
531 | 533 |
532 void SetParent(Layer* layer); | 534 void SetParent(Layer* layer); |
533 bool DescendantIsFixedToContainerLayer() const; | 535 bool DescendantIsFixedToContainerLayer() const; |
534 | 536 |
535 // Returns the index of the child or -1 if not found. | 537 // Returns the index of the child or -1 if not found. |
536 int IndexOfChild(const Layer* reference); | 538 int IndexOfChild(const Layer* reference); |
537 | 539 |
538 // This should only be called from RemoveFromParent(). | 540 // This should only be called from RemoveFromParent(). |
539 void RemoveChildOrDependent(Layer* child); | 541 void RemoveChildOrDependent(Layer* child); |
540 | 542 |
| 543 // LayerAnimationValueProvider implementation. |
| 544 virtual gfx::Vector2dF ScrollOffsetForAnimation() const OVERRIDE; |
| 545 |
541 // LayerAnimationValueObserver implementation. | 546 // LayerAnimationValueObserver implementation. |
542 virtual void OnFilterAnimated(const FilterOperations& filters) OVERRIDE; | 547 virtual void OnFilterAnimated(const FilterOperations& filters) OVERRIDE; |
543 virtual void OnOpacityAnimated(float opacity) OVERRIDE; | 548 virtual void OnOpacityAnimated(float opacity) OVERRIDE; |
544 virtual void OnTransformAnimated(const gfx::Transform& transform) OVERRIDE; | 549 virtual void OnTransformAnimated(const gfx::Transform& transform) OVERRIDE; |
| 550 virtual void OnScrollOffsetAnimated(gfx::Vector2dF scroll_offset) OVERRIDE; |
545 virtual void OnAnimationWaitingForDeletion() OVERRIDE; | 551 virtual void OnAnimationWaitingForDeletion() OVERRIDE; |
546 virtual bool IsActive() const OVERRIDE; | 552 virtual bool IsActive() const OVERRIDE; |
547 | 553 |
548 LayerList children_; | 554 LayerList children_; |
549 Layer* parent_; | 555 Layer* parent_; |
550 | 556 |
551 // Layer instances have a weak pointer to their LayerTreeHost. | 557 // Layer instances have a weak pointer to their LayerTreeHost. |
552 // This pointer value is nil when a Layer is not in a tree and is | 558 // This pointer value is nil when a Layer is not in a tree and is |
553 // updated via SetLayerTreeHost() if a layer moves between trees. | 559 // updated via SetLayerTreeHost() if a layer moves between trees. |
554 LayerTreeHost* layer_tree_host_; | 560 LayerTreeHost* layer_tree_host_; |
(...skipping 57 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
612 DrawProperties<Layer> draw_properties_; | 618 DrawProperties<Layer> draw_properties_; |
613 | 619 |
614 PaintProperties paint_properties_; | 620 PaintProperties paint_properties_; |
615 | 621 |
616 DISALLOW_COPY_AND_ASSIGN(Layer); | 622 DISALLOW_COPY_AND_ASSIGN(Layer); |
617 }; | 623 }; |
618 | 624 |
619 } // namespace cc | 625 } // namespace cc |
620 | 626 |
621 #endif // CC_LAYERS_LAYER_H_ | 627 #endif // CC_LAYERS_LAYER_H_ |
OLD | NEW |