| 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 |
| 11 #include <map> | 11 #include <map> |
| 12 #include <set> | 12 #include <set> |
| 13 #include <string> | 13 #include <string> |
| 14 #include <vector> | 14 #include <vector> |
| 15 | 15 |
| 16 #include "base/logging.h" | 16 #include "base/logging.h" |
| 17 #include "base/macros.h" | 17 #include "base/macros.h" |
| 18 #include "base/memory/scoped_ptr.h" | 18 #include "base/memory/scoped_ptr.h" |
| 19 #include "base/values.h" | 19 #include "base/values.h" |
| 20 #include "cc/animation/animation_delegate.h" | 20 #include "cc/animation/target_property.h" |
| 21 #include "cc/animation/layer_animation_controller.h" | |
| 22 #include "cc/animation/layer_animation_value_observer.h" | |
| 23 #include "cc/animation/layer_animation_value_provider.h" | |
| 24 #include "cc/base/cc_export.h" | 21 #include "cc/base/cc_export.h" |
| 25 #include "cc/base/region.h" | 22 #include "cc/base/region.h" |
| 26 #include "cc/base/synced_property.h" | 23 #include "cc/base/synced_property.h" |
| 27 #include "cc/debug/frame_timing_request.h" | 24 #include "cc/debug/frame_timing_request.h" |
| 28 #include "cc/input/input_handler.h" | 25 #include "cc/input/input_handler.h" |
| 29 #include "cc/layers/draw_properties.h" | 26 #include "cc/layers/draw_properties.h" |
| 30 #include "cc/layers/layer_lists.h" | 27 #include "cc/layers/layer_lists.h" |
| 31 #include "cc/layers/layer_position_constraint.h" | 28 #include "cc/layers/layer_position_constraint.h" |
| 32 #include "cc/layers/performance_properties.h" | 29 #include "cc/layers/performance_properties.h" |
| 33 #include "cc/layers/render_surface_impl.h" | 30 #include "cc/layers/render_surface_impl.h" |
| (...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 72 | 69 |
| 73 struct AppendQuadsData; | 70 struct AppendQuadsData; |
| 74 | 71 |
| 75 enum DrawMode { | 72 enum DrawMode { |
| 76 DRAW_MODE_NONE, | 73 DRAW_MODE_NONE, |
| 77 DRAW_MODE_HARDWARE, | 74 DRAW_MODE_HARDWARE, |
| 78 DRAW_MODE_SOFTWARE, | 75 DRAW_MODE_SOFTWARE, |
| 79 DRAW_MODE_RESOURCELESS_SOFTWARE | 76 DRAW_MODE_RESOURCELESS_SOFTWARE |
| 80 }; | 77 }; |
| 81 | 78 |
| 82 class CC_EXPORT LayerImpl : public LayerAnimationValueObserver, | 79 class CC_EXPORT LayerImpl { |
| 83 public LayerAnimationValueProvider, | |
| 84 public AnimationDelegate { | |
| 85 public: | 80 public: |
| 86 typedef LayerImplList RenderSurfaceListType; | 81 typedef LayerImplList RenderSurfaceListType; |
| 87 typedef LayerImplList LayerListType; | 82 typedef LayerImplList LayerListType; |
| 88 typedef RenderSurfaceImpl RenderSurfaceType; | 83 typedef RenderSurfaceImpl RenderSurfaceType; |
| 89 | 84 |
| 90 enum RenderingContextConstants { NO_RENDERING_CONTEXT = 0 }; | 85 enum RenderingContextConstants { NO_RENDERING_CONTEXT = 0 }; |
| 91 | 86 |
| 92 static scoped_ptr<LayerImpl> Create(LayerTreeImpl* tree_impl, int id) { | 87 static scoped_ptr<LayerImpl> Create(LayerTreeImpl* tree_impl, int id) { |
| 93 return make_scoped_ptr(new LayerImpl(tree_impl, id)); | 88 return make_scoped_ptr(new LayerImpl(tree_impl, id)); |
| 94 } | 89 } |
| 95 | 90 |
| 96 ~LayerImpl() override; | 91 virtual ~LayerImpl(); |
| 97 | 92 |
| 98 int id() const { return layer_id_; } | 93 int id() const { return layer_id_; } |
| 99 | 94 |
| 100 // LayerAnimationValueProvider implementation. | 95 // Interactions with attached animations. |
| 101 gfx::ScrollOffset ScrollOffsetForAnimation() const override; | 96 gfx::ScrollOffset ScrollOffsetForAnimation() const; |
| 102 | 97 void OnFilterAnimated(const FilterOperations& filters); |
| 103 // LayerAnimationValueObserver implementation. | 98 void OnOpacityAnimated(float opacity); |
| 104 void OnFilterAnimated(const FilterOperations& filters) override; | 99 void OnTransformAnimated(const gfx::Transform& transform); |
| 105 void OnOpacityAnimated(float opacity) override; | 100 void OnScrollOffsetAnimated(const gfx::ScrollOffset& scroll_offset); |
| 106 void OnTransformAnimated(const gfx::Transform& transform) override; | 101 void OnTransformIsPotentiallyAnimatingChanged(bool is_animating); |
| 107 void OnScrollOffsetAnimated(const gfx::ScrollOffset& scroll_offset) override; | 102 bool IsActive() const; |
| 108 void OnAnimationWaitingForDeletion() override; | |
| 109 void OnTransformIsPotentiallyAnimatingChanged(bool is_animating) override; | |
| 110 bool IsActive() const override; | |
| 111 | |
| 112 // AnimationDelegate implementation. | |
| 113 void NotifyAnimationStarted(base::TimeTicks monotonic_time, | |
| 114 TargetProperty::Type target_property, | |
| 115 int group) override{}; | |
| 116 void NotifyAnimationFinished(base::TimeTicks monotonic_time, | |
| 117 TargetProperty::Type target_property, | |
| 118 int group) override; | |
| 119 void NotifyAnimationAborted(base::TimeTicks monotonic_time, | |
| 120 TargetProperty::Type target_property, | |
| 121 int group) override{}; | |
| 122 void NotifyAnimationTakeover(base::TimeTicks monotonic_time, | |
| 123 TargetProperty::Type target_property, | |
| 124 double animation_start_time, | |
| 125 scoped_ptr<AnimationCurve> curve) override {} | |
| 126 | 103 |
| 127 // Tree structure. | 104 // Tree structure. |
| 128 LayerImpl* parent() { return parent_; } | 105 LayerImpl* parent() { return parent_; } |
| 129 const LayerImpl* parent() const { return parent_; } | 106 const LayerImpl* parent() const { return parent_; } |
| 130 const OwnedLayerImplList& children() const { return children_; } | 107 const OwnedLayerImplList& children() const { return children_; } |
| 131 OwnedLayerImplList& children() { return children_; } | 108 OwnedLayerImplList& children() { return children_; } |
| 132 LayerImpl* child_at(size_t index) const { return children_[index].get(); } | 109 LayerImpl* child_at(size_t index) const { return children_[index].get(); } |
| 133 void AddChild(scoped_ptr<LayerImpl> child); | 110 void AddChild(scoped_ptr<LayerImpl> child); |
| 134 scoped_ptr<LayerImpl> RemoveChild(LayerImpl* child); | 111 scoped_ptr<LayerImpl> RemoveChild(LayerImpl* child); |
| 135 void SetParent(LayerImpl* parent); | 112 void SetParent(LayerImpl* parent); |
| (...skipping 414 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 550 | 527 |
| 551 void AddDamageRect(const gfx::Rect& damage_rect); | 528 void AddDamageRect(const gfx::Rect& damage_rect); |
| 552 const gfx::Rect& damage_rect() const { return damage_rect_; } | 529 const gfx::Rect& damage_rect() const { return damage_rect_; } |
| 553 | 530 |
| 554 virtual base::DictionaryValue* LayerTreeAsJson() const; | 531 virtual base::DictionaryValue* LayerTreeAsJson() const; |
| 555 | 532 |
| 556 bool LayerPropertyChanged() const; | 533 bool LayerPropertyChanged() const; |
| 557 | 534 |
| 558 void ResetAllChangeTrackingForSubtree(); | 535 void ResetAllChangeTrackingForSubtree(); |
| 559 | 536 |
| 560 LayerAnimationController* layer_animation_controller() { | |
| 561 return layer_animation_controller_.get(); | |
| 562 } | |
| 563 | |
| 564 const LayerAnimationController* layer_animation_controller() const { | |
| 565 return layer_animation_controller_.get(); | |
| 566 } | |
| 567 | |
| 568 virtual SimpleEnclosedRegion VisibleOpaqueRegion() const; | 537 virtual SimpleEnclosedRegion VisibleOpaqueRegion() const; |
| 569 | 538 |
| 570 virtual void DidBecomeActive() {} | 539 virtual void DidBecomeActive() {} |
| 571 | 540 |
| 572 virtual void DidBeginTracing(); | 541 virtual void DidBeginTracing(); |
| 573 | 542 |
| 574 // Release resources held by this layer. Called when the output surface | 543 // Release resources held by this layer. Called when the output surface |
| 575 // that rendered this layer was lost or a rendering mode switch has occured. | 544 // that rendered this layer was lost or a rendering mode switch has occured. |
| 576 virtual void ReleaseResources(); | 545 virtual void ReleaseResources(); |
| 577 | 546 |
| (...skipping 229 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 807 uint32_t mutable_properties_; | 776 uint32_t mutable_properties_; |
| 808 // Rect indicating what was repainted/updated during update. | 777 // Rect indicating what was repainted/updated during update. |
| 809 // Note that plugin layers bypass this and leave it empty. | 778 // Note that plugin layers bypass this and leave it empty. |
| 810 // This is in the layer's space. | 779 // This is in the layer's space. |
| 811 gfx::Rect update_rect_; | 780 gfx::Rect update_rect_; |
| 812 | 781 |
| 813 // Denotes an area that is damaged and needs redraw. This is in the layer's | 782 // Denotes an area that is damaged and needs redraw. This is in the layer's |
| 814 // space. | 783 // space. |
| 815 gfx::Rect damage_rect_; | 784 gfx::Rect damage_rect_; |
| 816 | 785 |
| 817 // Manages animations for this layer. | |
| 818 scoped_refptr<LayerAnimationController> layer_animation_controller_; | |
| 819 | |
| 820 std::vector<scoped_ptr<CopyOutputRequest>> copy_requests_; | 786 std::vector<scoped_ptr<CopyOutputRequest>> copy_requests_; |
| 821 | 787 |
| 822 // Group of properties that need to be computed based on the layer tree | 788 // Group of properties that need to be computed based on the layer tree |
| 823 // hierarchy before layers can be drawn. | 789 // hierarchy before layers can be drawn. |
| 824 DrawProperties draw_properties_; | 790 DrawProperties draw_properties_; |
| 825 PerformanceProperties<LayerImpl> performance_properties_; | 791 PerformanceProperties<LayerImpl> performance_properties_; |
| 826 | 792 |
| 827 scoped_ptr<base::trace_event::ConvertableToTraceFormat> owned_debug_info_; | 793 scoped_ptr<base::trace_event::ConvertableToTraceFormat> owned_debug_info_; |
| 828 base::trace_event::ConvertableToTraceFormat* debug_info_; | 794 base::trace_event::ConvertableToTraceFormat* debug_info_; |
| 829 scoped_ptr<RenderSurfaceImpl> render_surface_; | 795 scoped_ptr<RenderSurfaceImpl> render_surface_; |
| 830 | 796 |
| 831 bool force_render_surface_; | 797 bool force_render_surface_; |
| 832 | 798 |
| 833 std::vector<FrameTimingRequest> frame_timing_requests_; | 799 std::vector<FrameTimingRequest> frame_timing_requests_; |
| 834 bool frame_timing_requests_dirty_; | 800 bool frame_timing_requests_dirty_; |
| 835 bool visited_; | 801 bool visited_; |
| 836 bool layer_or_descendant_is_drawn_; | 802 bool layer_or_descendant_is_drawn_; |
| 837 // If true, the layer or one of its descendants has a touch handler. | 803 // If true, the layer or one of its descendants has a touch handler. |
| 838 bool layer_or_descendant_has_touch_handler_; | 804 bool layer_or_descendant_has_touch_handler_; |
| 839 bool sorted_for_recursion_; | 805 bool sorted_for_recursion_; |
| 840 | 806 |
| 841 DISALLOW_COPY_AND_ASSIGN(LayerImpl); | 807 DISALLOW_COPY_AND_ASSIGN(LayerImpl); |
| 842 }; | 808 }; |
| 843 | 809 |
| 844 } // namespace cc | 810 } // namespace cc |
| 845 | 811 |
| 846 #endif // CC_LAYERS_LAYER_IMPL_H_ | 812 #endif // CC_LAYERS_LAYER_IMPL_H_ |
| OLD | NEW |