OLD | NEW |
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 985 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
996 content->SetBounds(gfx::Size(10, 10)); | 996 content->SetBounds(gfx::Size(10, 10)); |
997 content->SetAnchorPoint(gfx::PointF()); | 997 content->SetAnchorPoint(gfx::PointF()); |
998 content->SetIsDrawable(true); | 998 content->SetIsDrawable(true); |
999 root->AddChild(content); | 999 root->AddChild(content); |
1000 | 1000 |
1001 scoped_refptr<TextureLayer> texture = TextureLayer::CreateForMailbox(NULL); | 1001 scoped_refptr<TextureLayer> texture = TextureLayer::CreateForMailbox(NULL); |
1002 texture->SetBounds(gfx::Size(10, 10)); | 1002 texture->SetBounds(gfx::Size(10, 10)); |
1003 texture->SetAnchorPoint(gfx::PointF()); | 1003 texture->SetAnchorPoint(gfx::PointF()); |
1004 texture->SetIsDrawable(true); | 1004 texture->SetIsDrawable(true); |
1005 texture->SetTextureMailbox( | 1005 texture->SetTextureMailbox( |
1006 TextureMailbox(mailbox, sync_point), | 1006 TextureMailbox(mailbox, GL_TEXTURE_2D, sync_point), |
1007 SingleReleaseCallback::Create( | 1007 SingleReleaseCallback::Create( |
1008 base::Bind(&LayerTreeHostContextTestDontUseLostResources:: | 1008 base::Bind(&LayerTreeHostContextTestDontUseLostResources:: |
1009 EmptyReleaseCallback))); | 1009 EmptyReleaseCallback))); |
1010 root->AddChild(texture); | 1010 root->AddChild(texture); |
1011 | 1011 |
1012 scoped_refptr<ContentLayer> mask = ContentLayer::Create(&client_); | 1012 scoped_refptr<ContentLayer> mask = ContentLayer::Create(&client_); |
1013 mask->SetBounds(gfx::Size(10, 10)); | 1013 mask->SetBounds(gfx::Size(10, 10)); |
1014 mask->SetAnchorPoint(gfx::PointF()); | 1014 mask->SetAnchorPoint(gfx::PointF()); |
1015 | 1015 |
1016 scoped_refptr<ContentLayer> content_with_mask = | 1016 scoped_refptr<ContentLayer> content_with_mask = |
(...skipping 20 matching lines...) Expand all Loading... |
1037 | 1037 |
1038 scoped_refptr<VideoLayer> video_scaled_hw = | 1038 scoped_refptr<VideoLayer> video_scaled_hw = |
1039 VideoLayer::Create(&scaled_hw_frame_provider_); | 1039 VideoLayer::Create(&scaled_hw_frame_provider_); |
1040 video_scaled_hw->SetBounds(gfx::Size(10, 10)); | 1040 video_scaled_hw->SetBounds(gfx::Size(10, 10)); |
1041 video_scaled_hw->SetAnchorPoint(gfx::PointF()); | 1041 video_scaled_hw->SetAnchorPoint(gfx::PointF()); |
1042 video_scaled_hw->SetIsDrawable(true); | 1042 video_scaled_hw->SetIsDrawable(true); |
1043 root->AddChild(video_scaled_hw); | 1043 root->AddChild(video_scaled_hw); |
1044 | 1044 |
1045 color_video_frame_ = VideoFrame::CreateColorFrame( | 1045 color_video_frame_ = VideoFrame::CreateColorFrame( |
1046 gfx::Size(4, 4), 0x80, 0x80, 0x80, base::TimeDelta()); | 1046 gfx::Size(4, 4), 0x80, 0x80, 0x80, base::TimeDelta()); |
1047 hw_video_frame_ = VideoFrame::WrapNativeTexture( | 1047 hw_video_frame_ = |
1048 make_scoped_ptr(new VideoFrame::MailboxHolder( | 1048 VideoFrame::WrapNativeTexture(make_scoped_ptr(new gpu::MailboxHolder( |
1049 mailbox, | 1049 mailbox, GL_TEXTURE_2D, sync_point)), |
1050 sync_point, | 1050 media::VideoFrame::ReleaseMailboxCB(), |
1051 VideoFrame::MailboxHolder::TextureNoLongerNeededCallback())), | 1051 gfx::Size(4, 4), |
1052 GL_TEXTURE_2D, | 1052 gfx::Rect(0, 0, 4, 4), |
1053 gfx::Size(4, 4), | 1053 gfx::Size(4, 4), |
1054 gfx::Rect(0, 0, 4, 4), | 1054 base::TimeDelta(), |
1055 gfx::Size(4, 4), | 1055 VideoFrame::ReadPixelsCB()); |
1056 base::TimeDelta(), | 1056 scaled_hw_video_frame_ = |
1057 VideoFrame::ReadPixelsCB(), | 1057 VideoFrame::WrapNativeTexture(make_scoped_ptr(new gpu::MailboxHolder( |
1058 base::Closure()); | 1058 mailbox, GL_TEXTURE_2D, sync_point)), |
1059 scaled_hw_video_frame_ = VideoFrame::WrapNativeTexture( | 1059 media::VideoFrame::ReleaseMailboxCB(), |
1060 make_scoped_ptr(new VideoFrame::MailboxHolder( | 1060 gfx::Size(4, 4), |
1061 mailbox, | 1061 gfx::Rect(0, 0, 3, 2), |
1062 sync_point, | 1062 gfx::Size(4, 4), |
1063 VideoFrame::MailboxHolder::TextureNoLongerNeededCallback())), | 1063 base::TimeDelta(), |
1064 GL_TEXTURE_2D, | 1064 VideoFrame::ReadPixelsCB()); |
1065 gfx::Size(4, 4), | |
1066 gfx::Rect(0, 0, 3, 2), | |
1067 gfx::Size(4, 4), | |
1068 base::TimeDelta(), | |
1069 VideoFrame::ReadPixelsCB(), | |
1070 base::Closure()); | |
1071 | 1065 |
1072 color_frame_provider_.set_frame(color_video_frame_); | 1066 color_frame_provider_.set_frame(color_video_frame_); |
1073 hw_frame_provider_.set_frame(hw_video_frame_); | 1067 hw_frame_provider_.set_frame(hw_video_frame_); |
1074 scaled_hw_frame_provider_.set_frame(scaled_hw_video_frame_); | 1068 scaled_hw_frame_provider_.set_frame(scaled_hw_video_frame_); |
1075 | 1069 |
1076 if (!delegating_renderer()) { | 1070 if (!delegating_renderer()) { |
1077 // TODO(danakj): IOSurface layer can not be transported. crbug.com/239335 | 1071 // TODO(danakj): IOSurface layer can not be transported. crbug.com/239335 |
1078 scoped_refptr<IOSurfaceLayer> io_surface = IOSurfaceLayer::Create(); | 1072 scoped_refptr<IOSurfaceLayer> io_surface = IOSurfaceLayer::Create(); |
1079 io_surface->SetBounds(gfx::Size(10, 10)); | 1073 io_surface->SetBounds(gfx::Size(10, 10)); |
1080 io_surface->SetAnchorPoint(gfx::PointF()); | 1074 io_surface->SetAnchorPoint(gfx::PointF()); |
(...skipping 901 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1982 protected: | 1976 protected: |
1983 FakeContentLayerClient client_; | 1977 FakeContentLayerClient client_; |
1984 scoped_refptr<FakeContentLayer> layer_; | 1978 scoped_refptr<FakeContentLayer> layer_; |
1985 int num_commits_; | 1979 int num_commits_; |
1986 }; | 1980 }; |
1987 | 1981 |
1988 SINGLE_AND_MULTI_THREAD_TEST_F(LayerTreeHostContextTestSurfaceCreateCallback); | 1982 SINGLE_AND_MULTI_THREAD_TEST_F(LayerTreeHostContextTestSurfaceCreateCallback); |
1989 | 1983 |
1990 } // namespace | 1984 } // namespace |
1991 } // namespace cc | 1985 } // namespace cc |
OLD | NEW |