| 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 415 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 551 | 528 |
| 552 void AddDamageRect(const gfx::Rect& damage_rect); | 529 void AddDamageRect(const gfx::Rect& damage_rect); |
| 553 const gfx::Rect& damage_rect() const { return damage_rect_; } | 530 const gfx::Rect& damage_rect() const { return damage_rect_; } |
| 554 | 531 |
| 555 virtual base::DictionaryValue* LayerTreeAsJson() const; | 532 virtual base::DictionaryValue* LayerTreeAsJson() const; |
| 556 | 533 |
| 557 bool LayerPropertyChanged() const; | 534 bool LayerPropertyChanged() const; |
| 558 | 535 |
| 559 void ResetAllChangeTrackingForSubtree(); | 536 void ResetAllChangeTrackingForSubtree(); |
| 560 | 537 |
| 561 LayerAnimationController* layer_animation_controller() { | |
| 562 return layer_animation_controller_.get(); | |
| 563 } | |
| 564 | |
| 565 const LayerAnimationController* layer_animation_controller() const { | |
| 566 return layer_animation_controller_.get(); | |
| 567 } | |
| 568 | |
| 569 virtual SimpleEnclosedRegion VisibleOpaqueRegion() const; | 538 virtual SimpleEnclosedRegion VisibleOpaqueRegion() const; |
| 570 | 539 |
| 571 virtual void DidBecomeActive() {} | 540 virtual void DidBecomeActive() {} |
| 572 | 541 |
| 573 virtual void DidBeginTracing(); | 542 virtual void DidBeginTracing(); |
| 574 | 543 |
| 575 // Release resources held by this layer. Called when the output surface | 544 // Release resources held by this layer. Called when the output surface |
| 576 // that rendered this layer was lost or a rendering mode switch has occured. | 545 // that rendered this layer was lost or a rendering mode switch has occured. |
| 577 virtual void ReleaseResources(); | 546 virtual void ReleaseResources(); |
| 578 | 547 |
| (...skipping 229 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 808 uint32_t mutable_properties_; | 777 uint32_t mutable_properties_; |
| 809 // Rect indicating what was repainted/updated during update. | 778 // Rect indicating what was repainted/updated during update. |
| 810 // Note that plugin layers bypass this and leave it empty. | 779 // Note that plugin layers bypass this and leave it empty. |
| 811 // This is in the layer's space. | 780 // This is in the layer's space. |
| 812 gfx::Rect update_rect_; | 781 gfx::Rect update_rect_; |
| 813 | 782 |
| 814 // Denotes an area that is damaged and needs redraw. This is in the layer's | 783 // Denotes an area that is damaged and needs redraw. This is in the layer's |
| 815 // space. | 784 // space. |
| 816 gfx::Rect damage_rect_; | 785 gfx::Rect damage_rect_; |
| 817 | 786 |
| 818 // Manages animations for this layer. | |
| 819 scoped_refptr<LayerAnimationController> layer_animation_controller_; | |
| 820 | |
| 821 std::vector<scoped_ptr<CopyOutputRequest>> copy_requests_; | 787 std::vector<scoped_ptr<CopyOutputRequest>> copy_requests_; |
| 822 | 788 |
| 823 // Group of properties that need to be computed based on the layer tree | 789 // Group of properties that need to be computed based on the layer tree |
| 824 // hierarchy before layers can be drawn. | 790 // hierarchy before layers can be drawn. |
| 825 DrawProperties draw_properties_; | 791 DrawProperties draw_properties_; |
| 826 PerformanceProperties<LayerImpl> performance_properties_; | 792 PerformanceProperties<LayerImpl> performance_properties_; |
| 827 | 793 |
| 828 scoped_ptr<base::trace_event::ConvertableToTraceFormat> owned_debug_info_; | 794 scoped_ptr<base::trace_event::ConvertableToTraceFormat> owned_debug_info_; |
| 829 base::trace_event::ConvertableToTraceFormat* debug_info_; | 795 base::trace_event::ConvertableToTraceFormat* debug_info_; |
| 830 scoped_ptr<RenderSurfaceImpl> render_surface_; | 796 scoped_ptr<RenderSurfaceImpl> render_surface_; |
| 831 | 797 |
| 832 bool force_render_surface_; | 798 bool force_render_surface_; |
| 833 | 799 |
| 834 std::vector<FrameTimingRequest> frame_timing_requests_; | 800 std::vector<FrameTimingRequest> frame_timing_requests_; |
| 835 bool frame_timing_requests_dirty_; | 801 bool frame_timing_requests_dirty_; |
| 836 bool visited_; | 802 bool visited_; |
| 837 bool layer_or_descendant_is_drawn_; | 803 bool layer_or_descendant_is_drawn_; |
| 838 // If true, the layer or one of its descendants has a touch handler. | 804 // If true, the layer or one of its descendants has a touch handler. |
| 839 bool layer_or_descendant_has_touch_handler_; | 805 bool layer_or_descendant_has_touch_handler_; |
| 840 bool sorted_for_recursion_; | 806 bool sorted_for_recursion_; |
| 841 | 807 |
| 842 DISALLOW_COPY_AND_ASSIGN(LayerImpl); | 808 DISALLOW_COPY_AND_ASSIGN(LayerImpl); |
| 843 }; | 809 }; |
| 844 | 810 |
| 845 } // namespace cc | 811 } // namespace cc |
| 846 | 812 |
| 847 #endif // CC_LAYERS_LAYER_IMPL_H_ | 813 #endif // CC_LAYERS_LAYER_IMPL_H_ |
| OLD | NEW |