Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(462)

Side by Side Diff: cc/layer_tree_host_impl_unittest.cc

Issue 11144023: cc: Store tiles, painters, tiling data in scoped_ptr (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Rebased Created 8 years, 2 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « cc/layer_tiling_data.cc ('k') | cc/quad_culler_unittest.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 "config.h" 5 #include "config.h"
6 6
7 #include "CCLayerTreeHostImpl.h" 7 #include "CCLayerTreeHostImpl.h"
8 8
9 #include "CCAnimationTestCommon.h" 9 #include "CCAnimationTestCommon.h"
10 #include "CCDelegatedRendererLayerImpl.h" 10 #include "CCDelegatedRendererLayerImpl.h"
(...skipping 795 matching lines...) Expand 10 before | Expand all | Expand 10 after
806 , m_didDrawCalled(false) 806 , m_didDrawCalled(false)
807 , m_willDrawCalled(false) 807 , m_willDrawCalled(false)
808 { 808 {
809 setAnchorPoint(FloatPoint(0, 0)); 809 setAnchorPoint(FloatPoint(0, 0));
810 setBounds(IntSize(10, 10)); 810 setBounds(IntSize(10, 10));
811 setContentBounds(IntSize(10, 10)); 811 setContentBounds(IntSize(10, 10));
812 setDrawsContent(true); 812 setDrawsContent(true);
813 setSkipsDraw(false); 813 setSkipsDraw(false);
814 setVisibleContentRect(IntRect(0, 0, 10, 10)); 814 setVisibleContentRect(IntRect(0, 0, 10, 10));
815 815
816 OwnPtr<CCLayerTilingData> tiler = CCLayerTilingData::create(IntSize(100, 100), CCLayerTilingData::HasBorderTexels); 816 scoped_ptr<CCLayerTilingData> tiler = CCLayerTilingData::create(IntSize( 100, 100), CCLayerTilingData::HasBorderTexels);
817 tiler->setBounds(contentBounds()); 817 tiler->setBounds(contentBounds());
818 setTilingData(*tiler.get()); 818 setTilingData(*tiler.get());
819 } 819 }
820 820
821 private: 821 private:
822 bool m_didDrawCalled; 822 bool m_didDrawCalled;
823 bool m_willDrawCalled; 823 bool m_willDrawCalled;
824 }; 824 };
825 825
826 TEST_P(CCLayerTreeHostImplTest, didDrawNotCalledOnHiddenLayer) 826 TEST_P(CCLayerTreeHostImplTest, didDrawNotCalledOnHiddenLayer)
(...skipping 111 matching lines...) Expand 10 before | Expand all | Expand 10 after
938 public: 938 public:
939 static scoped_ptr<CCLayerImpl> create(int id, bool tileMissing, bool skipsDr aw, bool animating, CCResourceProvider* resourceProvider) 939 static scoped_ptr<CCLayerImpl> create(int id, bool tileMissing, bool skipsDr aw, bool animating, CCResourceProvider* resourceProvider)
940 { 940 {
941 return scoped_ptr<CCLayerImpl>(new MissingTextureAnimatingLayer(id, tile Missing, skipsDraw, animating, resourceProvider)); 941 return scoped_ptr<CCLayerImpl>(new MissingTextureAnimatingLayer(id, tile Missing, skipsDraw, animating, resourceProvider));
942 } 942 }
943 943
944 private: 944 private:
945 explicit MissingTextureAnimatingLayer(int id, bool tileMissing, bool skipsDr aw, bool animating, CCResourceProvider* resourceProvider) 945 explicit MissingTextureAnimatingLayer(int id, bool tileMissing, bool skipsDr aw, bool animating, CCResourceProvider* resourceProvider)
946 : DidDrawCheckLayer(id) 946 : DidDrawCheckLayer(id)
947 { 947 {
948 OwnPtr<CCLayerTilingData> tilingData = CCLayerTilingData::create(IntSize (10, 10), CCLayerTilingData::NoBorderTexels); 948 scoped_ptr<CCLayerTilingData> tilingData = CCLayerTilingData::create(Int Size(10, 10), CCLayerTilingData::NoBorderTexels);
949 tilingData->setBounds(bounds()); 949 tilingData->setBounds(bounds());
950 setTilingData(*tilingData.get()); 950 setTilingData(*tilingData.get());
951 setSkipsDraw(skipsDraw); 951 setSkipsDraw(skipsDraw);
952 if (!tileMissing) { 952 if (!tileMissing) {
953 CCResourceProvider::ResourceId resource = resourceProvider->createRe source(CCRenderer::ContentPool, IntSize(), GraphicsContext3D::RGBA, CCResourcePr ovider::TextureUsageAny); 953 CCResourceProvider::ResourceId resource = resourceProvider->createRe source(CCRenderer::ContentPool, IntSize(), GraphicsContext3D::RGBA, CCResourcePr ovider::TextureUsageAny);
954 pushTileProperties(0, 0, resource, IntRect()); 954 pushTileProperties(0, 0, resource, IntRect());
955 } 955 }
956 if (animating) 956 if (animating)
957 addAnimatedTransformToLayer(*this, 10, 3, 0); 957 addAnimatedTransformToLayer(*this, 10, 3, 0);
958 } 958 }
(...skipping 1682 matching lines...) Expand 10 before | Expand all | Expand 10 after
2641 scoped_ptr<CCLayerImpl> rootLayer(CCLayerImpl::create(layerId++)); 2641 scoped_ptr<CCLayerImpl> rootLayer(CCLayerImpl::create(layerId++));
2642 rootLayer->setBounds(IntSize(10, 10)); 2642 rootLayer->setBounds(IntSize(10, 10));
2643 rootLayer->setAnchorPoint(FloatPoint(0, 0)); 2643 rootLayer->setAnchorPoint(FloatPoint(0, 0));
2644 2644
2645 scoped_ptr<CCTiledLayerImpl> tileLayer = CCTiledLayerImpl::create(layerId++) ; 2645 scoped_ptr<CCTiledLayerImpl> tileLayer = CCTiledLayerImpl::create(layerId++) ;
2646 tileLayer->setBounds(IntSize(10, 10)); 2646 tileLayer->setBounds(IntSize(10, 10));
2647 tileLayer->setAnchorPoint(FloatPoint(0, 0)); 2647 tileLayer->setAnchorPoint(FloatPoint(0, 0));
2648 tileLayer->setContentBounds(IntSize(10, 10)); 2648 tileLayer->setContentBounds(IntSize(10, 10));
2649 tileLayer->setDrawsContent(true); 2649 tileLayer->setDrawsContent(true);
2650 tileLayer->setSkipsDraw(false); 2650 tileLayer->setSkipsDraw(false);
2651 OwnPtr<CCLayerTilingData> tilingData(CCLayerTilingData::create(IntSize(10, 1 0), CCLayerTilingData::NoBorderTexels)); 2651 scoped_ptr<CCLayerTilingData> tilingData(CCLayerTilingData::create(IntSize(1 0, 10), CCLayerTilingData::NoBorderTexels));
2652 tilingData->setBounds(IntSize(10, 10)); 2652 tilingData->setBounds(IntSize(10, 10));
2653 tileLayer->setTilingData(*tilingData); 2653 tileLayer->setTilingData(*tilingData);
2654 tileLayer->pushTileProperties(0, 0, 1, IntRect(0, 0, 10, 10)); 2654 tileLayer->pushTileProperties(0, 0, 1, IntRect(0, 0, 10, 10));
2655 rootLayer->addChild(tileLayer.PassAs<CCLayerImpl>()); 2655 rootLayer->addChild(tileLayer.PassAs<CCLayerImpl>());
2656 2656
2657 scoped_ptr<CCTextureLayerImpl> textureLayer = CCTextureLayerImpl::create(lay erId++); 2657 scoped_ptr<CCTextureLayerImpl> textureLayer = CCTextureLayerImpl::create(lay erId++);
2658 textureLayer->setBounds(IntSize(10, 10)); 2658 textureLayer->setBounds(IntSize(10, 10));
2659 textureLayer->setAnchorPoint(FloatPoint(0, 0)); 2659 textureLayer->setAnchorPoint(FloatPoint(0, 0));
2660 textureLayer->setContentBounds(IntSize(10, 10)); 2660 textureLayer->setContentBounds(IntSize(10, 10));
2661 textureLayer->setDrawsContent(true); 2661 textureLayer->setDrawsContent(true);
(...skipping 164 matching lines...) Expand 10 before | Expand all | Expand 10 after
2826 scoped_ptr<CCLayerImpl> rootLayer(CCLayerImpl::create(1)); 2826 scoped_ptr<CCLayerImpl> rootLayer(CCLayerImpl::create(1));
2827 rootLayer->setBounds(IntSize(10, 10)); 2827 rootLayer->setBounds(IntSize(10, 10));
2828 rootLayer->setAnchorPoint(FloatPoint(0, 0)); 2828 rootLayer->setAnchorPoint(FloatPoint(0, 0));
2829 2829
2830 scoped_ptr<CCTiledLayerImpl> tileLayer = CCTiledLayerImpl::create(2); 2830 scoped_ptr<CCTiledLayerImpl> tileLayer = CCTiledLayerImpl::create(2);
2831 tileLayer->setBounds(IntSize(10, 10)); 2831 tileLayer->setBounds(IntSize(10, 10));
2832 tileLayer->setAnchorPoint(FloatPoint(0, 0)); 2832 tileLayer->setAnchorPoint(FloatPoint(0, 0));
2833 tileLayer->setContentBounds(IntSize(10, 10)); 2833 tileLayer->setContentBounds(IntSize(10, 10));
2834 tileLayer->setDrawsContent(true); 2834 tileLayer->setDrawsContent(true);
2835 tileLayer->setSkipsDraw(false); 2835 tileLayer->setSkipsDraw(false);
2836 OwnPtr<CCLayerTilingData> tilingData(CCLayerTilingData::create(IntSize(10, 1 0), CCLayerTilingData::NoBorderTexels)); 2836 scoped_ptr<CCLayerTilingData> tilingData(CCLayerTilingData::create(IntSize(1 0, 10), CCLayerTilingData::NoBorderTexels));
2837 tilingData->setBounds(IntSize(10, 10)); 2837 tilingData->setBounds(IntSize(10, 10));
2838 tileLayer->setTilingData(*tilingData); 2838 tileLayer->setTilingData(*tilingData);
2839 tileLayer->pushTileProperties(0, 0, 1, IntRect(0, 0, 10, 10)); 2839 tileLayer->pushTileProperties(0, 0, 1, IntRect(0, 0, 10, 10));
2840 rootLayer->addChild(tileLayer.PassAs<CCLayerImpl>()); 2840 rootLayer->addChild(tileLayer.PassAs<CCLayerImpl>());
2841 2841
2842 scoped_ptr<CCTextureLayerImpl> textureLayer = CCTextureLayerImpl::create(3); 2842 scoped_ptr<CCTextureLayerImpl> textureLayer = CCTextureLayerImpl::create(3);
2843 textureLayer->setBounds(IntSize(10, 10)); 2843 textureLayer->setBounds(IntSize(10, 10));
2844 textureLayer->setAnchorPoint(FloatPoint(0, 0)); 2844 textureLayer->setAnchorPoint(FloatPoint(0, 0));
2845 textureLayer->setContentBounds(IntSize(10, 10)); 2845 textureLayer->setContentBounds(IntSize(10, 10));
2846 textureLayer->setDrawsContent(true); 2846 textureLayer->setDrawsContent(true);
(...skipping 775 matching lines...) Expand 10 before | Expand all | Expand 10 after
3622 3622
3623 child->setAnchorPoint(FloatPoint(0, 0)); 3623 child->setAnchorPoint(FloatPoint(0, 0));
3624 child->setPosition(FloatPoint(childRect.x(), childRect.y())); 3624 child->setPosition(FloatPoint(childRect.x(), childRect.y()));
3625 child->setOpacity(0.5); 3625 child->setOpacity(0.5);
3626 child->setBounds(IntSize(childRect.width(), childRect.height())); 3626 child->setBounds(IntSize(childRect.width(), childRect.height()));
3627 child->setContentBounds(child->bounds()); 3627 child->setContentBounds(child->bounds());
3628 child->setDrawsContent(true); 3628 child->setDrawsContent(true);
3629 child->setSkipsDraw(false); 3629 child->setSkipsDraw(false);
3630 3630
3631 // child layer has 10x10 tiles. 3631 // child layer has 10x10 tiles.
3632 OwnPtr<CCLayerTilingData> tiler = CCLayerTilingData::create(IntSize(10, 10), CCLayerTilingData::HasBorderTexels); 3632 scoped_ptr<CCLayerTilingData> tiler = CCLayerTilingData::create(IntSize(10, 10), CCLayerTilingData::HasBorderTexels);
3633 tiler->setBounds(child->contentBounds()); 3633 tiler->setBounds(child->contentBounds());
3634 child->setTilingData(*tiler.get()); 3634 child->setTilingData(*tiler.get());
3635 3635
3636 grandChild->setAnchorPoint(FloatPoint(0, 0)); 3636 grandChild->setAnchorPoint(FloatPoint(0, 0));
3637 grandChild->setPosition(IntPoint(grandChildRect.x(), grandChildRect.y())); 3637 grandChild->setPosition(IntPoint(grandChildRect.x(), grandChildRect.y()));
3638 grandChild->setBounds(IntSize(grandChildRect.width(), grandChildRect.height( ))); 3638 grandChild->setBounds(IntSize(grandChildRect.width(), grandChildRect.height( )));
3639 grandChild->setContentBounds(grandChild->bounds()); 3639 grandChild->setContentBounds(grandChild->bounds());
3640 grandChild->setDrawsContent(true); 3640 grandChild->setDrawsContent(true);
3641 3641
3642 CCTiledLayerImpl* childPtr = child.get(); 3642 CCTiledLayerImpl* childPtr = child.get();
(...skipping 695 matching lines...) Expand 10 before | Expand all | Expand 10 after
4338 verifyRenderPassTestData(removeRenderPassesCases[testCaseIndex], testDat a); 4338 verifyRenderPassTestData(removeRenderPassesCases[testCaseIndex], testDat a);
4339 testCaseIndex++; 4339 testCaseIndex++;
4340 } 4340 }
4341 } 4341 }
4342 4342
4343 INSTANTIATE_TEST_CASE_P(CCLayerTreeHostImplTests, 4343 INSTANTIATE_TEST_CASE_P(CCLayerTreeHostImplTests,
4344 CCLayerTreeHostImplTest, 4344 CCLayerTreeHostImplTest,
4345 ::testing::Values(false, true)); 4345 ::testing::Values(false, true));
4346 4346
4347 } // namespace 4347 } // namespace
OLDNEW
« no previous file with comments | « cc/layer_tiling_data.cc ('k') | cc/quad_culler_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698