| 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 1012 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1023 content->SetBounds(gfx::Size(10, 10)); | 1023 content->SetBounds(gfx::Size(10, 10)); |
| 1024 content->SetAnchorPoint(gfx::PointF()); | 1024 content->SetAnchorPoint(gfx::PointF()); |
| 1025 content->SetIsDrawable(true); | 1025 content->SetIsDrawable(true); |
| 1026 root->AddChild(content); | 1026 root->AddChild(content); |
| 1027 | 1027 |
| 1028 scoped_refptr<TextureLayer> texture = TextureLayer::CreateForMailbox(NULL); | 1028 scoped_refptr<TextureLayer> texture = TextureLayer::CreateForMailbox(NULL); |
| 1029 texture->SetBounds(gfx::Size(10, 10)); | 1029 texture->SetBounds(gfx::Size(10, 10)); |
| 1030 texture->SetAnchorPoint(gfx::PointF()); | 1030 texture->SetAnchorPoint(gfx::PointF()); |
| 1031 texture->SetIsDrawable(true); | 1031 texture->SetIsDrawable(true); |
| 1032 texture->SetTextureMailbox( | 1032 texture->SetTextureMailbox( |
| 1033 TextureMailbox(mailbox, sync_point), | 1033 TextureMailbox(mailbox, GL_TEXTURE_2D, sync_point), |
| 1034 SingleReleaseCallback::Create(base::Bind( | 1034 SingleReleaseCallback::Create( |
| 1035 &LayerTreeHostContextTestDontUseLostResources:: | 1035 base::Bind(&LayerTreeHostContextTestDontUseLostResources:: |
| 1036 EmptyReleaseCallback))); | 1036 EmptyReleaseCallback))); |
| 1037 root->AddChild(texture); | 1037 root->AddChild(texture); |
| 1038 | 1038 |
| 1039 scoped_refptr<ContentLayer> mask = ContentLayer::Create(&client_); | 1039 scoped_refptr<ContentLayer> mask = ContentLayer::Create(&client_); |
| 1040 mask->SetBounds(gfx::Size(10, 10)); | 1040 mask->SetBounds(gfx::Size(10, 10)); |
| 1041 mask->SetAnchorPoint(gfx::PointF()); | 1041 mask->SetAnchorPoint(gfx::PointF()); |
| 1042 | 1042 |
| 1043 scoped_refptr<ContentLayer> content_with_mask = | 1043 scoped_refptr<ContentLayer> content_with_mask = |
| 1044 ContentLayer::Create(&client_); | 1044 ContentLayer::Create(&client_); |
| 1045 content_with_mask->SetBounds(gfx::Size(10, 10)); | 1045 content_with_mask->SetBounds(gfx::Size(10, 10)); |
| 1046 content_with_mask->SetAnchorPoint(gfx::PointF()); | 1046 content_with_mask->SetAnchorPoint(gfx::PointF()); |
| (...skipping 17 matching lines...) Expand all Loading... |
| 1064 | 1064 |
| 1065 scoped_refptr<VideoLayer> video_scaled_hw = | 1065 scoped_refptr<VideoLayer> video_scaled_hw = |
| 1066 VideoLayer::Create(&scaled_hw_frame_provider_); | 1066 VideoLayer::Create(&scaled_hw_frame_provider_); |
| 1067 video_scaled_hw->SetBounds(gfx::Size(10, 10)); | 1067 video_scaled_hw->SetBounds(gfx::Size(10, 10)); |
| 1068 video_scaled_hw->SetAnchorPoint(gfx::PointF()); | 1068 video_scaled_hw->SetAnchorPoint(gfx::PointF()); |
| 1069 video_scaled_hw->SetIsDrawable(true); | 1069 video_scaled_hw->SetIsDrawable(true); |
| 1070 root->AddChild(video_scaled_hw); | 1070 root->AddChild(video_scaled_hw); |
| 1071 | 1071 |
| 1072 color_video_frame_ = VideoFrame::CreateColorFrame( | 1072 color_video_frame_ = VideoFrame::CreateColorFrame( |
| 1073 gfx::Size(4, 4), 0x80, 0x80, 0x80, base::TimeDelta()); | 1073 gfx::Size(4, 4), 0x80, 0x80, 0x80, base::TimeDelta()); |
| 1074 hw_video_frame_ = VideoFrame::WrapNativeTexture( | 1074 hw_video_frame_ = |
| 1075 make_scoped_ptr(new VideoFrame::MailboxHolder( | 1075 VideoFrame::WrapNativeTexture(make_scoped_ptr(new gpu::MailboxHolder( |
| 1076 mailbox, | 1076 mailbox, GL_TEXTURE_2D, sync_point)), |
| 1077 sync_point, | 1077 media::VideoFrame::ReleaseMailboxCB(), |
| 1078 VideoFrame::MailboxHolder::TextureNoLongerNeededCallback())), | 1078 gfx::Size(4, 4), |
| 1079 GL_TEXTURE_2D, | 1079 gfx::Rect(0, 0, 4, 4), |
| 1080 gfx::Size(4, 4), | 1080 gfx::Size(4, 4), |
| 1081 gfx::Rect(0, 0, 4, 4), | 1081 base::TimeDelta(), |
| 1082 gfx::Size(4, 4), | 1082 VideoFrame::ReadPixelsCB()); |
| 1083 base::TimeDelta(), | 1083 scaled_hw_video_frame_ = |
| 1084 VideoFrame::ReadPixelsCB(), | 1084 VideoFrame::WrapNativeTexture(make_scoped_ptr(new gpu::MailboxHolder( |
| 1085 base::Closure()); | 1085 mailbox, GL_TEXTURE_2D, sync_point)), |
| 1086 scaled_hw_video_frame_ = VideoFrame::WrapNativeTexture( | 1086 media::VideoFrame::ReleaseMailboxCB(), |
| 1087 make_scoped_ptr(new VideoFrame::MailboxHolder( | 1087 gfx::Size(4, 4), |
| 1088 mailbox, | 1088 gfx::Rect(0, 0, 3, 2), |
| 1089 sync_point, | 1089 gfx::Size(4, 4), |
| 1090 VideoFrame::MailboxHolder::TextureNoLongerNeededCallback())), | 1090 base::TimeDelta(), |
| 1091 GL_TEXTURE_2D, | 1091 VideoFrame::ReadPixelsCB()); |
| 1092 gfx::Size(4, 4), | |
| 1093 gfx::Rect(0, 0, 3, 2), | |
| 1094 gfx::Size(4, 4), | |
| 1095 base::TimeDelta(), | |
| 1096 VideoFrame::ReadPixelsCB(), | |
| 1097 base::Closure()); | |
| 1098 | 1092 |
| 1099 color_frame_provider_.set_frame(color_video_frame_); | 1093 color_frame_provider_.set_frame(color_video_frame_); |
| 1100 hw_frame_provider_.set_frame(hw_video_frame_); | 1094 hw_frame_provider_.set_frame(hw_video_frame_); |
| 1101 scaled_hw_frame_provider_.set_frame(scaled_hw_video_frame_); | 1095 scaled_hw_frame_provider_.set_frame(scaled_hw_video_frame_); |
| 1102 | 1096 |
| 1103 if (!delegating_renderer()) { | 1097 if (!delegating_renderer()) { |
| 1104 // TODO(danakj): IOSurface layer can not be transported. crbug.com/239335 | 1098 // TODO(danakj): IOSurface layer can not be transported. crbug.com/239335 |
| 1105 scoped_refptr<IOSurfaceLayer> io_surface = IOSurfaceLayer::Create(); | 1099 scoped_refptr<IOSurfaceLayer> io_surface = IOSurfaceLayer::Create(); |
| 1106 io_surface->SetBounds(gfx::Size(10, 10)); | 1100 io_surface->SetBounds(gfx::Size(10, 10)); |
| 1107 io_surface->SetAnchorPoint(gfx::PointF()); | 1101 io_surface->SetAnchorPoint(gfx::PointF()); |
| (...skipping 914 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2022 protected: | 2016 protected: |
| 2023 FakeContentLayerClient client_; | 2017 FakeContentLayerClient client_; |
| 2024 scoped_refptr<FakeContentLayer> layer_; | 2018 scoped_refptr<FakeContentLayer> layer_; |
| 2025 int num_commits_; | 2019 int num_commits_; |
| 2026 }; | 2020 }; |
| 2027 | 2021 |
| 2028 SINGLE_AND_MULTI_THREAD_TEST_F(LayerTreeHostContextTestSurfaceCreateCallback); | 2022 SINGLE_AND_MULTI_THREAD_TEST_F(LayerTreeHostContextTestSurfaceCreateCallback); |
| 2029 | 2023 |
| 2030 } // namespace | 2024 } // namespace |
| 2031 } // namespace cc | 2025 } // namespace cc |
| OLD | NEW |