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 #include "cc/trees/layer_tree_host_impl.h" | 5 #include "cc/trees/layer_tree_host_impl.h" |
6 | 6 |
7 #include <cmath> | 7 #include <cmath> |
8 | 8 |
9 #include "base/bind.h" | 9 #include "base/bind.h" |
10 #include "base/command_line.h" | 10 #include "base/command_line.h" |
(...skipping 99 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
110 virtual void OnCanDrawStateChanged(bool can_draw) OVERRIDE { | 110 virtual void OnCanDrawStateChanged(bool can_draw) OVERRIDE { |
111 on_can_draw_state_changed_called_ = true; | 111 on_can_draw_state_changed_called_ = true; |
112 } | 112 } |
113 virtual void NotifyReadyToActivate() OVERRIDE { | 113 virtual void NotifyReadyToActivate() OVERRIDE { |
114 did_notify_ready_to_activate_ = true; | 114 did_notify_ready_to_activate_ = true; |
115 host_impl_->ActivatePendingTree(); | 115 host_impl_->ActivatePendingTree(); |
116 } | 116 } |
117 virtual void SetNeedsRedrawOnImplThread() OVERRIDE { | 117 virtual void SetNeedsRedrawOnImplThread() OVERRIDE { |
118 did_request_redraw_ = true; | 118 did_request_redraw_ = true; |
119 } | 119 } |
120 virtual void SetNeedsRedrawRectOnImplThread(gfx::Rect damage_rect) OVERRIDE { | 120 virtual void SetNeedsRedrawRectOnImplThread( |
| 121 const gfx::Rect& damage_rect) OVERRIDE { |
121 did_request_redraw_ = true; | 122 did_request_redraw_ = true; |
122 } | 123 } |
123 virtual void SetNeedsManageTilesOnImplThread() OVERRIDE { | 124 virtual void SetNeedsManageTilesOnImplThread() OVERRIDE { |
124 did_request_manage_tiles_ = true; | 125 did_request_manage_tiles_ = true; |
125 } | 126 } |
126 virtual void DidInitializeVisibleTileOnImplThread() OVERRIDE { | 127 virtual void DidInitializeVisibleTileOnImplThread() OVERRIDE { |
127 did_upload_visible_tile_ = true; | 128 did_upload_visible_tile_ = true; |
128 } | 129 } |
129 virtual void SetNeedsCommitOnImplThread() OVERRIDE { | 130 virtual void SetNeedsCommitOnImplThread() OVERRIDE { |
130 did_request_commit_ = true; | 131 did_request_commit_ = true; |
(...skipping 2648 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2779 } | 2780 } |
2780 | 2781 |
2781 void SetExpectation(bool blend, bool has_render_surface) { | 2782 void SetExpectation(bool blend, bool has_render_surface) { |
2782 blend_ = blend; | 2783 blend_ = blend; |
2783 has_render_surface_ = has_render_surface; | 2784 has_render_surface_ = has_render_surface; |
2784 quads_appended_ = false; | 2785 quads_appended_ = false; |
2785 } | 2786 } |
2786 | 2787 |
2787 bool quads_appended() const { return quads_appended_; } | 2788 bool quads_appended() const { return quads_appended_; } |
2788 | 2789 |
2789 void SetQuadRect(gfx::Rect rect) { quad_rect_ = rect; } | 2790 void SetQuadRect(const gfx::Rect& rect) { quad_rect_ = rect; } |
2790 void SetQuadVisibleRect(gfx::Rect rect) { quad_visible_rect_ = rect; } | 2791 void SetQuadVisibleRect(const gfx::Rect& rect) { quad_visible_rect_ = rect; } |
2791 void SetOpaqueContentRect(gfx::Rect rect) { opaque_content_rect_ = rect; } | 2792 void SetOpaqueContentRect(const gfx::Rect& rect) { |
| 2793 opaque_content_rect_ = rect; |
| 2794 } |
2792 | 2795 |
2793 private: | 2796 private: |
2794 BlendStateCheckLayer(LayerTreeImpl* tree_impl, | 2797 BlendStateCheckLayer(LayerTreeImpl* tree_impl, |
2795 int id, | 2798 int id, |
2796 ResourceProvider* resource_provider) | 2799 ResourceProvider* resource_provider) |
2797 : LayerImpl(tree_impl, id), | 2800 : LayerImpl(tree_impl, id), |
2798 blend_(false), | 2801 blend_(false), |
2799 has_render_surface_(false), | 2802 has_render_surface_(false), |
2800 quads_appended_(false), | 2803 quads_appended_(false), |
2801 quad_rect_(5, 5, 5, 5), | 2804 quad_rect_(5, 5, 5, 5), |
(...skipping 2005 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4807 CompositorFrameAck ack; | 4810 CompositorFrameAck ack; |
4808 host_impl_->ReclaimResources(&ack); | 4811 host_impl_->ReclaimResources(&ack); |
4809 host_impl_->OnSwapBuffersComplete(); | 4812 host_impl_->OnSwapBuffersComplete(); |
4810 EXPECT_EQ(swap_buffers_complete_, 1); | 4813 EXPECT_EQ(swap_buffers_complete_, 1); |
4811 } | 4814 } |
4812 | 4815 |
4813 class CountingSoftwareDevice : public SoftwareOutputDevice { | 4816 class CountingSoftwareDevice : public SoftwareOutputDevice { |
4814 public: | 4817 public: |
4815 CountingSoftwareDevice() : frames_began_(0), frames_ended_(0) {} | 4818 CountingSoftwareDevice() : frames_began_(0), frames_ended_(0) {} |
4816 | 4819 |
4817 virtual SkCanvas* BeginPaint(gfx::Rect damage_rect) OVERRIDE { | 4820 virtual SkCanvas* BeginPaint(const gfx::Rect& damage_rect) OVERRIDE { |
4818 ++frames_began_; | 4821 ++frames_began_; |
4819 return SoftwareOutputDevice::BeginPaint(damage_rect); | 4822 return SoftwareOutputDevice::BeginPaint(damage_rect); |
4820 } | 4823 } |
4821 virtual void EndPaint(SoftwareFrameData* frame_data) OVERRIDE { | 4824 virtual void EndPaint(SoftwareFrameData* frame_data) OVERRIDE { |
4822 ++frames_ended_; | 4825 ++frames_ended_; |
4823 SoftwareOutputDevice::EndPaint(frame_data); | 4826 SoftwareOutputDevice::EndPaint(frame_data); |
4824 } | 4827 } |
4825 | 4828 |
4826 int frames_began_, frames_ended_; | 4829 int frames_began_, frames_ended_; |
4827 }; | 4830 }; |
(...skipping 604 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
5432 &set_needs_redraw_count)); | 5435 &set_needs_redraw_count)); |
5433 // Empty damage rect won't signal the monitor. | 5436 // Empty damage rect won't signal the monitor. |
5434 host_impl_->SetNeedsRedrawRect(gfx::Rect()); | 5437 host_impl_->SetNeedsRedrawRect(gfx::Rect()); |
5435 EXPECT_EQ(0, set_needs_commit_count); | 5438 EXPECT_EQ(0, set_needs_commit_count); |
5436 EXPECT_EQ(2, set_needs_redraw_count); | 5439 EXPECT_EQ(2, set_needs_redraw_count); |
5437 } | 5440 } |
5438 } | 5441 } |
5439 | 5442 |
5440 } // namespace | 5443 } // namespace |
5441 } // namespace cc | 5444 } // namespace cc |
OLD | NEW |