| 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 <string> | 8 #include <string> |
| 9 | 9 |
| 10 #include "base/logging.h" | 10 #include "base/logging.h" |
| (...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 42 class LayerTreeHostImpl; | 42 class LayerTreeHostImpl; |
| 43 class LayerTreeImpl; | 43 class LayerTreeImpl; |
| 44 class QuadSink; | 44 class QuadSink; |
| 45 class Renderer; | 45 class Renderer; |
| 46 class ScrollbarAnimationController; | 46 class ScrollbarAnimationController; |
| 47 class ScrollbarLayerImpl; | 47 class ScrollbarLayerImpl; |
| 48 class Layer; | 48 class Layer; |
| 49 | 49 |
| 50 struct AppendQuadsData; | 50 struct AppendQuadsData; |
| 51 | 51 |
| 52 // TODO(boliu): move to somewhere in cc/base? |
| 53 enum DrawMode { |
| 54 DRAW_MODE_NONE, |
| 55 DRAW_MODE_HARDWARE, |
| 56 DRAW_MODE_SOFTWARE, |
| 57 DRAW_MODE_RESOURCELESS_SOFTWARE |
| 58 }; |
| 59 |
| 52 class CC_EXPORT LayerImpl : LayerAnimationValueObserver { | 60 class CC_EXPORT LayerImpl : LayerAnimationValueObserver { |
| 53 public: | 61 public: |
| 54 static scoped_ptr<LayerImpl> Create(LayerTreeImpl* tree_impl, int id) { | 62 static scoped_ptr<LayerImpl> Create(LayerTreeImpl* tree_impl, int id) { |
| 55 return make_scoped_ptr(new LayerImpl(tree_impl, id)); | 63 return make_scoped_ptr(new LayerImpl(tree_impl, id)); |
| 56 } | 64 } |
| 57 | 65 |
| 58 virtual ~LayerImpl(); | 66 virtual ~LayerImpl(); |
| 59 | 67 |
| 60 int id() const { return layer_id_; } | 68 int id() const { return layer_id_; } |
| 61 | 69 |
| (...skipping 30 matching lines...) Expand all Loading... |
| 92 | 100 |
| 93 bool has_mask() const { return mask_layer_; } | 101 bool has_mask() const { return mask_layer_; } |
| 94 bool has_replica() const { return replica_layer_; } | 102 bool has_replica() const { return replica_layer_; } |
| 95 bool replica_has_mask() const { | 103 bool replica_has_mask() const { |
| 96 return replica_layer_ && (mask_layer_ || replica_layer_->mask_layer_); | 104 return replica_layer_ && (mask_layer_ || replica_layer_->mask_layer_); |
| 97 } | 105 } |
| 98 | 106 |
| 99 LayerTreeImpl* layer_tree_impl() const { return layer_tree_impl_; } | 107 LayerTreeImpl* layer_tree_impl() const { return layer_tree_impl_; } |
| 100 | 108 |
| 101 scoped_ptr<SharedQuadState> CreateSharedQuadState() const; | 109 scoped_ptr<SharedQuadState> CreateSharedQuadState() const; |
| 110 // TODO(boliu): update comment before commit |
| 102 // WillDraw must be called before AppendQuads. If WillDraw is called, | 111 // WillDraw must be called before AppendQuads. If WillDraw is called, |
| 103 // DidDraw is guaranteed to be called before another WillDraw or before | 112 // DidDraw is guaranteed to be called before another WillDraw or before |
| 104 // the layer is destroyed. To enforce this, any class that overrides | 113 // the layer is destroyed. To enforce this, any class that overrides |
| 105 // WillDraw/DqidDraw must call the base class version. | 114 // WillDraw/DqidDraw must call the base class version. |
| 106 virtual void WillDraw(ResourceProvider* resource_provider); | 115 virtual bool WillDraw(DrawMode draw_mode, |
| 116 ResourceProvider* resource_provider); |
| 107 virtual void AppendQuads(QuadSink* quad_sink, | 117 virtual void AppendQuads(QuadSink* quad_sink, |
| 108 AppendQuadsData* append_quads_data) {} | 118 AppendQuadsData* append_quads_data) {} |
| 109 virtual void DidDraw(ResourceProvider* resource_provider); | 119 virtual void DidDraw(ResourceProvider* resource_provider); |
| 110 | 120 |
| 111 virtual ResourceProvider::ResourceId ContentsResourceId() const; | 121 virtual ResourceProvider::ResourceId ContentsResourceId() const; |
| 112 | 122 |
| 113 virtual bool HasDelegatedContent() const; | 123 virtual bool HasDelegatedContent() const; |
| 114 virtual bool HasContributingDelegatedRenderPasses() const; | 124 virtual bool HasContributingDelegatedRenderPasses() const; |
| 115 virtual RenderPass::Id FirstContributingRenderPassId() const; | 125 virtual RenderPass::Id FirstContributingRenderPassId() const; |
| 116 virtual RenderPass::Id NextContributingRenderPassId(RenderPass::Id id) const; | 126 virtual RenderPass::Id NextContributingRenderPassId(RenderPass::Id id) const; |
| (...skipping 406 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 523 float draw_depth_; | 533 float draw_depth_; |
| 524 | 534 |
| 525 // Debug layer name. | 535 // Debug layer name. |
| 526 std::string debug_name_; | 536 std::string debug_name_; |
| 527 CompositingReasons compositing_reasons_; | 537 CompositingReasons compositing_reasons_; |
| 528 | 538 |
| 529 WebKit::WebFilterOperations filters_; | 539 WebKit::WebFilterOperations filters_; |
| 530 WebKit::WebFilterOperations background_filters_; | 540 WebKit::WebFilterOperations background_filters_; |
| 531 skia::RefPtr<SkImageFilter> filter_; | 541 skia::RefPtr<SkImageFilter> filter_; |
| 532 | 542 |
| 533 #ifndef NDEBUG | 543 protected: |
| 534 bool between_will_draw_and_did_draw_; | 544 DrawMode current_draw_mode_; |
| 535 #endif | 545 |
| 546 private: |
| 536 | 547 |
| 537 // Rect indicating what was repainted/updated during update. | 548 // Rect indicating what was repainted/updated during update. |
| 538 // Note that plugin layers bypass this and leave it empty. | 549 // Note that plugin layers bypass this and leave it empty. |
| 539 // Uses layer's content space. | 550 // Uses layer's content space. |
| 540 gfx::RectF update_rect_; | 551 gfx::RectF update_rect_; |
| 541 | 552 |
| 542 // Manages animations for this layer. | 553 // Manages animations for this layer. |
| 543 scoped_refptr<LayerAnimationController> layer_animation_controller_; | 554 scoped_refptr<LayerAnimationController> layer_animation_controller_; |
| 544 | 555 |
| 545 // Manages scrollbars for this layer | 556 // Manages scrollbars for this layer |
| 546 scoped_ptr<ScrollbarAnimationController> scrollbar_animation_controller_; | 557 scoped_ptr<ScrollbarAnimationController> scrollbar_animation_controller_; |
| 547 | 558 |
| 548 // Weak pointers to this layer's scrollbars, if it has them. Updated during | 559 // Weak pointers to this layer's scrollbars, if it has them. Updated during |
| 549 // tree synchronization. | 560 // tree synchronization. |
| 550 ScrollbarLayerImpl* horizontal_scrollbar_layer_; | 561 ScrollbarLayerImpl* horizontal_scrollbar_layer_; |
| 551 ScrollbarLayerImpl* vertical_scrollbar_layer_; | 562 ScrollbarLayerImpl* vertical_scrollbar_layer_; |
| 552 | 563 |
| 553 ScopedPtrVector<CopyOutputRequest> copy_requests_; | 564 ScopedPtrVector<CopyOutputRequest> copy_requests_; |
| 554 | 565 |
| 555 // Group of properties that need to be computed based on the layer tree | 566 // Group of properties that need to be computed based on the layer tree |
| 556 // hierarchy before layers can be drawn. | 567 // hierarchy before layers can be drawn. |
| 557 DrawProperties<LayerImpl, RenderSurfaceImpl> draw_properties_; | 568 DrawProperties<LayerImpl, RenderSurfaceImpl> draw_properties_; |
| 558 | 569 |
| 559 DISALLOW_COPY_AND_ASSIGN(LayerImpl); | 570 DISALLOW_COPY_AND_ASSIGN(LayerImpl); |
| 560 }; | 571 }; |
| 561 | 572 |
| 562 } // namespace cc | 573 } // namespace cc |
| 563 | 574 |
| 564 #endif // CC_LAYERS_LAYER_IMPL_H_ | 575 #endif // CC_LAYERS_LAYER_IMPL_H_ |
| OLD | NEW |