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 <stddef.h> | 8 #include <stddef.h> |
9 #include <stdint.h> | 9 #include <stdint.h> |
10 | 10 |
(...skipping 85 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
96 bool HasAncestor(const Layer* ancestor) const; | 96 bool HasAncestor(const Layer* ancestor) const; |
97 | 97 |
98 const LayerList& children() const { return children_; } | 98 const LayerList& children() const { return children_; } |
99 Layer* child_at(size_t index) { return children_[index].get(); } | 99 Layer* child_at(size_t index) { return children_[index].get(); } |
100 | 100 |
101 // This requests the layer and its subtree be rendered and given to the | 101 // This requests the layer and its subtree be rendered and given to the |
102 // callback. If the copy is unable to be produced (the layer is destroyed | 102 // callback. If the copy is unable to be produced (the layer is destroyed |
103 // first), then the callback is called with a nullptr/empty result. If the | 103 // first), then the callback is called with a nullptr/empty result. If the |
104 // request's source property is set, any prior uncommitted requests having the | 104 // request's source property is set, any prior uncommitted requests having the |
105 // same source will be aborted. | 105 // same source will be aborted. |
106 void RequestCopyOfOutput(scoped_ptr<CopyOutputRequest> request); | 106 void RequestCopyOfOutput(std::unique_ptr<CopyOutputRequest> request); |
107 bool HasCopyRequest() const { | 107 bool HasCopyRequest() const { |
108 return !copy_requests_.empty(); | 108 return !copy_requests_.empty(); |
109 } | 109 } |
110 | 110 |
111 virtual void SetBackgroundColor(SkColor background_color); | 111 virtual void SetBackgroundColor(SkColor background_color); |
112 SkColor background_color() const { return background_color_; } | 112 SkColor background_color() const { return background_color_; } |
113 void SetSafeOpaqueBackgroundColor(SkColor background_color); | 113 void SetSafeOpaqueBackgroundColor(SkColor background_color); |
114 // If contents_opaque(), return an opaque color else return a | 114 // If contents_opaque(), return an opaque color else return a |
115 // non-opaque color. Tries to return background_color(), if possible. | 115 // non-opaque color. Tries to return background_color(), if possible. |
116 SkColor SafeOpaqueBackgroundColor() const; | 116 SkColor SafeOpaqueBackgroundColor() const; |
(...skipping 226 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
343 | 343 |
344 // This methods typically need to be overwritten by derived classes. | 344 // This methods typically need to be overwritten by derived classes. |
345 // TODO(chrishtr): Blink no longer resizes anything during paint. We can | 345 // TODO(chrishtr): Blink no longer resizes anything during paint. We can |
346 // remove this. | 346 // remove this. |
347 virtual void SavePaintProperties(); | 347 virtual void SavePaintProperties(); |
348 // Returns true iff anything was updated that needs to be committed. | 348 // Returns true iff anything was updated that needs to be committed. |
349 virtual bool Update(); | 349 virtual bool Update(); |
350 virtual void SetIsMask(bool is_mask) {} | 350 virtual void SetIsMask(bool is_mask) {} |
351 virtual bool IsSuitableForGpuRasterization() const; | 351 virtual bool IsSuitableForGpuRasterization() const; |
352 | 352 |
353 virtual scoped_ptr<base::trace_event::ConvertableToTraceFormat> | 353 virtual std::unique_ptr<base::trace_event::ConvertableToTraceFormat> |
354 TakeDebugInfo(); | 354 TakeDebugInfo(); |
355 | 355 |
356 void SetLayerClient(LayerClient* client) { client_ = client; } | 356 void SetLayerClient(LayerClient* client) { client_ = client; } |
357 | 357 |
358 virtual void PushPropertiesTo(LayerImpl* layer); | 358 virtual void PushPropertiesTo(LayerImpl* layer); |
359 | 359 |
360 // Sets the type proto::LayerType that should be used for serialization | 360 // Sets the type proto::LayerType that should be used for serialization |
361 // of the current layer by calling LayerNode::set_type(proto::LayerType). | 361 // of the current layer by calling LayerNode::set_type(proto::LayerType). |
362 // TODO(nyquist): Start using a forward declared enum class when | 362 // TODO(nyquist): Start using a forward declared enum class when |
363 // https://github.com/google/protobuf/issues/67 has been fixed and rolled in. | 363 // https://github.com/google/protobuf/issues/67 has been fixed and rolled in. |
(...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
402 void FromLayerPropertiesProto(const proto::LayerProperties& proto); | 402 void FromLayerPropertiesProto(const proto::LayerProperties& proto); |
403 | 403 |
404 LayerTreeHost* layer_tree_host() { return layer_tree_host_; } | 404 LayerTreeHost* layer_tree_host() { return layer_tree_host_; } |
405 const LayerTreeHost* layer_tree_host() const { return layer_tree_host_; } | 405 const LayerTreeHost* layer_tree_host() const { return layer_tree_host_; } |
406 | 406 |
407 virtual ScrollbarLayerInterface* ToScrollbarLayer(); | 407 virtual ScrollbarLayerInterface* ToScrollbarLayer(); |
408 | 408 |
409 virtual sk_sp<SkPicture> GetPicture() const; | 409 virtual sk_sp<SkPicture> GetPicture() const; |
410 | 410 |
411 // Constructs a LayerImpl of the correct runtime type for this Layer type. | 411 // Constructs a LayerImpl of the correct runtime type for this Layer type. |
412 virtual scoped_ptr<LayerImpl> CreateLayerImpl(LayerTreeImpl* tree_impl); | 412 virtual std::unique_ptr<LayerImpl> CreateLayerImpl(LayerTreeImpl* tree_impl); |
413 | 413 |
414 bool NeedsDisplayForTesting() const { return !update_rect_.IsEmpty(); } | 414 bool NeedsDisplayForTesting() const { return !update_rect_.IsEmpty(); } |
415 void ResetNeedsDisplayForTesting() { update_rect_ = gfx::Rect(); } | 415 void ResetNeedsDisplayForTesting() { update_rect_ = gfx::Rect(); } |
416 | 416 |
417 RenderingStatsInstrumentation* rendering_stats_instrumentation() const; | 417 RenderingStatsInstrumentation* rendering_stats_instrumentation() const; |
418 | 418 |
419 const PaintProperties& paint_properties() const { | 419 const PaintProperties& paint_properties() const { |
420 return paint_properties_; | 420 return paint_properties_; |
421 } | 421 } |
422 | 422 |
(...skipping 236 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
659 SkColor safe_opaque_background_color_; | 659 SkColor safe_opaque_background_color_; |
660 float opacity_; | 660 float opacity_; |
661 SkXfermode::Mode blend_mode_; | 661 SkXfermode::Mode blend_mode_; |
662 // draw_blend_mode may be different than blend_mode_, | 662 // draw_blend_mode may be different than blend_mode_, |
663 // when a RenderSurface re-parents the layer's blend_mode. | 663 // when a RenderSurface re-parents the layer's blend_mode. |
664 SkXfermode::Mode draw_blend_mode_; | 664 SkXfermode::Mode draw_blend_mode_; |
665 FilterOperations filters_; | 665 FilterOperations filters_; |
666 FilterOperations background_filters_; | 666 FilterOperations background_filters_; |
667 LayerPositionConstraint position_constraint_; | 667 LayerPositionConstraint position_constraint_; |
668 Layer* scroll_parent_; | 668 Layer* scroll_parent_; |
669 scoped_ptr<std::set<Layer*>> scroll_children_; | 669 std::unique_ptr<std::set<Layer*>> scroll_children_; |
670 | 670 |
671 Layer* clip_parent_; | 671 Layer* clip_parent_; |
672 scoped_ptr<std::set<Layer*>> clip_children_; | 672 std::unique_ptr<std::set<Layer*>> clip_children_; |
673 | 673 |
674 gfx::Transform transform_; | 674 gfx::Transform transform_; |
675 gfx::Point3F transform_origin_; | 675 gfx::Point3F transform_origin_; |
676 | 676 |
677 // Replica layer used for reflections. | 677 // Replica layer used for reflections. |
678 scoped_refptr<Layer> replica_layer_; | 678 scoped_refptr<Layer> replica_layer_; |
679 | 679 |
680 LayerClient* client_; | 680 LayerClient* client_; |
681 | 681 |
682 std::vector<scoped_ptr<CopyOutputRequest>> copy_requests_; | 682 std::vector<std::unique_ptr<CopyOutputRequest>> copy_requests_; |
683 | 683 |
684 base::Closure did_scroll_callback_; | 684 base::Closure did_scroll_callback_; |
685 | 685 |
686 PaintProperties paint_properties_; | 686 PaintProperties paint_properties_; |
687 | 687 |
688 // These all act like draw properties, so don't need push properties. | 688 // These all act like draw properties, so don't need push properties. |
689 gfx::Rect visible_layer_rect_; | 689 gfx::Rect visible_layer_rect_; |
690 size_t num_unclipped_descendants_; | 690 size_t num_unclipped_descendants_; |
691 | 691 |
692 std::vector<FrameTimingRequest> frame_timing_requests_; | 692 std::vector<FrameTimingRequest> frame_timing_requests_; |
693 bool frame_timing_requests_dirty_; | 693 bool frame_timing_requests_dirty_; |
694 | 694 |
695 DISALLOW_COPY_AND_ASSIGN(Layer); | 695 DISALLOW_COPY_AND_ASSIGN(Layer); |
696 }; | 696 }; |
697 | 697 |
698 } // namespace cc | 698 } // namespace cc |
699 | 699 |
700 #endif // CC_LAYERS_LAYER_H_ | 700 #endif // CC_LAYERS_LAYER_H_ |
OLD | NEW |