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 4988 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4999 | 4999 |
5000 virtual bool HaveCachedResourcesForRenderPassId(RenderPass::Id id) const | 5000 virtual bool HaveCachedResourcesForRenderPassId(RenderPass::Id id) const |
5001 OVERRIDE { | 5001 OVERRIDE { |
5002 return textures_.count(id); | 5002 return textures_.count(id); |
5003 } | 5003 } |
5004 | 5004 |
5005 // RendererClient implementation. | 5005 // RendererClient implementation. |
5006 virtual gfx::Rect DeviceViewport() const OVERRIDE { | 5006 virtual gfx::Rect DeviceViewport() const OVERRIDE { |
5007 return gfx::Rect(viewport_size_); | 5007 return gfx::Rect(viewport_size_); |
5008 } | 5008 } |
| 5009 virtual gfx::Rect DeviceClip() const OVERRIDE { |
| 5010 return DeviceViewport(); |
| 5011 } |
5009 virtual float DeviceScaleFactor() const OVERRIDE { | 5012 virtual float DeviceScaleFactor() const OVERRIDE { |
5010 return 1.f; | 5013 return 1.f; |
5011 } | 5014 } |
5012 virtual const LayerTreeSettings& Settings() const OVERRIDE { | 5015 virtual const LayerTreeSettings& Settings() const OVERRIDE { |
5013 return settings_; | 5016 return settings_; |
5014 } | 5017 } |
5015 virtual void SetFullRootLayerDamage() OVERRIDE {} | 5018 virtual void SetFullRootLayerDamage() OVERRIDE {} |
5016 virtual bool HasImplThread() const OVERRIDE { return false; } | 5019 virtual bool HasImplThread() const OVERRIDE { return false; } |
5017 virtual bool ShouldClearRootRenderPass() const OVERRIDE { return true; } | 5020 virtual bool ShouldClearRootRenderPass() const OVERRIDE { return true; } |
5018 virtual CompositorFrameMetadata MakeCompositorFrameMetadata() const | 5021 virtual CompositorFrameMetadata MakeCompositorFrameMetadata() const |
(...skipping 415 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
5434 child->SetAnchorPoint(gfx::PointF(0.f, 0.f)); | 5437 child->SetAnchorPoint(gfx::PointF(0.f, 0.f)); |
5435 child->SetPosition(gfx::PointF(9.f, 9.f)); | 5438 child->SetPosition(gfx::PointF(9.f, 9.f)); |
5436 child->SetBounds(gfx::Size(1, 1)); | 5439 child->SetBounds(gfx::Size(1, 1)); |
5437 child->SetContentBounds(gfx::Size(1, 1)); | 5440 child->SetContentBounds(gfx::Size(1, 1)); |
5438 child->SetDrawsContent(true); | 5441 child->SetDrawsContent(true); |
5439 root->AddChild(child.PassAs<LayerImpl>()); | 5442 root->AddChild(child.PassAs<LayerImpl>()); |
5440 | 5443 |
5441 host_impl_->active_tree()->SetRootLayer(root.PassAs<LayerImpl>()); | 5444 host_impl_->active_tree()->SetRootLayer(root.PassAs<LayerImpl>()); |
5442 | 5445 |
5443 // Draw a frame. In the first frame, the entire viewport should be damaged. | 5446 // Draw a frame. In the first frame, the entire viewport should be damaged. |
5444 gfx::Rect full_frame_damage = gfx::Rect(host_impl_->device_viewport_size()); | 5447 gfx::Rect full_frame_damage(host_impl_->DrawViewportSize()); |
5445 DrawFrameAndTestDamage(full_frame_damage); | 5448 DrawFrameAndTestDamage(full_frame_damage); |
5446 | 5449 |
5447 // The second frame has damage that doesn't touch the child layer. Its quads | 5450 // The second frame has damage that doesn't touch the child layer. Its quads |
5448 // should still be generated. | 5451 // should still be generated. |
5449 gfx::Rect small_damage = gfx::Rect(0, 0, 1, 1); | 5452 gfx::Rect small_damage = gfx::Rect(0, 0, 1, 1); |
5450 host_impl_->active_tree()->root_layer()->set_update_rect(small_damage); | 5453 host_impl_->active_tree()->root_layer()->set_update_rect(small_damage); |
5451 DrawFrameAndTestDamage(small_damage); | 5454 DrawFrameAndTestDamage(small_damage); |
5452 | 5455 |
5453 // The third frame should have no damage, so no quads should be generated. | 5456 // The third frame should have no damage, so no quads should be generated. |
5454 gfx::Rect no_damage; | 5457 gfx::Rect no_damage; |
(...skipping 1010 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
6465 EXPECT_EQ(0u, host_impl_->ResourceIdForUIResource(ui_resource_id)); | 6468 EXPECT_EQ(0u, host_impl_->ResourceIdForUIResource(ui_resource_id)); |
6466 EXPECT_EQ(0u, context3d->NumTextures()); | 6469 EXPECT_EQ(0u, context3d->NumTextures()); |
6467 | 6470 |
6468 // Should not change state for multiple deletion on one UIResourceId | 6471 // Should not change state for multiple deletion on one UIResourceId |
6469 host_impl_->DeleteUIResource(ui_resource_id); | 6472 host_impl_->DeleteUIResource(ui_resource_id); |
6470 EXPECT_EQ(0u, context3d->NumTextures()); | 6473 EXPECT_EQ(0u, context3d->NumTextures()); |
6471 } | 6474 } |
6472 | 6475 |
6473 } // namespace | 6476 } // namespace |
6474 } // namespace cc | 6477 } // namespace cc |
OLD | NEW |