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 1491 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1502 scoped_ptr<LayerTilingData> tiling_data = | 1502 scoped_ptr<LayerTilingData> tiling_data = |
1503 LayerTilingData::Create(gfx::Size(10, 10), | 1503 LayerTilingData::Create(gfx::Size(10, 10), |
1504 LayerTilingData::NO_BORDER_TEXELS); | 1504 LayerTilingData::NO_BORDER_TEXELS); |
1505 tiling_data->SetBounds(bounds()); | 1505 tiling_data->SetBounds(bounds()); |
1506 SetTilingData(*tiling_data.get()); | 1506 SetTilingData(*tiling_data.get()); |
1507 set_skips_draw(skips_draw); | 1507 set_skips_draw(skips_draw); |
1508 if (!tile_missing) { | 1508 if (!tile_missing) { |
1509 ResourceProvider::ResourceId resource = | 1509 ResourceProvider::ResourceId resource = |
1510 resource_provider->CreateResource(gfx::Size(1, 1), | 1510 resource_provider->CreateResource(gfx::Size(1, 1), |
1511 GL_RGBA, | 1511 GL_RGBA, |
| 1512 GL_CLAMP_TO_EDGE, |
1512 ResourceProvider::TextureUsageAny); | 1513 ResourceProvider::TextureUsageAny); |
1513 resource_provider->AllocateForTesting(resource); | 1514 resource_provider->AllocateForTesting(resource); |
1514 PushTileProperties(0, 0, resource, gfx::Rect(), false); | 1515 PushTileProperties(0, 0, resource, gfx::Rect(), false); |
1515 } | 1516 } |
1516 if (animating) | 1517 if (animating) |
1517 AddAnimatedTransformToLayer(this, 10.0, 3, 0); | 1518 AddAnimatedTransformToLayer(this, 10.0, 3, 0); |
1518 } | 1519 } |
1519 }; | 1520 }; |
1520 | 1521 |
1521 TEST_F(LayerTreeHostImplTest, PrepareToDrawFailsWhenAnimationUsesCheckerboard) { | 1522 TEST_F(LayerTreeHostImplTest, PrepareToDrawFailsWhenAnimationUsesCheckerboard) { |
(...skipping 1071 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2593 ResourceProvider* resource_provider) | 2594 ResourceProvider* resource_provider) |
2594 : LayerImpl(tree_impl, id), | 2595 : LayerImpl(tree_impl, id), |
2595 blend_(false), | 2596 blend_(false), |
2596 has_render_surface_(false), | 2597 has_render_surface_(false), |
2597 quads_appended_(false), | 2598 quads_appended_(false), |
2598 quad_rect_(5, 5, 5, 5), | 2599 quad_rect_(5, 5, 5, 5), |
2599 quad_visible_rect_(5, 5, 5, 5), | 2600 quad_visible_rect_(5, 5, 5, 5), |
2600 resource_id_(resource_provider->CreateResource( | 2601 resource_id_(resource_provider->CreateResource( |
2601 gfx::Size(1, 1), | 2602 gfx::Size(1, 1), |
2602 GL_RGBA, | 2603 GL_RGBA, |
| 2604 GL_CLAMP_TO_EDGE, |
2603 ResourceProvider::TextureUsageAny)) { | 2605 ResourceProvider::TextureUsageAny)) { |
2604 resource_provider->AllocateForTesting(resource_id_); | 2606 resource_provider->AllocateForTesting(resource_id_); |
2605 SetAnchorPoint(gfx::PointF()); | 2607 SetAnchorPoint(gfx::PointF()); |
2606 SetBounds(gfx::Size(10, 10)); | 2608 SetBounds(gfx::Size(10, 10)); |
2607 SetContentBounds(gfx::Size(10, 10)); | 2609 SetContentBounds(gfx::Size(10, 10)); |
2608 SetDrawsContent(true); | 2610 SetDrawsContent(true); |
2609 } | 2611 } |
2610 | 2612 |
2611 bool blend_; | 2613 bool blend_; |
2612 bool has_render_surface_; | 2614 bool has_render_surface_; |
(...skipping 434 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3047 | 3049 |
3048 TEST_F(LayerTreeHostImplViewportCoveredTest, ViewportCoveredOverhangBitmap) { | 3050 TEST_F(LayerTreeHostImplViewportCoveredTest, ViewportCoveredOverhangBitmap) { |
3049 bool always_draw = false; | 3051 bool always_draw = false; |
3050 CreateLayerTreeHostImpl(always_draw); | 3052 CreateLayerTreeHostImpl(always_draw); |
3051 | 3053 |
3052 host_impl_->SetViewportSize(DipSizeToPixelSize(viewport_size_)); | 3054 host_impl_->SetViewportSize(DipSizeToPixelSize(viewport_size_)); |
3053 SetupActiveTreeLayers(); | 3055 SetupActiveTreeLayers(); |
3054 | 3056 |
3055 // Specify an overhang bitmap to use. | 3057 // Specify an overhang bitmap to use. |
3056 scoped_refptr<UIResourceBitmap> ui_resource_bitmap(UIResourceBitmap::Create( | 3058 scoped_refptr<UIResourceBitmap> ui_resource_bitmap(UIResourceBitmap::Create( |
3057 new uint8_t[4], UIResourceBitmap::RGBA8, gfx::Size(1, 1))); | 3059 new uint8_t[4], |
| 3060 UIResourceBitmap::RGBA8, |
| 3061 UIResourceBitmap::REPEAT, |
| 3062 gfx::Size(1, 1))); |
3058 UIResourceId ui_resource_id = 12345; | 3063 UIResourceId ui_resource_id = 12345; |
3059 host_impl_->CreateUIResource(ui_resource_id, ui_resource_bitmap); | 3064 host_impl_->CreateUIResource(ui_resource_id, ui_resource_bitmap); |
3060 host_impl_->SetOverhangUIResource(ui_resource_id, gfx::Size(32, 32)); | 3065 host_impl_->SetOverhangUIResource(ui_resource_id, gfx::Size(32, 32)); |
3061 set_gutter_quad_material(DrawQuad::TEXTURE_CONTENT); | 3066 set_gutter_quad_material(DrawQuad::TEXTURE_CONTENT); |
3062 set_gutter_texture_size(gfx::Size(32, 32)); | 3067 set_gutter_texture_size(gfx::Size(32, 32)); |
3063 | 3068 |
3064 TestLayerCoversFullViewport(); | 3069 TestLayerCoversFullViewport(); |
3065 TestEmptyLayer(); | 3070 TestEmptyLayer(); |
3066 TestLayerInMiddleOfViewport(); | 3071 TestLayerInMiddleOfViewport(); |
3067 TestLayerIsLargerThanViewport(); | 3072 TestLayerIsLargerThanViewport(); |
(...skipping 3364 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
6432 scoped_ptr<TestWebGraphicsContext3D> context = | 6437 scoped_ptr<TestWebGraphicsContext3D> context = |
6433 TestWebGraphicsContext3D::Create(); | 6438 TestWebGraphicsContext3D::Create(); |
6434 TestWebGraphicsContext3D* context3d = context.get(); | 6439 TestWebGraphicsContext3D* context3d = context.get(); |
6435 scoped_ptr<OutputSurface> output_surface = CreateFakeOutputSurface(); | 6440 scoped_ptr<OutputSurface> output_surface = CreateFakeOutputSurface(); |
6436 host_impl_->InitializeRenderer(output_surface.Pass()); | 6441 host_impl_->InitializeRenderer(output_surface.Pass()); |
6437 | 6442 |
6438 EXPECT_EQ(0u, context3d->NumTextures()); | 6443 EXPECT_EQ(0u, context3d->NumTextures()); |
6439 | 6444 |
6440 UIResourceId ui_resource_id = 1; | 6445 UIResourceId ui_resource_id = 1; |
6441 scoped_refptr<UIResourceBitmap> bitmap = UIResourceBitmap::Create( | 6446 scoped_refptr<UIResourceBitmap> bitmap = UIResourceBitmap::Create( |
6442 new uint8_t[1], UIResourceBitmap::RGBA8, gfx::Size(1, 1)); | 6447 new uint8_t[1], |
| 6448 UIResourceBitmap::RGBA8, |
| 6449 UIResourceBitmap::CLAMP_TO_EDGE, |
| 6450 gfx::Size(1, 1)); |
6443 host_impl_->CreateUIResource(ui_resource_id, bitmap); | 6451 host_impl_->CreateUIResource(ui_resource_id, bitmap); |
6444 EXPECT_EQ(1u, context3d->NumTextures()); | 6452 EXPECT_EQ(1u, context3d->NumTextures()); |
6445 ResourceProvider::ResourceId id1 = | 6453 ResourceProvider::ResourceId id1 = |
6446 host_impl_->ResourceIdForUIResource(ui_resource_id); | 6454 host_impl_->ResourceIdForUIResource(ui_resource_id); |
6447 EXPECT_NE(0u, id1); | 6455 EXPECT_NE(0u, id1); |
6448 | 6456 |
6449 // Multiple requests with the same id is allowed. The previous texture is | 6457 // Multiple requests with the same id is allowed. The previous texture is |
6450 // deleted. | 6458 // deleted. |
6451 host_impl_->CreateUIResource(ui_resource_id, bitmap); | 6459 host_impl_->CreateUIResource(ui_resource_id, bitmap); |
6452 EXPECT_EQ(1u, context3d->NumTextures()); | 6460 EXPECT_EQ(1u, context3d->NumTextures()); |
(...skipping 15 matching lines...) Expand all Loading... |
6468 EXPECT_EQ(0u, host_impl_->ResourceIdForUIResource(ui_resource_id)); | 6476 EXPECT_EQ(0u, host_impl_->ResourceIdForUIResource(ui_resource_id)); |
6469 EXPECT_EQ(0u, context3d->NumTextures()); | 6477 EXPECT_EQ(0u, context3d->NumTextures()); |
6470 | 6478 |
6471 // Should not change state for multiple deletion on one UIResourceId | 6479 // Should not change state for multiple deletion on one UIResourceId |
6472 host_impl_->DeleteUIResource(ui_resource_id); | 6480 host_impl_->DeleteUIResource(ui_resource_id); |
6473 EXPECT_EQ(0u, context3d->NumTextures()); | 6481 EXPECT_EQ(0u, context3d->NumTextures()); |
6474 } | 6482 } |
6475 | 6483 |
6476 } // namespace | 6484 } // namespace |
6477 } // namespace cc | 6485 } // namespace cc |
OLD | NEW |