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

Side by Side Diff: cc/trees/layer_tree_host_unittest_context.cc

Issue 295193002: Get rid of graphics layer anchor points, and replace with transform origin. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Cleaned up. Created 6 years, 6 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
OLDNEW
1 // Copyright 2012 The Chromium Authors. All rights reserved. 1 // Copyright 2012 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.h" 5 #include "cc/trees/layer_tree_host.h"
6 6
7 #include "base/basictypes.h" 7 #include "base/basictypes.h"
8 #include "cc/layers/content_layer.h" 8 #include "cc/layers/content_layer.h"
9 #include "cc/layers/delegated_frame_provider.h" 9 #include "cc/layers/delegated_frame_provider.h"
10 #include "cc/layers/delegated_frame_resource_collection.h" 10 #include "cc/layers/delegated_frame_resource_collection.h"
(...skipping 290 matching lines...) Expand 10 before | Expand all | Expand 10 after
301 }; 301 };
302 302
303 MULTI_THREAD_TEST_F(LayerTreeHostClientNotReadyDoesNotCreateOutputSurface); 303 MULTI_THREAD_TEST_F(LayerTreeHostClientNotReadyDoesNotCreateOutputSurface);
304 304
305 class LayerTreeHostContextTestLostContextSucceedsWithContent 305 class LayerTreeHostContextTestLostContextSucceedsWithContent
306 : public LayerTreeHostContextTestLostContextSucceeds { 306 : public LayerTreeHostContextTestLostContextSucceeds {
307 public: 307 public:
308 virtual void SetupTree() OVERRIDE { 308 virtual void SetupTree() OVERRIDE {
309 root_ = Layer::Create(); 309 root_ = Layer::Create();
310 root_->SetBounds(gfx::Size(10, 10)); 310 root_->SetBounds(gfx::Size(10, 10));
311 root_->SetAnchorPoint(gfx::PointF());
312 root_->SetIsDrawable(true); 311 root_->SetIsDrawable(true);
313 312
314 content_ = FakeContentLayer::Create(&client_); 313 content_ = FakeContentLayer::Create(&client_);
315 content_->SetBounds(gfx::Size(10, 10)); 314 content_->SetBounds(gfx::Size(10, 10));
316 content_->SetAnchorPoint(gfx::PointF());
317 content_->SetIsDrawable(true); 315 content_->SetIsDrawable(true);
318 316
319 root_->AddChild(content_); 317 root_->AddChild(content_);
320 318
321 layer_tree_host()->SetRootLayer(root_); 319 layer_tree_host()->SetRootLayer(root_);
322 LayerTreeHostContextTest::SetupTree(); 320 LayerTreeHostContextTest::SetupTree();
323 } 321 }
324 322
325 virtual void InvalidateAndSetNeedsCommit() OVERRIDE { 323 virtual void InvalidateAndSetNeedsCommit() OVERRIDE {
326 // Invalidate the render surface so we don't try to use a cached copy of the 324 // Invalidate the render surface so we don't try to use a cached copy of the
(...skipping 395 matching lines...) Expand 10 before | Expand all | Expand 10 after
722 RGBA_8888); 720 RGBA_8888);
723 ResourceProvider::ScopedWriteLockGL lock(child_resource_provider_.get(), 721 ResourceProvider::ScopedWriteLockGL lock(child_resource_provider_.get(),
724 resource); 722 resource);
725 723
726 gpu::Mailbox mailbox; 724 gpu::Mailbox mailbox;
727 gl->GenMailboxCHROMIUM(mailbox.name); 725 gl->GenMailboxCHROMIUM(mailbox.name);
728 GLuint sync_point = gl->InsertSyncPointCHROMIUM(); 726 GLuint sync_point = gl->InsertSyncPointCHROMIUM();
729 727
730 scoped_refptr<Layer> root = Layer::Create(); 728 scoped_refptr<Layer> root = Layer::Create();
731 root->SetBounds(gfx::Size(10, 10)); 729 root->SetBounds(gfx::Size(10, 10));
732 root->SetAnchorPoint(gfx::PointF());
733 root->SetIsDrawable(true); 730 root->SetIsDrawable(true);
734 731
735 scoped_refptr<FakeDelegatedRendererLayer> delegated = 732 scoped_refptr<FakeDelegatedRendererLayer> delegated =
736 FakeDelegatedRendererLayer::Create(delegated_frame_provider_.get()); 733 FakeDelegatedRendererLayer::Create(delegated_frame_provider_.get());
737 delegated->SetBounds(gfx::Size(10, 10)); 734 delegated->SetBounds(gfx::Size(10, 10));
738 delegated->SetAnchorPoint(gfx::PointF());
739 delegated->SetIsDrawable(true); 735 delegated->SetIsDrawable(true);
740 root->AddChild(delegated); 736 root->AddChild(delegated);
741 737
742 scoped_refptr<ContentLayer> content = ContentLayer::Create(&client_); 738 scoped_refptr<ContentLayer> content = ContentLayer::Create(&client_);
743 content->SetBounds(gfx::Size(10, 10)); 739 content->SetBounds(gfx::Size(10, 10));
744 content->SetAnchorPoint(gfx::PointF());
745 content->SetIsDrawable(true); 740 content->SetIsDrawable(true);
746 root->AddChild(content); 741 root->AddChild(content);
747 742
748 scoped_refptr<TextureLayer> texture = TextureLayer::CreateForMailbox(NULL); 743 scoped_refptr<TextureLayer> texture = TextureLayer::CreateForMailbox(NULL);
749 texture->SetBounds(gfx::Size(10, 10)); 744 texture->SetBounds(gfx::Size(10, 10));
750 texture->SetAnchorPoint(gfx::PointF());
751 texture->SetIsDrawable(true); 745 texture->SetIsDrawable(true);
752 texture->SetTextureMailbox( 746 texture->SetTextureMailbox(
753 TextureMailbox(mailbox, GL_TEXTURE_2D, sync_point), 747 TextureMailbox(mailbox, GL_TEXTURE_2D, sync_point),
754 SingleReleaseCallback::Create( 748 SingleReleaseCallback::Create(
755 base::Bind(&LayerTreeHostContextTestDontUseLostResources:: 749 base::Bind(&LayerTreeHostContextTestDontUseLostResources::
756 EmptyReleaseCallback))); 750 EmptyReleaseCallback)));
757 root->AddChild(texture); 751 root->AddChild(texture);
758 752
759 scoped_refptr<ContentLayer> mask = ContentLayer::Create(&client_); 753 scoped_refptr<ContentLayer> mask = ContentLayer::Create(&client_);
760 mask->SetBounds(gfx::Size(10, 10)); 754 mask->SetBounds(gfx::Size(10, 10));
761 mask->SetAnchorPoint(gfx::PointF());
762 755
763 scoped_refptr<ContentLayer> content_with_mask = 756 scoped_refptr<ContentLayer> content_with_mask =
764 ContentLayer::Create(&client_); 757 ContentLayer::Create(&client_);
765 content_with_mask->SetBounds(gfx::Size(10, 10)); 758 content_with_mask->SetBounds(gfx::Size(10, 10));
766 content_with_mask->SetAnchorPoint(gfx::PointF());
767 content_with_mask->SetIsDrawable(true); 759 content_with_mask->SetIsDrawable(true);
768 content_with_mask->SetMaskLayer(mask.get()); 760 content_with_mask->SetMaskLayer(mask.get());
769 root->AddChild(content_with_mask); 761 root->AddChild(content_with_mask);
770 762
771 scoped_refptr<VideoLayer> video_color = 763 scoped_refptr<VideoLayer> video_color =
772 VideoLayer::Create(&color_frame_provider_); 764 VideoLayer::Create(&color_frame_provider_);
773 video_color->SetBounds(gfx::Size(10, 10)); 765 video_color->SetBounds(gfx::Size(10, 10));
774 video_color->SetAnchorPoint(gfx::PointF());
775 video_color->SetIsDrawable(true); 766 video_color->SetIsDrawable(true);
776 root->AddChild(video_color); 767 root->AddChild(video_color);
777 768
778 scoped_refptr<VideoLayer> video_hw = 769 scoped_refptr<VideoLayer> video_hw =
779 VideoLayer::Create(&hw_frame_provider_); 770 VideoLayer::Create(&hw_frame_provider_);
780 video_hw->SetBounds(gfx::Size(10, 10)); 771 video_hw->SetBounds(gfx::Size(10, 10));
781 video_hw->SetAnchorPoint(gfx::PointF());
782 video_hw->SetIsDrawable(true); 772 video_hw->SetIsDrawable(true);
783 root->AddChild(video_hw); 773 root->AddChild(video_hw);
784 774
785 scoped_refptr<VideoLayer> video_scaled_hw = 775 scoped_refptr<VideoLayer> video_scaled_hw =
786 VideoLayer::Create(&scaled_hw_frame_provider_); 776 VideoLayer::Create(&scaled_hw_frame_provider_);
787 video_scaled_hw->SetBounds(gfx::Size(10, 10)); 777 video_scaled_hw->SetBounds(gfx::Size(10, 10));
788 video_scaled_hw->SetAnchorPoint(gfx::PointF());
789 video_scaled_hw->SetIsDrawable(true); 778 video_scaled_hw->SetIsDrawable(true);
790 root->AddChild(video_scaled_hw); 779 root->AddChild(video_scaled_hw);
791 780
792 color_video_frame_ = VideoFrame::CreateColorFrame( 781 color_video_frame_ = VideoFrame::CreateColorFrame(
793 gfx::Size(4, 4), 0x80, 0x80, 0x80, base::TimeDelta()); 782 gfx::Size(4, 4), 0x80, 0x80, 0x80, base::TimeDelta());
794 hw_video_frame_ = 783 hw_video_frame_ =
795 VideoFrame::WrapNativeTexture(make_scoped_ptr(new gpu::MailboxHolder( 784 VideoFrame::WrapNativeTexture(make_scoped_ptr(new gpu::MailboxHolder(
796 mailbox, GL_TEXTURE_2D, sync_point)), 785 mailbox, GL_TEXTURE_2D, sync_point)),
797 media::VideoFrame::ReleaseMailboxCB(), 786 media::VideoFrame::ReleaseMailboxCB(),
798 gfx::Size(4, 4), 787 gfx::Size(4, 4),
(...skipping 12 matching lines...) Expand all
811 VideoFrame::ReadPixelsCB()); 800 VideoFrame::ReadPixelsCB());
812 801
813 color_frame_provider_.set_frame(color_video_frame_); 802 color_frame_provider_.set_frame(color_video_frame_);
814 hw_frame_provider_.set_frame(hw_video_frame_); 803 hw_frame_provider_.set_frame(hw_video_frame_);
815 scaled_hw_frame_provider_.set_frame(scaled_hw_video_frame_); 804 scaled_hw_frame_provider_.set_frame(scaled_hw_video_frame_);
816 805
817 if (!delegating_renderer()) { 806 if (!delegating_renderer()) {
818 // TODO(danakj): IOSurface layer can not be transported. crbug.com/239335 807 // TODO(danakj): IOSurface layer can not be transported. crbug.com/239335
819 scoped_refptr<IOSurfaceLayer> io_surface = IOSurfaceLayer::Create(); 808 scoped_refptr<IOSurfaceLayer> io_surface = IOSurfaceLayer::Create();
820 io_surface->SetBounds(gfx::Size(10, 10)); 809 io_surface->SetBounds(gfx::Size(10, 10));
821 io_surface->SetAnchorPoint(gfx::PointF());
822 io_surface->SetIsDrawable(true); 810 io_surface->SetIsDrawable(true);
823 io_surface->SetIOSurfaceProperties(1, gfx::Size(10, 10)); 811 io_surface->SetIOSurfaceProperties(1, gfx::Size(10, 10));
824 root->AddChild(io_surface); 812 root->AddChild(io_surface);
825 } 813 }
826 814
827 // Enable the hud. 815 // Enable the hud.
828 LayerTreeDebugState debug_state; 816 LayerTreeDebugState debug_state;
829 debug_state.show_property_changed_rects = true; 817 debug_state.show_property_changed_rects = true;
830 layer_tree_host()->SetDebugState(debug_state); 818 layer_tree_host()->SetDebugState(debug_state);
831 819
832 scoped_refptr<PaintedScrollbarLayer> scrollbar = 820 scoped_refptr<PaintedScrollbarLayer> scrollbar =
833 PaintedScrollbarLayer::Create( 821 PaintedScrollbarLayer::Create(
834 scoped_ptr<Scrollbar>(new FakeScrollbar).Pass(), content->id()); 822 scoped_ptr<Scrollbar>(new FakeScrollbar).Pass(), content->id());
835 scrollbar->SetBounds(gfx::Size(10, 10)); 823 scrollbar->SetBounds(gfx::Size(10, 10));
836 scrollbar->SetAnchorPoint(gfx::PointF());
837 scrollbar->SetIsDrawable(true); 824 scrollbar->SetIsDrawable(true);
838 root->AddChild(scrollbar); 825 root->AddChild(scrollbar);
839 826
840 layer_tree_host()->SetRootLayer(root); 827 layer_tree_host()->SetRootLayer(root);
841 LayerTreeHostContextTest::SetupTree(); 828 LayerTreeHostContextTest::SetupTree();
842 } 829 }
843 830
844 virtual void BeginTest() OVERRIDE { PostSetNeedsCommitToMainThread(); } 831 virtual void BeginTest() OVERRIDE { PostSetNeedsCommitToMainThread(); }
845 832
846 virtual void CommitCompleteOnThread(LayerTreeHostImpl* host_impl) OVERRIDE { 833 virtual void CommitCompleteOnThread(LayerTreeHostImpl* host_impl) OVERRIDE {
(...skipping 75 matching lines...) Expand 10 before | Expand all | Expand 10 after
922 settings->impl_side_painting = true; 909 settings->impl_side_painting = true;
923 } 910 }
924 }; 911 };
925 912
926 class LayerTreeHostContextTestImplSidePainting 913 class LayerTreeHostContextTestImplSidePainting
927 : public ImplSidePaintingLayerTreeHostContextTest { 914 : public ImplSidePaintingLayerTreeHostContextTest {
928 public: 915 public:
929 virtual void SetupTree() OVERRIDE { 916 virtual void SetupTree() OVERRIDE {
930 scoped_refptr<Layer> root = Layer::Create(); 917 scoped_refptr<Layer> root = Layer::Create();
931 root->SetBounds(gfx::Size(10, 10)); 918 root->SetBounds(gfx::Size(10, 10));
932 root->SetAnchorPoint(gfx::PointF());
933 root->SetIsDrawable(true); 919 root->SetIsDrawable(true);
934 920
935 scoped_refptr<PictureLayer> picture = PictureLayer::Create(&client_); 921 scoped_refptr<PictureLayer> picture = PictureLayer::Create(&client_);
936 picture->SetBounds(gfx::Size(10, 10)); 922 picture->SetBounds(gfx::Size(10, 10));
937 picture->SetAnchorPoint(gfx::PointF());
938 picture->SetIsDrawable(true); 923 picture->SetIsDrawable(true);
939 root->AddChild(picture); 924 root->AddChild(picture);
940 925
941 layer_tree_host()->SetRootLayer(root); 926 layer_tree_host()->SetRootLayer(root);
942 LayerTreeHostContextTest::SetupTree(); 927 LayerTreeHostContextTest::SetupTree();
943 } 928 }
944 929
945 virtual void BeginTest() OVERRIDE { 930 virtual void BeginTest() OVERRIDE {
946 times_to_lose_during_commit_ = 1; 931 times_to_lose_during_commit_ = 1;
947 PostSetNeedsCommitToMainThread(); 932 PostSetNeedsCommitToMainThread();
(...skipping 535 matching lines...) Expand 10 before | Expand all | Expand 10 after
1483 1468
1484 protected: 1469 protected:
1485 FakeContentLayerClient client_; 1470 FakeContentLayerClient client_;
1486 scoped_refptr<FakeContentLayer> layer_; 1471 scoped_refptr<FakeContentLayer> layer_;
1487 }; 1472 };
1488 1473
1489 SINGLE_AND_MULTI_THREAD_TEST_F(LayerTreeHostContextTestSurfaceCreateCallback); 1474 SINGLE_AND_MULTI_THREAD_TEST_F(LayerTreeHostContextTestSurfaceCreateCallback);
1490 1475
1491 } // namespace 1476 } // namespace
1492 } // namespace cc 1477 } // namespace cc
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698