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/layer_tree_host_impl.h" | 5 #include "cc/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 1037 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1048 private: | 1048 private: |
1049 MissingTextureAnimatingLayer(LayerTreeImpl* treeImpl, int id, bool tileMissi
ng, bool skipsDraw, bool animating, ResourceProvider* resourceProvider) | 1049 MissingTextureAnimatingLayer(LayerTreeImpl* treeImpl, int id, bool tileMissi
ng, bool skipsDraw, bool animating, ResourceProvider* resourceProvider) |
1050 : DidDrawCheckLayer(treeImpl, id) | 1050 : DidDrawCheckLayer(treeImpl, id) |
1051 { | 1051 { |
1052 scoped_ptr<LayerTilingData> tilingData = LayerTilingData::create(gfx::Si
ze(10, 10), LayerTilingData::NoBorderTexels); | 1052 scoped_ptr<LayerTilingData> tilingData = LayerTilingData::create(gfx::Si
ze(10, 10), LayerTilingData::NoBorderTexels); |
1053 tilingData->setBounds(bounds()); | 1053 tilingData->setBounds(bounds()); |
1054 setTilingData(*tilingData.get()); | 1054 setTilingData(*tilingData.get()); |
1055 setSkipsDraw(skipsDraw); | 1055 setSkipsDraw(skipsDraw); |
1056 if (!tileMissing) { | 1056 if (!tileMissing) { |
1057 ResourceProvider::ResourceId resource = resourceProvider->createReso
urce(gfx::Size(), GL_RGBA, ResourceProvider::TextureUsageAny); | 1057 ResourceProvider::ResourceId resource = resourceProvider->createReso
urce(gfx::Size(), GL_RGBA, ResourceProvider::TextureUsageAny); |
1058 resourceProvider->allocateForTesting(resource); | |
1059 pushTileProperties(0, 0, resource, gfx::Rect(), false); | 1058 pushTileProperties(0, 0, resource, gfx::Rect(), false); |
1060 } | 1059 } |
1061 if (animating) | 1060 if (animating) |
1062 addAnimatedTransformToLayer(*this, 10, 3, 0); | 1061 addAnimatedTransformToLayer(*this, 10, 3, 0); |
1063 } | 1062 } |
1064 }; | 1063 }; |
1065 | 1064 |
1066 TEST_P(LayerTreeHostImplTest, prepareToDrawFailsWhenAnimationUsesCheckerboard) | 1065 TEST_P(LayerTreeHostImplTest, prepareToDrawFailsWhenAnimationUsesCheckerboard) |
1067 { | 1066 { |
1068 // When the texture is not missing, we draw as usual. | 1067 // When the texture is not missing, we draw as usual. |
(...skipping 605 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1674 private: | 1673 private: |
1675 BlendStateCheckLayer(LayerTreeImpl* treeImpl, int id, ResourceProvider* reso
urceProvider) | 1674 BlendStateCheckLayer(LayerTreeImpl* treeImpl, int id, ResourceProvider* reso
urceProvider) |
1676 : LayerImpl(treeImpl, id) | 1675 : LayerImpl(treeImpl, id) |
1677 , m_blend(false) | 1676 , m_blend(false) |
1678 , m_hasRenderSurface(false) | 1677 , m_hasRenderSurface(false) |
1679 , m_quadsAppended(false) | 1678 , m_quadsAppended(false) |
1680 , m_quadRect(5, 5, 5, 5) | 1679 , m_quadRect(5, 5, 5, 5) |
1681 , m_quadVisibleRect(5, 5, 5, 5) | 1680 , m_quadVisibleRect(5, 5, 5, 5) |
1682 , m_resourceId(resourceProvider->createResource(gfx::Size(1, 1), GL_RGBA
, ResourceProvider::TextureUsageAny)) | 1681 , m_resourceId(resourceProvider->createResource(gfx::Size(1, 1), GL_RGBA
, ResourceProvider::TextureUsageAny)) |
1683 { | 1682 { |
1684 resourceProvider->allocateForTesting(m_resourceId); | |
1685 setAnchorPoint(gfx::PointF(0, 0)); | 1683 setAnchorPoint(gfx::PointF(0, 0)); |
1686 setBounds(gfx::Size(10, 10)); | 1684 setBounds(gfx::Size(10, 10)); |
1687 setContentBounds(gfx::Size(10, 10)); | 1685 setContentBounds(gfx::Size(10, 10)); |
1688 setDrawsContent(true); | 1686 setDrawsContent(true); |
1689 } | 1687 } |
1690 | 1688 |
1691 bool m_blend; | 1689 bool m_blend; |
1692 bool m_hasRenderSurface; | 1690 bool m_hasRenderSurface; |
1693 bool m_quadsAppended; | 1691 bool m_quadsAppended; |
1694 gfx::Rect m_quadRect; | 1692 gfx::Rect m_quadRect; |
(...skipping 1054 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2749 } | 2747 } |
2750 | 2748 |
2751 void createResources(ResourceProvider* provider) | 2749 void createResources(ResourceProvider* provider) |
2752 { | 2750 { |
2753 DCHECK(provider); | 2751 DCHECK(provider); |
2754 gfx::Size size(10, 10); | 2752 gfx::Size size(10, 10); |
2755 GLenum format = GL_RGBA; | 2753 GLenum format = GL_RGBA; |
2756 ResourceProvider::TextureUsageHint hint = ResourceProvider::TextureUsage
Any; | 2754 ResourceProvider::TextureUsageHint hint = ResourceProvider::TextureUsage
Any; |
2757 setScrollbarGeometry(ScrollbarGeometryFixedThumb::create(FakeWebScrollba
rThemeGeometryNonEmpty::create())); | 2755 setScrollbarGeometry(ScrollbarGeometryFixedThumb::create(FakeWebScrollba
rThemeGeometryNonEmpty::create())); |
2758 | 2756 |
2759 ResourceProvider::ResourceId backId = provider->createResource(size, fo
rmat, hint); | 2757 setBackTrackResourceId(provider->createResource(size, format, hint)); |
2760 ResourceProvider::ResourceId foreId = provider->createResource(size, fo
rmat, hint); | 2758 setForeTrackResourceId(provider->createResource(size, format, hint)); |
2761 ResourceProvider::ResourceId thumbId = provider->createResource(size, fo
rmat, hint); | 2759 setThumbResourceId(provider->createResource(size, format, hint)); |
2762 provider->allocateForTesting(backId); | |
2763 provider->allocateForTesting(foreId); | |
2764 provider->allocateForTesting(thumbId); | |
2765 setBackTrackResourceId(backId); | |
2766 setForeTrackResourceId(foreId); | |
2767 setThumbResourceId(thumbId); | |
2768 } | 2760 } |
2769 | 2761 |
2770 protected: | 2762 protected: |
2771 FakeScrollbarLayerImpl(LayerTreeImpl* treeImpl, int id) | 2763 FakeScrollbarLayerImpl(LayerTreeImpl* treeImpl, int id) |
2772 : ScrollbarLayerImpl(treeImpl, id) | 2764 : ScrollbarLayerImpl(treeImpl, id) |
2773 { | 2765 { |
2774 } | 2766 } |
2775 }; | 2767 }; |
2776 | 2768 |
2777 static inline scoped_ptr<RenderPass> createRenderPassWithResource(ResourceProvid
er* provider) | 2769 static inline scoped_ptr<RenderPass> createRenderPassWithResource(ResourceProvid
er* provider) |
2778 { | 2770 { |
2779 ResourceProvider::ResourceId resourceId = provider->createResource(gfx::Size
(1, 1), GL_RGBA, ResourceProvider::TextureUsageAny); | 2771 ResourceProvider::ResourceId resourceId = provider->createResource(gfx::Size
(1, 1), GL_RGBA, ResourceProvider::TextureUsageAny); |
2780 provider->allocateForTesting(resourceId); | |
2781 | 2772 |
2782 scoped_ptr<TestRenderPass> pass = TestRenderPass::Create(); | 2773 scoped_ptr<TestRenderPass> pass = TestRenderPass::Create(); |
2783 pass->SetNew(RenderPass::Id(1, 1), gfx::Rect(0, 0, 1, 1), gfx::Rect(0, 0, 1,
1), gfx::Transform()); | 2774 pass->SetNew(RenderPass::Id(1, 1), gfx::Rect(0, 0, 1, 1), gfx::Rect(0, 0, 1,
1), gfx::Transform()); |
2784 scoped_ptr<SharedQuadState> sharedState = SharedQuadState::Create(); | 2775 scoped_ptr<SharedQuadState> sharedState = SharedQuadState::Create(); |
2785 sharedState->SetAll(gfx::Transform(), gfx::Rect(0, 0, 1, 1), gfx::Rect(0, 0,
1, 1), gfx::Rect(0, 0, 1, 1), false, 1); | 2776 sharedState->SetAll(gfx::Transform(), gfx::Rect(0, 0, 1, 1), gfx::Rect(0, 0,
1, 1), gfx::Rect(0, 0, 1, 1), false, 1); |
2786 const float vertex_opacity[] = {1.0f, 1.0f, 1.0f, 1.0f}; | 2777 const float vertex_opacity[] = {1.0f, 1.0f, 1.0f, 1.0f}; |
2787 scoped_ptr<TextureDrawQuad> quad = TextureDrawQuad::Create(); | 2778 scoped_ptr<TextureDrawQuad> quad = TextureDrawQuad::Create(); |
2788 quad->SetNew(sharedState.get(), gfx::Rect(0, 0, 1, 1), gfx::Rect(0, 0, 1, 1)
, resourceId, false, gfx::RectF(0, 0, 1, 1), vertex_opacity, false); | 2779 quad->SetNew(sharedState.get(), gfx::Rect(0, 0, 1, 1), gfx::Rect(0, 0, 1, 1)
, resourceId, false, gfx::RectF(0, 0, 1, 1), vertex_opacity, false); |
2789 | 2780 |
2790 pass->AppendSharedQuadState(sharedState.Pass()); | 2781 pass->AppendSharedQuadState(sharedState.Pass()); |
(...skipping 2061 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4852 gfx::Rect noDamage = gfx::Rect(m_hostImpl->deviceViewportSize()); | 4843 gfx::Rect noDamage = gfx::Rect(m_hostImpl->deviceViewportSize()); |
4853 drawFrameAndTestDamage(noDamage); | 4844 drawFrameAndTestDamage(noDamage); |
4854 } | 4845 } |
4855 | 4846 |
4856 INSTANTIATE_TEST_CASE_P(LayerTreeHostImplTests, | 4847 INSTANTIATE_TEST_CASE_P(LayerTreeHostImplTests, |
4857 LayerTreeHostImplTest, | 4848 LayerTreeHostImplTest, |
4858 ::testing::Values(false, true)); | 4849 ::testing::Values(false, true)); |
4859 | 4850 |
4860 } // namespace | 4851 } // namespace |
4861 } // namespace cc | 4852 } // namespace cc |
OLD | NEW |