Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(518)

Side by Side Diff: cc/trees/layer_tree_host_impl_unittest.cc

Issue 197883017: SkColorType instead of (deprecated) SkBitmap::Config (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: rebase Created 6 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
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
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 UIResourceBitmap ui_resource_bitmap(2, 2);
3706 ui_resource_bitmap.SetWrapMode(UIResourceBitmap::REPEAT); 3701 ui_resource_bitmap.SetWrapMode(UIResourceBitmap::REPEAT);
3707 UIResourceId ui_resource_id = 12345; 3702 UIResourceId ui_resource_id = 12345;
3708 host_impl_->CreateUIResource(ui_resource_id, ui_resource_bitmap); 3703 host_impl_->CreateUIResource(ui_resource_id, ui_resource_bitmap);
3709 host_impl_->SetOverhangUIResource(ui_resource_id, gfx::Size(32, 32)); 3704 host_impl_->SetOverhangUIResource(ui_resource_id, gfx::Size(32, 32));
3710 set_gutter_quad_material(DrawQuad::TEXTURE_CONTENT); 3705 set_gutter_quad_material(DrawQuad::TEXTURE_CONTENT);
3711 set_gutter_texture_size(gfx::Size(32, 32)); 3706 set_gutter_texture_size(gfx::Size(32, 32));
3712 3707
3713 TestLayerCoversFullViewport(); 3708 TestLayerCoversFullViewport();
3714 TestEmptyLayer(); 3709 TestEmptyLayer();
3715 TestLayerInMiddleOfViewport(); 3710 TestLayerInMiddleOfViewport();
(...skipping 1909 matching lines...) Expand 10 before | Expand all | Expand 10 after
5625 5620
5626 TEST_F(LayerTreeHostImplTest, UIResourceManagement) { 5621 TEST_F(LayerTreeHostImplTest, UIResourceManagement) {
5627 scoped_ptr<TestWebGraphicsContext3D> context = 5622 scoped_ptr<TestWebGraphicsContext3D> context =
5628 TestWebGraphicsContext3D::Create(); 5623 TestWebGraphicsContext3D::Create();
5629 TestWebGraphicsContext3D* context3d = context.get(); 5624 TestWebGraphicsContext3D* context3d = context.get();
5630 scoped_ptr<FakeOutputSurface> output_surface = FakeOutputSurface::Create3d(); 5625 scoped_ptr<FakeOutputSurface> output_surface = FakeOutputSurface::Create3d();
5631 CreateHostImpl(DefaultSettings(), output_surface.PassAs<OutputSurface>()); 5626 CreateHostImpl(DefaultSettings(), output_surface.PassAs<OutputSurface>());
5632 5627
5633 EXPECT_EQ(0u, context3d->NumTextures()); 5628 EXPECT_EQ(0u, context3d->NumTextures());
5634 5629
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; 5630 UIResourceId ui_resource_id = 1;
5641 UIResourceBitmap bitmap(skbitmap); 5631 UIResourceBitmap bitmap(1, 1);
5642 host_impl_->CreateUIResource(ui_resource_id, bitmap); 5632 host_impl_->CreateUIResource(ui_resource_id, bitmap);
5643 EXPECT_EQ(1u, context3d->NumTextures()); 5633 EXPECT_EQ(1u, context3d->NumTextures());
5644 ResourceProvider::ResourceId id1 = 5634 ResourceProvider::ResourceId id1 =
5645 host_impl_->ResourceIdForUIResource(ui_resource_id); 5635 host_impl_->ResourceIdForUIResource(ui_resource_id);
5646 EXPECT_NE(0u, id1); 5636 EXPECT_NE(0u, id1);
5647 5637
5648 // Multiple requests with the same id is allowed. The previous texture is 5638 // Multiple requests with the same id is allowed. The previous texture is
5649 // deleted. 5639 // deleted.
5650 host_impl_->CreateUIResource(ui_resource_id, bitmap); 5640 host_impl_->CreateUIResource(ui_resource_id, bitmap);
5651 EXPECT_EQ(1u, context3d->NumTextures()); 5641 EXPECT_EQ(1u, context3d->NumTextures());
(...skipping 561 matching lines...) Expand 10 before | Expand all | Expand 10 after
6213 EXPECT_EQ(host_impl_->global_tile_state().hard_memory_limit_in_bytes, 6203 EXPECT_EQ(host_impl_->global_tile_state().hard_memory_limit_in_bytes,
6214 300u * 1024u * 1024u); 6204 300u * 1024u * 1024u);
6215 EXPECT_EQ(host_impl_->global_tile_state().soft_memory_limit_in_bytes, 6205 EXPECT_EQ(host_impl_->global_tile_state().soft_memory_limit_in_bytes,
6216 150u * 1024u * 1024u); 6206 150u * 1024u * 1024u);
6217 EXPECT_EQ(host_impl_->global_tile_state().unused_memory_limit_in_bytes, 6207 EXPECT_EQ(host_impl_->global_tile_state().unused_memory_limit_in_bytes,
6218 75u * 1024u * 1024u); 6208 75u * 1024u * 1024u);
6219 } 6209 }
6220 6210
6221 } // namespace 6211 } // namespace
6222 } // namespace cc 6212 } // namespace cc
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698