| 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 |
| (...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 49 | 49 |
| 50 class Animation; | 50 class Animation; |
| 51 class AnimationDelegate; | 51 class AnimationDelegate; |
| 52 struct AnimationEvent; | 52 struct AnimationEvent; |
| 53 class CopyOutputRequest; | 53 class CopyOutputRequest; |
| 54 class LayerAnimationDelegate; | 54 class LayerAnimationDelegate; |
| 55 class LayerAnimationEventObserver; | 55 class LayerAnimationEventObserver; |
| 56 class LayerClient; | 56 class LayerClient; |
| 57 class LayerImpl; | 57 class LayerImpl; |
| 58 class LayerTreeHost; | 58 class LayerTreeHost; |
| 59 class LayerTreeHostCommon; |
| 59 class LayerTreeImpl; | 60 class LayerTreeImpl; |
| 60 class PriorityCalculator; | 61 class PriorityCalculator; |
| 61 class RenderingStatsInstrumentation; | 62 class RenderingStatsInstrumentation; |
| 62 class ResourceUpdateQueue; | 63 class ResourceUpdateQueue; |
| 63 class ScrollbarLayerInterface; | 64 class ScrollbarLayerInterface; |
| 64 class SimpleEnclosedRegion; | 65 class SimpleEnclosedRegion; |
| 65 struct AnimationEvent; | 66 struct AnimationEvent; |
| 66 template <typename LayerType> | 67 template <typename LayerType> |
| 67 class OcclusionTracker; | 68 class OcclusionTracker; |
| 68 | 69 |
| (...skipping 101 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 170 bool IsContainerForFixedPositionLayers() const; | 171 bool IsContainerForFixedPositionLayers() const; |
| 171 | 172 |
| 172 void SetPositionConstraint(const LayerPositionConstraint& constraint); | 173 void SetPositionConstraint(const LayerPositionConstraint& constraint); |
| 173 const LayerPositionConstraint& position_constraint() const { | 174 const LayerPositionConstraint& position_constraint() const { |
| 174 return position_constraint_; | 175 return position_constraint_; |
| 175 } | 176 } |
| 176 | 177 |
| 177 void SetTransform(const gfx::Transform& transform); | 178 void SetTransform(const gfx::Transform& transform); |
| 178 const gfx::Transform& transform() const { return transform_; } | 179 const gfx::Transform& transform() const { return transform_; } |
| 179 bool TransformIsAnimating() const; | 180 bool TransformIsAnimating() const; |
| 181 bool AnimationsPreserveAxisAlignment() const; |
| 180 bool transform_is_invertible() const { return transform_is_invertible_; } | 182 bool transform_is_invertible() const { return transform_is_invertible_; } |
| 181 | 183 |
| 182 void SetTransformOrigin(const gfx::Point3F&); | 184 void SetTransformOrigin(const gfx::Point3F&); |
| 183 gfx::Point3F transform_origin() { return transform_origin_; } | 185 gfx::Point3F transform_origin() { return transform_origin_; } |
| 184 | 186 |
| 185 void SetScrollParent(Layer* parent); | 187 void SetScrollParent(Layer* parent); |
| 186 | 188 |
| 187 Layer* scroll_parent() { return scroll_parent_; } | 189 Layer* scroll_parent() { return scroll_parent_; } |
| 188 const Layer* scroll_parent() const { return scroll_parent_; } | 190 const Layer* scroll_parent() const { return scroll_parent_; } |
| 189 | 191 |
| (...skipping 58 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 248 Layer* render_target() { | 250 Layer* render_target() { |
| 249 DCHECK(!draw_properties_.render_target || | 251 DCHECK(!draw_properties_.render_target || |
| 250 draw_properties_.render_target->render_surface()); | 252 draw_properties_.render_target->render_surface()); |
| 251 return draw_properties_.render_target; | 253 return draw_properties_.render_target; |
| 252 } | 254 } |
| 253 const Layer* render_target() const { | 255 const Layer* render_target() const { |
| 254 DCHECK(!draw_properties_.render_target || | 256 DCHECK(!draw_properties_.render_target || |
| 255 draw_properties_.render_target->render_surface()); | 257 draw_properties_.render_target->render_surface()); |
| 256 return draw_properties_.render_target; | 258 return draw_properties_.render_target; |
| 257 } | 259 } |
| 258 RenderSurface* render_surface() const { | |
| 259 return draw_properties_.render_surface.get(); | |
| 260 } | |
| 261 int num_unclipped_descendants() const { | 260 int num_unclipped_descendants() const { |
| 262 return draw_properties_.num_unclipped_descendants; | 261 return draw_properties_.num_unclipped_descendants; |
| 263 } | 262 } |
| 264 | 263 |
| 264 RenderSurface* render_surface() const { return render_surface_.get(); } |
| 265 void SetScrollOffset(const gfx::ScrollOffset& scroll_offset); | 265 void SetScrollOffset(const gfx::ScrollOffset& scroll_offset); |
| 266 gfx::ScrollOffset scroll_offset() const { return scroll_offset_; } | 266 gfx::ScrollOffset scroll_offset() const { return scroll_offset_; } |
| 267 void SetScrollOffsetFromImplSide(const gfx::ScrollOffset& scroll_offset); | 267 void SetScrollOffsetFromImplSide(const gfx::ScrollOffset& scroll_offset); |
| 268 | 268 |
| 269 void SetScrollClipLayerId(int clip_layer_id); | 269 void SetScrollClipLayerId(int clip_layer_id); |
| 270 bool scrollable() const { return scroll_clip_layer_id_ != INVALID_ID; } | 270 bool scrollable() const { return scroll_clip_layer_id_ != INVALID_ID; } |
| 271 | 271 |
| 272 void SetUserScrollable(bool horizontal, bool vertical); | 272 void SetUserScrollable(bool horizontal, bool vertical); |
| 273 bool user_scrollable_horizontal() const { | 273 bool user_scrollable_horizontal() const { |
| 274 return user_scrollable_horizontal_; | 274 return user_scrollable_horizontal_; |
| (...skipping 94 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 369 virtual bool IsSuitableForGpuRasterization() const; | 369 virtual bool IsSuitableForGpuRasterization() const; |
| 370 | 370 |
| 371 virtual scoped_refptr<base::debug::ConvertableToTraceFormat> TakeDebugInfo(); | 371 virtual scoped_refptr<base::debug::ConvertableToTraceFormat> TakeDebugInfo(); |
| 372 | 372 |
| 373 void SetLayerClient(LayerClient* client) { client_ = client; } | 373 void SetLayerClient(LayerClient* client) { client_ = client; } |
| 374 | 374 |
| 375 virtual void PushPropertiesTo(LayerImpl* layer); | 375 virtual void PushPropertiesTo(LayerImpl* layer); |
| 376 | 376 |
| 377 void CreateRenderSurface(); | 377 void CreateRenderSurface(); |
| 378 void ClearRenderSurface(); | 378 void ClearRenderSurface(); |
| 379 |
| 379 void ClearRenderSurfaceLayerList(); | 380 void ClearRenderSurfaceLayerList(); |
| 380 | 381 |
| 381 // The contents scale converts from logical, non-page-scaled pixels to target | 382 // The contents scale converts from logical, non-page-scaled pixels to target |
| 382 // pixels. The contents scale is 1 for the root layer as it is already in | 383 // pixels. The contents scale is 1 for the root layer as it is already in |
| 383 // physical pixels. By default contents scale is forced to be 1 except for | 384 // physical pixels. By default contents scale is forced to be 1 except for |
| 384 // subclasses of ContentsScalingLayer. | 385 // subclasses of ContentsScalingLayer. |
| 385 float contents_scale_x() const { return draw_properties_.contents_scale_x; } | 386 float contents_scale_x() const { return draw_properties_.contents_scale_x; } |
| 386 float contents_scale_y() const { return draw_properties_.contents_scale_y; } | 387 float contents_scale_y() const { return draw_properties_.contents_scale_y; } |
| 387 gfx::Size content_bounds() const { return draw_properties_.content_bounds; } | 388 gfx::Size content_bounds() const { return draw_properties_.content_bounds; } |
| 388 | 389 |
| (...skipping 145 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 534 // will be handled implicitly after the update completes. | 535 // will be handled implicitly after the update completes. |
| 535 bool ignore_set_needs_commit_; | 536 bool ignore_set_needs_commit_; |
| 536 | 537 |
| 537 // Layers that share a sorting context id will be sorted together in 3d | 538 // Layers that share a sorting context id will be sorted together in 3d |
| 538 // space. 0 is a special value that means this layer will not be sorted and | 539 // space. 0 is a special value that means this layer will not be sorted and |
| 539 // will be drawn in paint order. | 540 // will be drawn in paint order. |
| 540 int sorting_context_id_; | 541 int sorting_context_id_; |
| 541 | 542 |
| 542 private: | 543 private: |
| 543 friend class base::RefCounted<Layer>; | 544 friend class base::RefCounted<Layer>; |
| 544 | 545 friend class LayerTreeHostCommon; |
| 545 void SetParent(Layer* layer); | 546 void SetParent(Layer* layer); |
| 546 bool DescendantIsFixedToContainerLayer() const; | 547 bool DescendantIsFixedToContainerLayer() const; |
| 547 | 548 |
| 549 // This should only be called during BeginMainFrame since it does not |
| 550 // trigger a Commit. |
| 551 void SetHasRenderSurface(bool has_render_surface); |
| 552 |
| 548 // Returns the index of the child or -1 if not found. | 553 // Returns the index of the child or -1 if not found. |
| 549 int IndexOfChild(const Layer* reference); | 554 int IndexOfChild(const Layer* reference); |
| 550 | 555 |
| 551 // This should only be called from RemoveFromParent(). | 556 // This should only be called from RemoveFromParent(). |
| 552 void RemoveChildOrDependent(Layer* child); | 557 void RemoveChildOrDependent(Layer* child); |
| 553 | 558 |
| 554 // LayerAnimationValueProvider implementation. | 559 // LayerAnimationValueProvider implementation. |
| 555 gfx::ScrollOffset ScrollOffsetForAnimation() const override; | 560 gfx::ScrollOffset ScrollOffsetForAnimation() const override; |
| 556 | 561 |
| 557 // LayerAnimationValueObserver implementation. | 562 // LayerAnimationValueObserver implementation. |
| (...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 600 bool draws_content_ : 1; | 605 bool draws_content_ : 1; |
| 601 bool hide_layer_and_subtree_ : 1; | 606 bool hide_layer_and_subtree_ : 1; |
| 602 bool masks_to_bounds_ : 1; | 607 bool masks_to_bounds_ : 1; |
| 603 bool contents_opaque_ : 1; | 608 bool contents_opaque_ : 1; |
| 604 bool double_sided_ : 1; | 609 bool double_sided_ : 1; |
| 605 bool should_flatten_transform_ : 1; | 610 bool should_flatten_transform_ : 1; |
| 606 bool use_parent_backface_visibility_ : 1; | 611 bool use_parent_backface_visibility_ : 1; |
| 607 bool draw_checkerboard_for_missing_tiles_ : 1; | 612 bool draw_checkerboard_for_missing_tiles_ : 1; |
| 608 bool force_render_surface_ : 1; | 613 bool force_render_surface_ : 1; |
| 609 bool transform_is_invertible_ : 1; | 614 bool transform_is_invertible_ : 1; |
| 615 bool has_render_surface_ : 1; |
| 610 Region non_fast_scrollable_region_; | 616 Region non_fast_scrollable_region_; |
| 611 Region touch_event_handler_region_; | 617 Region touch_event_handler_region_; |
| 612 gfx::PointF position_; | 618 gfx::PointF position_; |
| 613 SkColor background_color_; | 619 SkColor background_color_; |
| 614 float opacity_; | 620 float opacity_; |
| 615 SkXfermode::Mode blend_mode_; | 621 SkXfermode::Mode blend_mode_; |
| 616 FilterOperations filters_; | 622 FilterOperations filters_; |
| 617 FilterOperations background_filters_; | 623 FilterOperations background_filters_; |
| 618 LayerPositionConstraint position_constraint_; | 624 LayerPositionConstraint position_constraint_; |
| 619 Layer* scroll_parent_; | 625 Layer* scroll_parent_; |
| (...skipping 13 matching lines...) Expand all Loading... |
| 633 | 639 |
| 634 LayerClient* client_; | 640 LayerClient* client_; |
| 635 | 641 |
| 636 ScopedPtrVector<CopyOutputRequest> copy_requests_; | 642 ScopedPtrVector<CopyOutputRequest> copy_requests_; |
| 637 | 643 |
| 638 base::Closure did_scroll_callback_; | 644 base::Closure did_scroll_callback_; |
| 639 | 645 |
| 640 DrawProperties<Layer> draw_properties_; | 646 DrawProperties<Layer> draw_properties_; |
| 641 | 647 |
| 642 PaintProperties paint_properties_; | 648 PaintProperties paint_properties_; |
| 649 // TODO(awoloszyn): This is redundant with has_render_surface_, |
| 650 // and should get removed once it is no longer needed on main thread. |
| 651 scoped_ptr<RenderSurface> render_surface_; |
| 643 | 652 |
| 644 DISALLOW_COPY_AND_ASSIGN(Layer); | 653 DISALLOW_COPY_AND_ASSIGN(Layer); |
| 645 }; | 654 }; |
| 646 | 655 |
| 647 } // namespace cc | 656 } // namespace cc |
| 648 | 657 |
| 649 #endif // CC_LAYERS_LAYER_H_ | 658 #endif // CC_LAYERS_LAYER_H_ |
| OLD | NEW |