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