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 3678 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3689 | 3689 |
3690 TEST_F(LayerTreeHostImplViewportCoveredTest, ViewportCoveredOverhangBitmap) { | 3690 TEST_F(LayerTreeHostImplViewportCoveredTest, ViewportCoveredOverhangBitmap) { |
3691 viewport_size_ = gfx::Size(1000, 1000); | 3691 viewport_size_ = gfx::Size(1000, 1000); |
3692 | 3692 |
3693 bool always_draw = false; | 3693 bool always_draw = false; |
3694 CreateHostImpl(DefaultSettings(), CreateFakeOutputSurface(always_draw)); | 3694 CreateHostImpl(DefaultSettings(), CreateFakeOutputSurface(always_draw)); |
3695 | 3695 |
3696 host_impl_->SetViewportSize(DipSizeToPixelSize(viewport_size_)); | 3696 host_impl_->SetViewportSize(DipSizeToPixelSize(viewport_size_)); |
3697 SetupActiveTreeLayers(); | 3697 SetupActiveTreeLayers(); |
3698 | 3698 |
3699 SkBitmap skbitmap; | |
3700 skbitmap.setConfig(SkBitmap::kARGB_8888_Config, 2, 2); | |
3701 skbitmap.allocPixels(); | |
3702 skbitmap.setImmutable(); | |
3703 | |
3704 // Specify an overhang bitmap to use. | 3699 // Specify an overhang bitmap to use. |
3705 UIResourceBitmap ui_resource_bitmap(skbitmap); | 3700 bool is_opaque = false; |
| 3701 UIResourceBitmap ui_resource_bitmap(gfx::Size(2, 2), is_opaque); |
3706 ui_resource_bitmap.SetWrapMode(UIResourceBitmap::REPEAT); | 3702 ui_resource_bitmap.SetWrapMode(UIResourceBitmap::REPEAT); |
3707 UIResourceId ui_resource_id = 12345; | 3703 UIResourceId ui_resource_id = 12345; |
3708 host_impl_->CreateUIResource(ui_resource_id, ui_resource_bitmap); | 3704 host_impl_->CreateUIResource(ui_resource_id, ui_resource_bitmap); |
3709 host_impl_->SetOverhangUIResource(ui_resource_id, gfx::Size(32, 32)); | 3705 host_impl_->SetOverhangUIResource(ui_resource_id, gfx::Size(32, 32)); |
3710 set_gutter_quad_material(DrawQuad::TEXTURE_CONTENT); | 3706 set_gutter_quad_material(DrawQuad::TEXTURE_CONTENT); |
3711 set_gutter_texture_size(gfx::Size(32, 32)); | 3707 set_gutter_texture_size(gfx::Size(32, 32)); |
3712 | 3708 |
3713 TestLayerCoversFullViewport(); | 3709 TestLayerCoversFullViewport(); |
3714 TestEmptyLayer(); | 3710 TestEmptyLayer(); |
3715 TestLayerInMiddleOfViewport(); | 3711 TestLayerInMiddleOfViewport(); |
(...skipping 1909 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
5625 | 5621 |
5626 TEST_F(LayerTreeHostImplTest, UIResourceManagement) { | 5622 TEST_F(LayerTreeHostImplTest, UIResourceManagement) { |
5627 scoped_ptr<TestWebGraphicsContext3D> context = | 5623 scoped_ptr<TestWebGraphicsContext3D> context = |
5628 TestWebGraphicsContext3D::Create(); | 5624 TestWebGraphicsContext3D::Create(); |
5629 TestWebGraphicsContext3D* context3d = context.get(); | 5625 TestWebGraphicsContext3D* context3d = context.get(); |
5630 scoped_ptr<FakeOutputSurface> output_surface = FakeOutputSurface::Create3d(); | 5626 scoped_ptr<FakeOutputSurface> output_surface = FakeOutputSurface::Create3d(); |
5631 CreateHostImpl(DefaultSettings(), output_surface.PassAs<OutputSurface>()); | 5627 CreateHostImpl(DefaultSettings(), output_surface.PassAs<OutputSurface>()); |
5632 | 5628 |
5633 EXPECT_EQ(0u, context3d->NumTextures()); | 5629 EXPECT_EQ(0u, context3d->NumTextures()); |
5634 | 5630 |
5635 SkBitmap skbitmap; | |
5636 skbitmap.setConfig(SkBitmap::kARGB_8888_Config, 1, 1); | |
5637 skbitmap.allocPixels(); | |
5638 skbitmap.setImmutable(); | |
5639 | |
5640 UIResourceId ui_resource_id = 1; | 5631 UIResourceId ui_resource_id = 1; |
5641 UIResourceBitmap bitmap(skbitmap); | 5632 bool is_opaque = false; |
| 5633 UIResourceBitmap bitmap(gfx::Size(1, 1), is_opaque); |
5642 host_impl_->CreateUIResource(ui_resource_id, bitmap); | 5634 host_impl_->CreateUIResource(ui_resource_id, bitmap); |
5643 EXPECT_EQ(1u, context3d->NumTextures()); | 5635 EXPECT_EQ(1u, context3d->NumTextures()); |
5644 ResourceProvider::ResourceId id1 = | 5636 ResourceProvider::ResourceId id1 = |
5645 host_impl_->ResourceIdForUIResource(ui_resource_id); | 5637 host_impl_->ResourceIdForUIResource(ui_resource_id); |
5646 EXPECT_NE(0u, id1); | 5638 EXPECT_NE(0u, id1); |
5647 | 5639 |
5648 // Multiple requests with the same id is allowed. The previous texture is | 5640 // Multiple requests with the same id is allowed. The previous texture is |
5649 // deleted. | 5641 // deleted. |
5650 host_impl_->CreateUIResource(ui_resource_id, bitmap); | 5642 host_impl_->CreateUIResource(ui_resource_id, bitmap); |
5651 EXPECT_EQ(1u, context3d->NumTextures()); | 5643 EXPECT_EQ(1u, context3d->NumTextures()); |
(...skipping 561 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
6213 EXPECT_EQ(host_impl_->global_tile_state().hard_memory_limit_in_bytes, | 6205 EXPECT_EQ(host_impl_->global_tile_state().hard_memory_limit_in_bytes, |
6214 300u * 1024u * 1024u); | 6206 300u * 1024u * 1024u); |
6215 EXPECT_EQ(host_impl_->global_tile_state().soft_memory_limit_in_bytes, | 6207 EXPECT_EQ(host_impl_->global_tile_state().soft_memory_limit_in_bytes, |
6216 150u * 1024u * 1024u); | 6208 150u * 1024u * 1024u); |
6217 EXPECT_EQ(host_impl_->global_tile_state().unused_memory_limit_in_bytes, | 6209 EXPECT_EQ(host_impl_->global_tile_state().unused_memory_limit_in_bytes, |
6218 75u * 1024u * 1024u); | 6210 75u * 1024u * 1024u); |
6219 } | 6211 } |
6220 | 6212 |
6221 } // namespace | 6213 } // namespace |
6222 } // namespace cc | 6214 } // namespace cc |
OLD | NEW |