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 4899 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4910 | 4910 |
4911 virtual bool HaveCachedResourcesForRenderPassId(RenderPass::Id id) const | 4911 virtual bool HaveCachedResourcesForRenderPassId(RenderPass::Id id) const |
4912 OVERRIDE { | 4912 OVERRIDE { |
4913 return textures_.count(id); | 4913 return textures_.count(id); |
4914 } | 4914 } |
4915 | 4915 |
4916 // RendererClient implementation. | 4916 // RendererClient implementation. |
4917 virtual gfx::Rect DeviceViewport() const OVERRIDE { | 4917 virtual gfx::Rect DeviceViewport() const OVERRIDE { |
4918 return gfx::Rect(viewport_size_); | 4918 return gfx::Rect(viewport_size_); |
4919 } | 4919 } |
| 4920 virtual gfx::Rect DeviceClip() const OVERRIDE { |
| 4921 return DeviceViewport(); |
| 4922 } |
4920 virtual float DeviceScaleFactor() const OVERRIDE { | 4923 virtual float DeviceScaleFactor() const OVERRIDE { |
4921 return 1.f; | 4924 return 1.f; |
4922 } | 4925 } |
4923 virtual const LayerTreeSettings& Settings() const OVERRIDE { | 4926 virtual const LayerTreeSettings& Settings() const OVERRIDE { |
4924 return settings_; | 4927 return settings_; |
4925 } | 4928 } |
4926 virtual void SetFullRootLayerDamage() OVERRIDE {} | 4929 virtual void SetFullRootLayerDamage() OVERRIDE {} |
4927 virtual bool HasImplThread() const OVERRIDE { return false; } | 4930 virtual bool HasImplThread() const OVERRIDE { return false; } |
4928 virtual bool ShouldClearRootRenderPass() const OVERRIDE { return true; } | 4931 virtual bool ShouldClearRootRenderPass() const OVERRIDE { return true; } |
4929 virtual CompositorFrameMetadata MakeCompositorFrameMetadata() const | 4932 virtual CompositorFrameMetadata MakeCompositorFrameMetadata() const |
(...skipping 415 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
5345 child->SetAnchorPoint(gfx::PointF(0.f, 0.f)); | 5348 child->SetAnchorPoint(gfx::PointF(0.f, 0.f)); |
5346 child->SetPosition(gfx::PointF(9.f, 9.f)); | 5349 child->SetPosition(gfx::PointF(9.f, 9.f)); |
5347 child->SetBounds(gfx::Size(1, 1)); | 5350 child->SetBounds(gfx::Size(1, 1)); |
5348 child->SetContentBounds(gfx::Size(1, 1)); | 5351 child->SetContentBounds(gfx::Size(1, 1)); |
5349 child->SetDrawsContent(true); | 5352 child->SetDrawsContent(true); |
5350 root->AddChild(child.PassAs<LayerImpl>()); | 5353 root->AddChild(child.PassAs<LayerImpl>()); |
5351 | 5354 |
5352 host_impl_->active_tree()->SetRootLayer(root.PassAs<LayerImpl>()); | 5355 host_impl_->active_tree()->SetRootLayer(root.PassAs<LayerImpl>()); |
5353 | 5356 |
5354 // Draw a frame. In the first frame, the entire viewport should be damaged. | 5357 // Draw a frame. In the first frame, the entire viewport should be damaged. |
5355 gfx::Rect full_frame_damage = gfx::Rect(host_impl_->device_viewport_size()); | 5358 gfx::Rect full_frame_damage = host_impl_->DeviceViewport(); |
5356 DrawFrameAndTestDamage(full_frame_damage); | 5359 DrawFrameAndTestDamage(full_frame_damage); |
5357 | 5360 |
5358 // The second frame has damage that doesn't touch the child layer. Its quads | 5361 // The second frame has damage that doesn't touch the child layer. Its quads |
5359 // should still be generated. | 5362 // should still be generated. |
5360 gfx::Rect small_damage = gfx::Rect(0, 0, 1, 1); | 5363 gfx::Rect small_damage = gfx::Rect(0, 0, 1, 1); |
5361 host_impl_->active_tree()->root_layer()->set_update_rect(small_damage); | 5364 host_impl_->active_tree()->root_layer()->set_update_rect(small_damage); |
5362 DrawFrameAndTestDamage(small_damage); | 5365 DrawFrameAndTestDamage(small_damage); |
5363 | 5366 |
5364 // The third frame should have no damage, so no quads should be generated. | 5367 // The third frame should have no damage, so no quads should be generated. |
5365 gfx::Rect no_damage; | 5368 gfx::Rect no_damage; |
(...skipping 1010 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
6376 EXPECT_EQ(0u, host_impl_->ResourceIdForUIResource(ui_resource_id)); | 6379 EXPECT_EQ(0u, host_impl_->ResourceIdForUIResource(ui_resource_id)); |
6377 EXPECT_EQ(0u, context3d->NumTextures()); | 6380 EXPECT_EQ(0u, context3d->NumTextures()); |
6378 | 6381 |
6379 // Should not change state for multiple deletion on one UIResourceId | 6382 // Should not change state for multiple deletion on one UIResourceId |
6380 host_impl_->DeleteUIResource(ui_resource_id); | 6383 host_impl_->DeleteUIResource(ui_resource_id); |
6381 EXPECT_EQ(0u, context3d->NumTextures()); | 6384 EXPECT_EQ(0u, context3d->NumTextures()); |
6382 } | 6385 } |
6383 | 6386 |
6384 } // namespace | 6387 } // namespace |
6385 } // namespace cc | 6388 } // namespace cc |
OLD | NEW |