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 1561 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1572 gfx::Transform expected_scale; | 1572 gfx::Transform expected_scale; |
1573 expected_scale.Scale(page_scale, page_scale); | 1573 expected_scale.Scale(page_scale, page_scale); |
1574 EXPECT_EQ(expected_scale, | 1574 EXPECT_EQ(expected_scale, |
1575 host_impl_->active_tree()->root_layer()->impl_transform()); | 1575 host_impl_->active_tree()->root_layer()->impl_transform()); |
1576 } | 1576 } |
1577 | 1577 |
1578 TEST_F(LayerTreeHostImplTest, PageScaleDeltaAppliedToRootScrollLayerOnly) { | 1578 TEST_F(LayerTreeHostImplTest, PageScaleDeltaAppliedToRootScrollLayerOnly) { |
1579 gfx::Size surface_size(10, 10); | 1579 gfx::Size surface_size(10, 10); |
1580 float default_page_scale = 1.f; | 1580 float default_page_scale = 1.f; |
1581 gfx::Transform default_page_scale_matrix; | 1581 gfx::Transform default_page_scale_matrix; |
| 1582 default_page_scale_matrix.Scale(default_page_scale, default_page_scale); |
1582 | 1583 |
1583 float new_page_scale = 2.f; | 1584 float new_page_scale = 2.f; |
1584 gfx::Transform new_page_scale_matrix; | 1585 gfx::Transform new_page_scale_matrix; |
1585 new_page_scale_matrix.Scale(new_page_scale, new_page_scale); | 1586 new_page_scale_matrix.Scale(new_page_scale, new_page_scale); |
1586 | 1587 |
1587 // Create a normal scrollable root layer and another scrollable child layer. | 1588 // Create a normal scrollable root layer and another scrollable child layer. |
1588 SetupScrollAndContentsLayers(surface_size); | 1589 SetupScrollAndContentsLayers(surface_size); |
1589 LayerImpl* root = host_impl_->active_tree()->root_layer(); | 1590 LayerImpl* root = host_impl_->active_tree()->root_layer(); |
1590 LayerImpl* child = root->children()[0]; | 1591 LayerImpl* child = root->children()[0]; |
1591 | 1592 |
(...skipping 1378 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2970 return WebKit::WebString(); | 2971 return WebKit::WebString(); |
2971 } | 2972 } |
2972 | 2973 |
2973 unsigned num_textures() const { return num_textures_; } | 2974 unsigned num_textures() const { return num_textures_; } |
2974 | 2975 |
2975 private: | 2976 private: |
2976 base::hash_map<WebKit::WebGLId, bool> textures_; | 2977 base::hash_map<WebKit::WebGLId, bool> textures_; |
2977 unsigned num_textures_; | 2978 unsigned num_textures_; |
2978 }; | 2979 }; |
2979 | 2980 |
2980 static unsigned CreateResourceId(ResourceProvider* resource_provider) { | |
2981 return resource_provider->CreateResource( | |
2982 gfx::Size(20, 12), | |
2983 resource_provider->best_texture_format(), | |
2984 ResourceProvider::TextureUsageAny); | |
2985 } | |
2986 | |
2987 static unsigned CreateTextureId(ResourceProvider* resource_provider) { | |
2988 return ResourceProvider::ScopedReadLockGL( | |
2989 resource_provider, CreateResourceId(resource_provider)).texture_id(); | |
2990 } | |
2991 | |
2992 TEST_F(LayerTreeHostImplTest, LayersFreeTextures) { | 2981 TEST_F(LayerTreeHostImplTest, LayersFreeTextures) { |
2993 scoped_ptr<TestWebGraphicsContext3D> context = | 2982 scoped_ptr<TestWebGraphicsContext3D> context = |
2994 TestWebGraphicsContext3D::Create(); | 2983 TestWebGraphicsContext3D::Create(); |
2995 TestWebGraphicsContext3D* context3d = context.get(); | 2984 TestWebGraphicsContext3D* context3d = context.get(); |
2996 scoped_ptr<OutputSurface> output_surface = FakeOutputSurface::Create3d( | 2985 scoped_ptr<OutputSurface> output_surface = FakeOutputSurface::Create3d( |
2997 context.PassAs<WebKit::WebGraphicsContext3D>()).PassAs<OutputSurface>(); | 2986 context.PassAs<WebKit::WebGraphicsContext3D>()).PassAs<OutputSurface>(); |
2998 host_impl_->InitializeRenderer(output_surface.Pass()); | 2987 host_impl_->InitializeRenderer(output_surface.Pass()); |
2999 | 2988 |
3000 scoped_ptr<LayerImpl> root_layer = | 2989 scoped_ptr<LayerImpl> root_layer = |
3001 LayerImpl::Create(host_impl_->active_tree(), 1); | 2990 LayerImpl::Create(host_impl_->active_tree(), 1); |
(...skipping 1986 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4988 EXPECT_EQ(gfx::RectF(0.f, 0.f, 1.f, 1.f).ToString(), | 4977 EXPECT_EQ(gfx::RectF(0.f, 0.f, 1.f, 1.f).ToString(), |
4989 render_pass_quad->mask_uv_rect.ToString()); | 4978 render_pass_quad->mask_uv_rect.ToString()); |
4990 | 4979 |
4991 host_impl_->DrawLayers(&frame, base::TimeTicks::Now()); | 4980 host_impl_->DrawLayers(&frame, base::TimeTicks::Now()); |
4992 host_impl_->DidDrawAllLayers(frame); | 4981 host_impl_->DidDrawAllLayers(frame); |
4993 } | 4982 } |
4994 } | 4983 } |
4995 | 4984 |
4996 } // namespace | 4985 } // namespace |
4997 } // namespace cc | 4986 } // namespace cc |
OLD | NEW |