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 3667 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3678 | 3678 |
3679 TEST_F(LayerTreeHostImplViewportCoveredTest, ViewportCoveredOverhangBitmap) { | 3679 TEST_F(LayerTreeHostImplViewportCoveredTest, ViewportCoveredOverhangBitmap) { |
3680 viewport_size_ = gfx::Size(1000, 1000); | 3680 viewport_size_ = gfx::Size(1000, 1000); |
3681 | 3681 |
3682 bool always_draw = false; | 3682 bool always_draw = false; |
3683 CreateHostImpl(DefaultSettings(), CreateFakeOutputSurface(always_draw)); | 3683 CreateHostImpl(DefaultSettings(), CreateFakeOutputSurface(always_draw)); |
3684 | 3684 |
3685 host_impl_->SetViewportSize(DipSizeToPixelSize(viewport_size_)); | 3685 host_impl_->SetViewportSize(DipSizeToPixelSize(viewport_size_)); |
3686 SetupActiveTreeLayers(); | 3686 SetupActiveTreeLayers(); |
3687 | 3687 |
3688 SkBitmap skbitmap; | |
3689 skbitmap.setConfig(SkBitmap::kARGB_8888_Config, 2, 2); | |
3690 skbitmap.allocPixels(); | |
3691 skbitmap.setImmutable(); | |
3692 | |
3693 // Specify an overhang bitmap to use. | 3688 // Specify an overhang bitmap to use. |
3694 UIResourceBitmap ui_resource_bitmap(skbitmap); | 3689 UIResourceBitmap ui_resource_bitmap(2, 2); |
3695 ui_resource_bitmap.SetWrapMode(UIResourceBitmap::REPEAT); | 3690 ui_resource_bitmap.SetWrapMode(UIResourceBitmap::REPEAT); |
3696 UIResourceId ui_resource_id = 12345; | 3691 UIResourceId ui_resource_id = 12345; |
3697 host_impl_->CreateUIResource(ui_resource_id, ui_resource_bitmap); | 3692 host_impl_->CreateUIResource(ui_resource_id, ui_resource_bitmap); |
3698 host_impl_->SetOverhangUIResource(ui_resource_id, gfx::Size(32, 32)); | 3693 host_impl_->SetOverhangUIResource(ui_resource_id, gfx::Size(32, 32)); |
3699 set_gutter_quad_material(DrawQuad::TEXTURE_CONTENT); | 3694 set_gutter_quad_material(DrawQuad::TEXTURE_CONTENT); |
3700 set_gutter_texture_size(gfx::Size(32, 32)); | 3695 set_gutter_texture_size(gfx::Size(32, 32)); |
3701 | 3696 |
3702 TestLayerCoversFullViewport(); | 3697 TestLayerCoversFullViewport(); |
3703 TestEmptyLayer(); | 3698 TestEmptyLayer(); |
3704 TestLayerInMiddleOfViewport(); | 3699 TestLayerInMiddleOfViewport(); |
(...skipping 1885 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
5590 | 5585 |
5591 TEST_F(LayerTreeHostImplTest, UIResourceManagement) { | 5586 TEST_F(LayerTreeHostImplTest, UIResourceManagement) { |
5592 scoped_ptr<TestWebGraphicsContext3D> context = | 5587 scoped_ptr<TestWebGraphicsContext3D> context = |
5593 TestWebGraphicsContext3D::Create(); | 5588 TestWebGraphicsContext3D::Create(); |
5594 TestWebGraphicsContext3D* context3d = context.get(); | 5589 TestWebGraphicsContext3D* context3d = context.get(); |
5595 scoped_ptr<FakeOutputSurface> output_surface = FakeOutputSurface::Create3d(); | 5590 scoped_ptr<FakeOutputSurface> output_surface = FakeOutputSurface::Create3d(); |
5596 CreateHostImpl(DefaultSettings(), output_surface.PassAs<OutputSurface>()); | 5591 CreateHostImpl(DefaultSettings(), output_surface.PassAs<OutputSurface>()); |
5597 | 5592 |
5598 EXPECT_EQ(0u, context3d->NumTextures()); | 5593 EXPECT_EQ(0u, context3d->NumTextures()); |
5599 | 5594 |
5600 SkBitmap skbitmap; | |
5601 skbitmap.setConfig(SkBitmap::kARGB_8888_Config, 1, 1); | |
5602 skbitmap.allocPixels(); | |
5603 skbitmap.setImmutable(); | |
5604 | |
5605 UIResourceId ui_resource_id = 1; | 5595 UIResourceId ui_resource_id = 1; |
5606 UIResourceBitmap bitmap(skbitmap); | 5596 UIResourceBitmap bitmap(1, 1); |
5607 host_impl_->CreateUIResource(ui_resource_id, bitmap); | 5597 host_impl_->CreateUIResource(ui_resource_id, bitmap); |
5608 EXPECT_EQ(1u, context3d->NumTextures()); | 5598 EXPECT_EQ(1u, context3d->NumTextures()); |
5609 ResourceProvider::ResourceId id1 = | 5599 ResourceProvider::ResourceId id1 = |
5610 host_impl_->ResourceIdForUIResource(ui_resource_id); | 5600 host_impl_->ResourceIdForUIResource(ui_resource_id); |
5611 EXPECT_NE(0u, id1); | 5601 EXPECT_NE(0u, id1); |
5612 | 5602 |
5613 // Multiple requests with the same id is allowed. The previous texture is | 5603 // Multiple requests with the same id is allowed. The previous texture is |
5614 // deleted. | 5604 // deleted. |
5615 host_impl_->CreateUIResource(ui_resource_id, bitmap); | 5605 host_impl_->CreateUIResource(ui_resource_id, bitmap); |
5616 EXPECT_EQ(1u, context3d->NumTextures()); | 5606 EXPECT_EQ(1u, context3d->NumTextures()); |
(...skipping 561 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
6178 EXPECT_EQ(host_impl_->global_tile_state().hard_memory_limit_in_bytes, | 6168 EXPECT_EQ(host_impl_->global_tile_state().hard_memory_limit_in_bytes, |
6179 300u * 1024u * 1024u); | 6169 300u * 1024u * 1024u); |
6180 EXPECT_EQ(host_impl_->global_tile_state().soft_memory_limit_in_bytes, | 6170 EXPECT_EQ(host_impl_->global_tile_state().soft_memory_limit_in_bytes, |
6181 150u * 1024u * 1024u); | 6171 150u * 1024u * 1024u); |
6182 EXPECT_EQ(host_impl_->global_tile_state().unused_memory_limit_in_bytes, | 6172 EXPECT_EQ(host_impl_->global_tile_state().unused_memory_limit_in_bytes, |
6183 75u * 1024u * 1024u); | 6173 75u * 1024u * 1024u); |
6184 } | 6174 } |
6185 | 6175 |
6186 } // namespace | 6176 } // namespace |
6187 } // namespace cc | 6177 } // namespace cc |
OLD | NEW |