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 1030 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1041 private: | 1041 private: |
1042 MissingTextureAnimatingLayer(LayerTreeImpl* treeImpl, int id, bool tileMissi
ng, bool skipsDraw, bool animating, ResourceProvider* resourceProvider) | 1042 MissingTextureAnimatingLayer(LayerTreeImpl* treeImpl, int id, bool tileMissi
ng, bool skipsDraw, bool animating, ResourceProvider* resourceProvider) |
1043 : DidDrawCheckLayer(treeImpl, id) | 1043 : DidDrawCheckLayer(treeImpl, id) |
1044 { | 1044 { |
1045 scoped_ptr<LayerTilingData> tilingData = LayerTilingData::create(gfx::Si
ze(10, 10), LayerTilingData::NoBorderTexels); | 1045 scoped_ptr<LayerTilingData> tilingData = LayerTilingData::create(gfx::Si
ze(10, 10), LayerTilingData::NoBorderTexels); |
1046 tilingData->setBounds(bounds()); | 1046 tilingData->setBounds(bounds()); |
1047 setTilingData(*tilingData.get()); | 1047 setTilingData(*tilingData.get()); |
1048 setSkipsDraw(skipsDraw); | 1048 setSkipsDraw(skipsDraw); |
1049 if (!tileMissing) { | 1049 if (!tileMissing) { |
1050 ResourceProvider::ResourceId resource = resourceProvider->createReso
urce(gfx::Size(), GL_RGBA, ResourceProvider::TextureUsageAny); | 1050 ResourceProvider::ResourceId resource = resourceProvider->createReso
urce(gfx::Size(), GL_RGBA, ResourceProvider::TextureUsageAny); |
| 1051 resourceProvider->allocateForTesting(resource); |
1051 pushTileProperties(0, 0, resource, gfx::Rect(), false); | 1052 pushTileProperties(0, 0, resource, gfx::Rect(), false); |
1052 } | 1053 } |
1053 if (animating) | 1054 if (animating) |
1054 addAnimatedTransformToLayer(*this, 10, 3, 0); | 1055 addAnimatedTransformToLayer(*this, 10, 3, 0); |
1055 } | 1056 } |
1056 }; | 1057 }; |
1057 | 1058 |
1058 TEST_P(LayerTreeHostImplTest, prepareToDrawFailsWhenAnimationUsesCheckerboard) | 1059 TEST_P(LayerTreeHostImplTest, prepareToDrawFailsWhenAnimationUsesCheckerboard) |
1059 { | 1060 { |
1060 // When the texture is not missing, we draw as usual. | 1061 // When the texture is not missing, we draw as usual. |
(...skipping 605 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1666 private: | 1667 private: |
1667 BlendStateCheckLayer(LayerTreeImpl* treeImpl, int id, ResourceProvider* reso
urceProvider) | 1668 BlendStateCheckLayer(LayerTreeImpl* treeImpl, int id, ResourceProvider* reso
urceProvider) |
1668 : LayerImpl(treeImpl, id) | 1669 : LayerImpl(treeImpl, id) |
1669 , m_blend(false) | 1670 , m_blend(false) |
1670 , m_hasRenderSurface(false) | 1671 , m_hasRenderSurface(false) |
1671 , m_quadsAppended(false) | 1672 , m_quadsAppended(false) |
1672 , m_quadRect(5, 5, 5, 5) | 1673 , m_quadRect(5, 5, 5, 5) |
1673 , m_quadVisibleRect(5, 5, 5, 5) | 1674 , m_quadVisibleRect(5, 5, 5, 5) |
1674 , m_resourceId(resourceProvider->createResource(gfx::Size(1, 1), GL_RGBA
, ResourceProvider::TextureUsageAny)) | 1675 , m_resourceId(resourceProvider->createResource(gfx::Size(1, 1), GL_RGBA
, ResourceProvider::TextureUsageAny)) |
1675 { | 1676 { |
| 1677 resourceProvider->allocateForTesting(m_resourceId); |
1676 setAnchorPoint(gfx::PointF(0, 0)); | 1678 setAnchorPoint(gfx::PointF(0, 0)); |
1677 setBounds(gfx::Size(10, 10)); | 1679 setBounds(gfx::Size(10, 10)); |
1678 setContentBounds(gfx::Size(10, 10)); | 1680 setContentBounds(gfx::Size(10, 10)); |
1679 setDrawsContent(true); | 1681 setDrawsContent(true); |
1680 } | 1682 } |
1681 | 1683 |
1682 bool m_blend; | 1684 bool m_blend; |
1683 bool m_hasRenderSurface; | 1685 bool m_hasRenderSurface; |
1684 bool m_quadsAppended; | 1686 bool m_quadsAppended; |
1685 gfx::Rect m_quadRect; | 1687 gfx::Rect m_quadRect; |
(...skipping 1054 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2740 } | 2742 } |
2741 | 2743 |
2742 void createResources(ResourceProvider* provider) | 2744 void createResources(ResourceProvider* provider) |
2743 { | 2745 { |
2744 DCHECK(provider); | 2746 DCHECK(provider); |
2745 gfx::Size size(10, 10); | 2747 gfx::Size size(10, 10); |
2746 GLenum format = GL_RGBA; | 2748 GLenum format = GL_RGBA; |
2747 ResourceProvider::TextureUsageHint hint = ResourceProvider::TextureUsage
Any; | 2749 ResourceProvider::TextureUsageHint hint = ResourceProvider::TextureUsage
Any; |
2748 setScrollbarGeometry(ScrollbarGeometryFixedThumb::create(FakeWebScrollba
rThemeGeometryNonEmpty::create())); | 2750 setScrollbarGeometry(ScrollbarGeometryFixedThumb::create(FakeWebScrollba
rThemeGeometryNonEmpty::create())); |
2749 | 2751 |
2750 setBackTrackResourceId(provider->createResource(size, format, hint)); | 2752 ResourceProvider::ResourceId backId = provider->createResource(size, fo
rmat, hint); |
2751 setForeTrackResourceId(provider->createResource(size, format, hint)); | 2753 ResourceProvider::ResourceId foreId = provider->createResource(size, fo
rmat, hint); |
2752 setThumbResourceId(provider->createResource(size, format, hint)); | 2754 ResourceProvider::ResourceId thumbId = provider->createResource(size, fo
rmat, hint); |
| 2755 provider->allocateForTesting(backId); |
| 2756 provider->allocateForTesting(foreId); |
| 2757 provider->allocateForTesting(thumbId); |
| 2758 setBackTrackResourceId(backId); |
| 2759 setForeTrackResourceId(foreId); |
| 2760 setThumbResourceId(thumbId); |
2753 } | 2761 } |
2754 | 2762 |
2755 protected: | 2763 protected: |
2756 FakeScrollbarLayerImpl(LayerTreeImpl* treeImpl, int id) | 2764 FakeScrollbarLayerImpl(LayerTreeImpl* treeImpl, int id) |
2757 : ScrollbarLayerImpl(treeImpl, id) | 2765 : ScrollbarLayerImpl(treeImpl, id) |
2758 { | 2766 { |
2759 } | 2767 } |
2760 }; | 2768 }; |
2761 | 2769 |
2762 static inline scoped_ptr<RenderPass> createRenderPassWithResource(ResourceProvid
er* provider) | 2770 static inline scoped_ptr<RenderPass> createRenderPassWithResource(ResourceProvid
er* provider) |
2763 { | 2771 { |
2764 ResourceProvider::ResourceId resourceId = provider->createResource(gfx::Size
(1, 1), GL_RGBA, ResourceProvider::TextureUsageAny); | 2772 ResourceProvider::ResourceId resourceId = provider->createResource(gfx::Size
(1, 1), GL_RGBA, ResourceProvider::TextureUsageAny); |
| 2773 provider->allocateForTesting(resourceId); |
2765 | 2774 |
2766 scoped_ptr<TestRenderPass> pass = TestRenderPass::Create(); | 2775 scoped_ptr<TestRenderPass> pass = TestRenderPass::Create(); |
2767 pass->SetNew(RenderPass::Id(1, 1), gfx::Rect(0, 0, 1, 1), gfx::Rect(0, 0, 1,
1), gfx::Transform()); | 2776 pass->SetNew(RenderPass::Id(1, 1), gfx::Rect(0, 0, 1, 1), gfx::Rect(0, 0, 1,
1), gfx::Transform()); |
2768 scoped_ptr<SharedQuadState> sharedState = SharedQuadState::Create(); | 2777 scoped_ptr<SharedQuadState> sharedState = SharedQuadState::Create(); |
2769 sharedState->SetAll(gfx::Transform(), gfx::Rect(0, 0, 1, 1), gfx::Rect(0, 0,
1, 1), gfx::Rect(0, 0, 1, 1), false, 1); | 2778 sharedState->SetAll(gfx::Transform(), gfx::Rect(0, 0, 1, 1), gfx::Rect(0, 0,
1, 1), gfx::Rect(0, 0, 1, 1), false, 1); |
2770 const float vertex_opacity[] = {1.0f, 1.0f, 1.0f, 1.0f}; | 2779 const float vertex_opacity[] = {1.0f, 1.0f, 1.0f, 1.0f}; |
2771 scoped_ptr<TextureDrawQuad> quad = TextureDrawQuad::Create(); | 2780 scoped_ptr<TextureDrawQuad> quad = TextureDrawQuad::Create(); |
2772 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); | 2781 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); |
2773 | 2782 |
2774 pass->AppendSharedQuadState(sharedState.Pass()); | 2783 pass->AppendSharedQuadState(sharedState.Pass()); |
(...skipping 2049 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4824 gfx::Rect noDamage = gfx::Rect(m_hostImpl->deviceViewportSize()); | 4833 gfx::Rect noDamage = gfx::Rect(m_hostImpl->deviceViewportSize()); |
4825 drawFrameAndTestDamage(noDamage); | 4834 drawFrameAndTestDamage(noDamage); |
4826 } | 4835 } |
4827 | 4836 |
4828 INSTANTIATE_TEST_CASE_P(LayerTreeHostImplTests, | 4837 INSTANTIATE_TEST_CASE_P(LayerTreeHostImplTests, |
4829 LayerTreeHostImplTest, | 4838 LayerTreeHostImplTest, |
4830 ::testing::Values(false, true)); | 4839 ::testing::Values(false, true)); |
4831 | 4840 |
4832 } // namespace | 4841 } // namespace |
4833 } // namespace cc | 4842 } // namespace cc |
OLD | NEW |