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/output/gl_renderer.h" | 5 #include "cc/output/gl_renderer.h" |
6 | 6 |
7 #include <set> | 7 #include <set> |
8 | 8 |
9 #include "base/location.h" | 9 #include "base/location.h" |
10 #include "base/single_thread_task_runner.h" | 10 #include "base/single_thread_task_runner.h" |
(...skipping 715 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
726 const GLenum* attachments)); | 726 const GLenum* attachments)); |
727 MOCK_METHOD1(clear, void(GLbitfield mask)); | 727 MOCK_METHOD1(clear, void(GLbitfield mask)); |
728 }; | 728 }; |
729 | 729 |
730 TEST_F(GLRendererTest, OpaqueBackground) { | 730 TEST_F(GLRendererTest, OpaqueBackground) { |
731 scoped_ptr<ClearCountingContext> context_owned(new ClearCountingContext); | 731 scoped_ptr<ClearCountingContext> context_owned(new ClearCountingContext); |
732 ClearCountingContext* context = context_owned.get(); | 732 ClearCountingContext* context = context_owned.get(); |
733 | 733 |
734 FakeOutputSurfaceClient output_surface_client; | 734 FakeOutputSurfaceClient output_surface_client; |
735 scoped_ptr<OutputSurface> output_surface( | 735 scoped_ptr<OutputSurface> output_surface( |
736 FakeOutputSurface::Create3d(context_owned.Pass())); | 736 FakeOutputSurface::Create3d(std::move(context_owned))); |
737 CHECK(output_surface->BindToClient(&output_surface_client)); | 737 CHECK(output_surface->BindToClient(&output_surface_client)); |
738 | 738 |
739 scoped_ptr<SharedBitmapManager> shared_bitmap_manager( | 739 scoped_ptr<SharedBitmapManager> shared_bitmap_manager( |
740 new TestSharedBitmapManager()); | 740 new TestSharedBitmapManager()); |
741 scoped_ptr<ResourceProvider> resource_provider = FakeResourceProvider::Create( | 741 scoped_ptr<ResourceProvider> resource_provider = FakeResourceProvider::Create( |
742 output_surface.get(), shared_bitmap_manager.get()); | 742 output_surface.get(), shared_bitmap_manager.get()); |
743 | 743 |
744 RendererSettings settings; | 744 RendererSettings settings; |
745 FakeRendererClient renderer_client; | 745 FakeRendererClient renderer_client; |
746 FakeRendererGL renderer(&renderer_client, | 746 FakeRendererGL renderer(&renderer_client, |
(...skipping 24 matching lines...) Expand all Loading... |
771 false); | 771 false); |
772 Mock::VerifyAndClearExpectations(context); | 772 Mock::VerifyAndClearExpectations(context); |
773 } | 773 } |
774 | 774 |
775 TEST_F(GLRendererTest, TransparentBackground) { | 775 TEST_F(GLRendererTest, TransparentBackground) { |
776 scoped_ptr<ClearCountingContext> context_owned(new ClearCountingContext); | 776 scoped_ptr<ClearCountingContext> context_owned(new ClearCountingContext); |
777 ClearCountingContext* context = context_owned.get(); | 777 ClearCountingContext* context = context_owned.get(); |
778 | 778 |
779 FakeOutputSurfaceClient output_surface_client; | 779 FakeOutputSurfaceClient output_surface_client; |
780 scoped_ptr<OutputSurface> output_surface( | 780 scoped_ptr<OutputSurface> output_surface( |
781 FakeOutputSurface::Create3d(context_owned.Pass())); | 781 FakeOutputSurface::Create3d(std::move(context_owned))); |
782 CHECK(output_surface->BindToClient(&output_surface_client)); | 782 CHECK(output_surface->BindToClient(&output_surface_client)); |
783 | 783 |
784 scoped_ptr<SharedBitmapManager> shared_bitmap_manager( | 784 scoped_ptr<SharedBitmapManager> shared_bitmap_manager( |
785 new TestSharedBitmapManager()); | 785 new TestSharedBitmapManager()); |
786 scoped_ptr<ResourceProvider> resource_provider = FakeResourceProvider::Create( | 786 scoped_ptr<ResourceProvider> resource_provider = FakeResourceProvider::Create( |
787 output_surface.get(), shared_bitmap_manager.get()); | 787 output_surface.get(), shared_bitmap_manager.get()); |
788 | 788 |
789 RendererSettings settings; | 789 RendererSettings settings; |
790 FakeRendererClient renderer_client; | 790 FakeRendererClient renderer_client; |
791 FakeRendererGL renderer(&renderer_client, | 791 FakeRendererGL renderer(&renderer_client, |
(...skipping 17 matching lines...) Expand all Loading... |
809 | 809 |
810 Mock::VerifyAndClearExpectations(context); | 810 Mock::VerifyAndClearExpectations(context); |
811 } | 811 } |
812 | 812 |
813 TEST_F(GLRendererTest, OffscreenOutputSurface) { | 813 TEST_F(GLRendererTest, OffscreenOutputSurface) { |
814 scoped_ptr<ClearCountingContext> context_owned(new ClearCountingContext); | 814 scoped_ptr<ClearCountingContext> context_owned(new ClearCountingContext); |
815 ClearCountingContext* context = context_owned.get(); | 815 ClearCountingContext* context = context_owned.get(); |
816 | 816 |
817 FakeOutputSurfaceClient output_surface_client; | 817 FakeOutputSurfaceClient output_surface_client; |
818 scoped_ptr<OutputSurface> output_surface( | 818 scoped_ptr<OutputSurface> output_surface( |
819 FakeOutputSurface::CreateOffscreen(context_owned.Pass())); | 819 FakeOutputSurface::CreateOffscreen(std::move(context_owned))); |
820 CHECK(output_surface->BindToClient(&output_surface_client)); | 820 CHECK(output_surface->BindToClient(&output_surface_client)); |
821 | 821 |
822 scoped_ptr<SharedBitmapManager> shared_bitmap_manager( | 822 scoped_ptr<SharedBitmapManager> shared_bitmap_manager( |
823 new TestSharedBitmapManager()); | 823 new TestSharedBitmapManager()); |
824 scoped_ptr<ResourceProvider> resource_provider = FakeResourceProvider::Create( | 824 scoped_ptr<ResourceProvider> resource_provider = FakeResourceProvider::Create( |
825 output_surface.get(), shared_bitmap_manager.get()); | 825 output_surface.get(), shared_bitmap_manager.get()); |
826 | 826 |
827 RendererSettings settings; | 827 RendererSettings settings; |
828 FakeRendererClient renderer_client; | 828 FakeRendererClient renderer_client; |
829 FakeRendererGL renderer(&renderer_client, | 829 FakeRendererGL renderer(&renderer_client, |
(...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
880 private: | 880 private: |
881 bool last_call_was_set_visibility_; | 881 bool last_call_was_set_visibility_; |
882 }; | 882 }; |
883 | 883 |
884 TEST_F(GLRendererTest, VisibilityChangeIsLastCall) { | 884 TEST_F(GLRendererTest, VisibilityChangeIsLastCall) { |
885 scoped_ptr<VisibilityChangeIsLastCallTrackingContext> context_owned( | 885 scoped_ptr<VisibilityChangeIsLastCallTrackingContext> context_owned( |
886 new VisibilityChangeIsLastCallTrackingContext); | 886 new VisibilityChangeIsLastCallTrackingContext); |
887 VisibilityChangeIsLastCallTrackingContext* context = context_owned.get(); | 887 VisibilityChangeIsLastCallTrackingContext* context = context_owned.get(); |
888 | 888 |
889 scoped_refptr<TestContextProvider> provider = | 889 scoped_refptr<TestContextProvider> provider = |
890 TestContextProvider::Create(context_owned.Pass()); | 890 TestContextProvider::Create(std::move(context_owned)); |
891 | 891 |
892 provider->support()->SetSurfaceVisibleCallback(base::Bind( | 892 provider->support()->SetSurfaceVisibleCallback(base::Bind( |
893 &VisibilityChangeIsLastCallTrackingContext::set_last_call_was_visibility, | 893 &VisibilityChangeIsLastCallTrackingContext::set_last_call_was_visibility, |
894 base::Unretained(context))); | 894 base::Unretained(context))); |
895 | 895 |
896 FakeOutputSurfaceClient output_surface_client; | 896 FakeOutputSurfaceClient output_surface_client; |
897 scoped_ptr<OutputSurface> output_surface( | 897 scoped_ptr<OutputSurface> output_surface( |
898 FakeOutputSurface::Create3d(provider)); | 898 FakeOutputSurface::Create3d(provider)); |
899 CHECK(output_surface->BindToClient(&output_surface_client)); | 899 CHECK(output_surface->BindToClient(&output_surface_client)); |
900 | 900 |
(...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
953 GLenum active_texture_; | 953 GLenum active_texture_; |
954 }; | 954 }; |
955 | 955 |
956 TEST_F(GLRendererTest, ActiveTextureState) { | 956 TEST_F(GLRendererTest, ActiveTextureState) { |
957 scoped_ptr<TextureStateTrackingContext> context_owned( | 957 scoped_ptr<TextureStateTrackingContext> context_owned( |
958 new TextureStateTrackingContext); | 958 new TextureStateTrackingContext); |
959 TextureStateTrackingContext* context = context_owned.get(); | 959 TextureStateTrackingContext* context = context_owned.get(); |
960 | 960 |
961 FakeOutputSurfaceClient output_surface_client; | 961 FakeOutputSurfaceClient output_surface_client; |
962 scoped_ptr<OutputSurface> output_surface( | 962 scoped_ptr<OutputSurface> output_surface( |
963 FakeOutputSurface::Create3d(context_owned.Pass())); | 963 FakeOutputSurface::Create3d(std::move(context_owned))); |
964 CHECK(output_surface->BindToClient(&output_surface_client)); | 964 CHECK(output_surface->BindToClient(&output_surface_client)); |
965 | 965 |
966 scoped_ptr<SharedBitmapManager> shared_bitmap_manager( | 966 scoped_ptr<SharedBitmapManager> shared_bitmap_manager( |
967 new TestSharedBitmapManager()); | 967 new TestSharedBitmapManager()); |
968 scoped_ptr<ResourceProvider> resource_provider = FakeResourceProvider::Create( | 968 scoped_ptr<ResourceProvider> resource_provider = FakeResourceProvider::Create( |
969 output_surface.get(), shared_bitmap_manager.get()); | 969 output_surface.get(), shared_bitmap_manager.get()); |
970 | 970 |
971 RendererSettings settings; | 971 RendererSettings settings; |
972 FakeRendererClient renderer_client; | 972 FakeRendererClient renderer_client; |
973 FakeRendererGL renderer(&renderer_client, | 973 FakeRendererGL renderer(&renderer_client, |
(...skipping 65 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1039 void(GLenum mode, GLsizei count, GLenum type, GLintptr offset)); | 1039 void(GLenum mode, GLsizei count, GLenum type, GLintptr offset)); |
1040 }; | 1040 }; |
1041 | 1041 |
1042 TEST_F(GLRendererTest, ShouldClearRootRenderPass) { | 1042 TEST_F(GLRendererTest, ShouldClearRootRenderPass) { |
1043 scoped_ptr<NoClearRootRenderPassMockContext> mock_context_owned( | 1043 scoped_ptr<NoClearRootRenderPassMockContext> mock_context_owned( |
1044 new NoClearRootRenderPassMockContext); | 1044 new NoClearRootRenderPassMockContext); |
1045 NoClearRootRenderPassMockContext* mock_context = mock_context_owned.get(); | 1045 NoClearRootRenderPassMockContext* mock_context = mock_context_owned.get(); |
1046 | 1046 |
1047 FakeOutputSurfaceClient output_surface_client; | 1047 FakeOutputSurfaceClient output_surface_client; |
1048 scoped_ptr<OutputSurface> output_surface( | 1048 scoped_ptr<OutputSurface> output_surface( |
1049 FakeOutputSurface::Create3d(mock_context_owned.Pass())); | 1049 FakeOutputSurface::Create3d(std::move(mock_context_owned))); |
1050 CHECK(output_surface->BindToClient(&output_surface_client)); | 1050 CHECK(output_surface->BindToClient(&output_surface_client)); |
1051 | 1051 |
1052 scoped_ptr<SharedBitmapManager> shared_bitmap_manager( | 1052 scoped_ptr<SharedBitmapManager> shared_bitmap_manager( |
1053 new TestSharedBitmapManager()); | 1053 new TestSharedBitmapManager()); |
1054 scoped_ptr<ResourceProvider> resource_provider = FakeResourceProvider::Create( | 1054 scoped_ptr<ResourceProvider> resource_provider = FakeResourceProvider::Create( |
1055 output_surface.get(), shared_bitmap_manager.get()); | 1055 output_surface.get(), shared_bitmap_manager.get()); |
1056 | 1056 |
1057 RendererSettings settings; | 1057 RendererSettings settings; |
1058 settings.should_clear_root_render_pass = false; | 1058 settings.should_clear_root_render_pass = false; |
1059 | 1059 |
(...skipping 70 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1130 private: | 1130 private: |
1131 bool scissor_enabled_; | 1131 bool scissor_enabled_; |
1132 }; | 1132 }; |
1133 | 1133 |
1134 TEST_F(GLRendererTest, ScissorTestWhenClearing) { | 1134 TEST_F(GLRendererTest, ScissorTestWhenClearing) { |
1135 scoped_ptr<ScissorTestOnClearCheckingContext> context_owned( | 1135 scoped_ptr<ScissorTestOnClearCheckingContext> context_owned( |
1136 new ScissorTestOnClearCheckingContext); | 1136 new ScissorTestOnClearCheckingContext); |
1137 | 1137 |
1138 FakeOutputSurfaceClient output_surface_client; | 1138 FakeOutputSurfaceClient output_surface_client; |
1139 scoped_ptr<OutputSurface> output_surface( | 1139 scoped_ptr<OutputSurface> output_surface( |
1140 FakeOutputSurface::Create3d(context_owned.Pass())); | 1140 FakeOutputSurface::Create3d(std::move(context_owned))); |
1141 CHECK(output_surface->BindToClient(&output_surface_client)); | 1141 CHECK(output_surface->BindToClient(&output_surface_client)); |
1142 | 1142 |
1143 scoped_ptr<SharedBitmapManager> shared_bitmap_manager( | 1143 scoped_ptr<SharedBitmapManager> shared_bitmap_manager( |
1144 new TestSharedBitmapManager()); | 1144 new TestSharedBitmapManager()); |
1145 scoped_ptr<ResourceProvider> resource_provider = FakeResourceProvider::Create( | 1145 scoped_ptr<ResourceProvider> resource_provider = FakeResourceProvider::Create( |
1146 output_surface.get(), shared_bitmap_manager.get()); | 1146 output_surface.get(), shared_bitmap_manager.get()); |
1147 | 1147 |
1148 RendererSettings settings; | 1148 RendererSettings settings; |
1149 FakeRendererClient renderer_client; | 1149 FakeRendererClient renderer_client; |
1150 FakeRendererGL renderer(&renderer_client, | 1150 FakeRendererGL renderer(&renderer_client, |
(...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1203 void reset() { discarded_ = 0; } | 1203 void reset() { discarded_ = 0; } |
1204 | 1204 |
1205 private: | 1205 private: |
1206 int discarded_; | 1206 int discarded_; |
1207 }; | 1207 }; |
1208 | 1208 |
1209 class NonReshapableOutputSurface : public FakeOutputSurface { | 1209 class NonReshapableOutputSurface : public FakeOutputSurface { |
1210 public: | 1210 public: |
1211 explicit NonReshapableOutputSurface( | 1211 explicit NonReshapableOutputSurface( |
1212 scoped_ptr<TestWebGraphicsContext3D> context3d) | 1212 scoped_ptr<TestWebGraphicsContext3D> context3d) |
1213 : FakeOutputSurface(TestContextProvider::Create(context3d.Pass()), | 1213 : FakeOutputSurface(TestContextProvider::Create(std::move(context3d)), |
1214 false) { | 1214 false) { |
1215 surface_size_ = gfx::Size(500, 500); | 1215 surface_size_ = gfx::Size(500, 500); |
1216 } | 1216 } |
1217 void Reshape(const gfx::Size& size, float scale_factor) override {} | 1217 void Reshape(const gfx::Size& size, float scale_factor) override {} |
1218 void set_fixed_size(const gfx::Size& size) { surface_size_ = size; } | 1218 void set_fixed_size(const gfx::Size& size) { surface_size_ = size; } |
1219 }; | 1219 }; |
1220 | 1220 |
1221 TEST_F(GLRendererTest, NoDiscardOnPartialUpdates) { | 1221 TEST_F(GLRendererTest, NoDiscardOnPartialUpdates) { |
1222 scoped_ptr<DiscardCheckingContext> context_owned(new DiscardCheckingContext); | 1222 scoped_ptr<DiscardCheckingContext> context_owned(new DiscardCheckingContext); |
1223 DiscardCheckingContext* context = context_owned.get(); | 1223 DiscardCheckingContext* context = context_owned.get(); |
1224 | 1224 |
1225 FakeOutputSurfaceClient output_surface_client; | 1225 FakeOutputSurfaceClient output_surface_client; |
1226 scoped_ptr<NonReshapableOutputSurface> output_surface( | 1226 scoped_ptr<NonReshapableOutputSurface> output_surface( |
1227 new NonReshapableOutputSurface(context_owned.Pass())); | 1227 new NonReshapableOutputSurface(std::move(context_owned))); |
1228 CHECK(output_surface->BindToClient(&output_surface_client)); | 1228 CHECK(output_surface->BindToClient(&output_surface_client)); |
1229 output_surface->set_fixed_size(gfx::Size(100, 100)); | 1229 output_surface->set_fixed_size(gfx::Size(100, 100)); |
1230 | 1230 |
1231 scoped_ptr<SharedBitmapManager> shared_bitmap_manager( | 1231 scoped_ptr<SharedBitmapManager> shared_bitmap_manager( |
1232 new TestSharedBitmapManager()); | 1232 new TestSharedBitmapManager()); |
1233 scoped_ptr<ResourceProvider> resource_provider = FakeResourceProvider::Create( | 1233 scoped_ptr<ResourceProvider> resource_provider = FakeResourceProvider::Create( |
1234 output_surface.get(), shared_bitmap_manager.get()); | 1234 output_surface.get(), shared_bitmap_manager.get()); |
1235 | 1235 |
1236 RendererSettings settings; | 1236 RendererSettings settings; |
1237 settings.partial_swap_enabled = true; | 1237 settings.partial_swap_enabled = true; |
(...skipping 139 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1377 new FlippedScissorAndViewportContext); | 1377 new FlippedScissorAndViewportContext); |
1378 | 1378 |
1379 // We expect exactly one call to viewport on this context and exactly two | 1379 // We expect exactly one call to viewport on this context and exactly two |
1380 // to scissor (one to scissor the clear, one to scissor the quad draw). | 1380 // to scissor (one to scissor the clear, one to scissor the quad draw). |
1381 EXPECT_CALL(*context_owned, viewport(10, 390, 100, 100)); | 1381 EXPECT_CALL(*context_owned, viewport(10, 390, 100, 100)); |
1382 EXPECT_CALL(*context_owned, scissor(10, 390, 100, 100)); | 1382 EXPECT_CALL(*context_owned, scissor(10, 390, 100, 100)); |
1383 EXPECT_CALL(*context_owned, scissor(30, 450, 20, 20)); | 1383 EXPECT_CALL(*context_owned, scissor(30, 450, 20, 20)); |
1384 | 1384 |
1385 FakeOutputSurfaceClient output_surface_client; | 1385 FakeOutputSurfaceClient output_surface_client; |
1386 scoped_ptr<OutputSurface> output_surface( | 1386 scoped_ptr<OutputSurface> output_surface( |
1387 new NonReshapableOutputSurface(context_owned.Pass())); | 1387 new NonReshapableOutputSurface(std::move(context_owned))); |
1388 CHECK(output_surface->BindToClient(&output_surface_client)); | 1388 CHECK(output_surface->BindToClient(&output_surface_client)); |
1389 | 1389 |
1390 scoped_ptr<SharedBitmapManager> shared_bitmap_manager( | 1390 scoped_ptr<SharedBitmapManager> shared_bitmap_manager( |
1391 new TestSharedBitmapManager()); | 1391 new TestSharedBitmapManager()); |
1392 scoped_ptr<ResourceProvider> resource_provider = FakeResourceProvider::Create( | 1392 scoped_ptr<ResourceProvider> resource_provider = FakeResourceProvider::Create( |
1393 output_surface.get(), shared_bitmap_manager.get()); | 1393 output_surface.get(), shared_bitmap_manager.get()); |
1394 | 1394 |
1395 RendererSettings settings; | 1395 RendererSettings settings; |
1396 FakeRendererClient renderer_client; | 1396 FakeRendererClient renderer_client; |
1397 FakeRendererGL renderer(&renderer_client, | 1397 FakeRendererGL renderer(&renderer_client, |
(...skipping 664 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2062 bool lost_resource, | 2062 bool lost_resource, |
2063 BlockingTaskRunner* main_thread_task_runner) {} | 2063 BlockingTaskRunner* main_thread_task_runner) {} |
2064 | 2064 |
2065 void IgnoreCopyResult(scoped_ptr<CopyOutputResult> result) { | 2065 void IgnoreCopyResult(scoped_ptr<CopyOutputResult> result) { |
2066 } | 2066 } |
2067 | 2067 |
2068 TEST_F(GLRendererTest, DontOverlayWithCopyRequests) { | 2068 TEST_F(GLRendererTest, DontOverlayWithCopyRequests) { |
2069 scoped_ptr<DiscardCheckingContext> context_owned(new DiscardCheckingContext); | 2069 scoped_ptr<DiscardCheckingContext> context_owned(new DiscardCheckingContext); |
2070 FakeOutputSurfaceClient output_surface_client; | 2070 FakeOutputSurfaceClient output_surface_client; |
2071 scoped_ptr<FakeOutputSurface> output_surface( | 2071 scoped_ptr<FakeOutputSurface> output_surface( |
2072 FakeOutputSurface::Create3d(context_owned.Pass())); | 2072 FakeOutputSurface::Create3d(std::move(context_owned))); |
2073 CHECK(output_surface->BindToClient(&output_surface_client)); | 2073 CHECK(output_surface->BindToClient(&output_surface_client)); |
2074 | 2074 |
2075 scoped_ptr<SharedBitmapManager> shared_bitmap_manager( | 2075 scoped_ptr<SharedBitmapManager> shared_bitmap_manager( |
2076 new TestSharedBitmapManager()); | 2076 new TestSharedBitmapManager()); |
2077 scoped_ptr<ResourceProvider> resource_provider = FakeResourceProvider::Create( | 2077 scoped_ptr<ResourceProvider> resource_provider = FakeResourceProvider::Create( |
2078 output_surface.get(), shared_bitmap_manager.get()); | 2078 output_surface.get(), shared_bitmap_manager.get()); |
2079 scoped_ptr<TextureMailboxDeleter> mailbox_deleter( | 2079 scoped_ptr<TextureMailboxDeleter> mailbox_deleter( |
2080 new TextureMailboxDeleter(base::ThreadTaskRunnerHandle::Get())); | 2080 new TextureMailboxDeleter(base::ThreadTaskRunnerHandle::Get())); |
2081 | 2081 |
2082 RendererSettings settings; | 2082 RendererSettings settings; |
(...skipping 16 matching lines...) Expand all Loading... |
2099 root_pass->has_transparent_background = false; | 2099 root_pass->has_transparent_background = false; |
2100 root_pass->copy_requests.push_back( | 2100 root_pass->copy_requests.push_back( |
2101 CopyOutputRequest::CreateRequest(base::Bind(&IgnoreCopyResult))); | 2101 CopyOutputRequest::CreateRequest(base::Bind(&IgnoreCopyResult))); |
2102 | 2102 |
2103 TextureMailbox mailbox = | 2103 TextureMailbox mailbox = |
2104 TextureMailbox(gpu::Mailbox::Generate(), gpu::SyncToken(), GL_TEXTURE_2D, | 2104 TextureMailbox(gpu::Mailbox::Generate(), gpu::SyncToken(), GL_TEXTURE_2D, |
2105 gfx::Size(256, 256), true); | 2105 gfx::Size(256, 256), true); |
2106 scoped_ptr<SingleReleaseCallbackImpl> release_callback = | 2106 scoped_ptr<SingleReleaseCallbackImpl> release_callback = |
2107 SingleReleaseCallbackImpl::Create(base::Bind(&MailboxReleased)); | 2107 SingleReleaseCallbackImpl::Create(base::Bind(&MailboxReleased)); |
2108 ResourceId resource_id = resource_provider->CreateResourceFromTextureMailbox( | 2108 ResourceId resource_id = resource_provider->CreateResourceFromTextureMailbox( |
2109 mailbox, release_callback.Pass()); | 2109 mailbox, std::move(release_callback)); |
2110 bool premultiplied_alpha = false; | 2110 bool premultiplied_alpha = false; |
2111 bool flipped = false; | 2111 bool flipped = false; |
2112 bool nearest_neighbor = false; | 2112 bool nearest_neighbor = false; |
2113 float vertex_opacity[4] = {1.0f, 1.0f, 1.0f, 1.0f}; | 2113 float vertex_opacity[4] = {1.0f, 1.0f, 1.0f, 1.0f}; |
2114 | 2114 |
2115 TextureDrawQuad* overlay_quad = | 2115 TextureDrawQuad* overlay_quad = |
2116 root_pass->CreateAndAppendDrawQuad<TextureDrawQuad>(); | 2116 root_pass->CreateAndAppendDrawQuad<TextureDrawQuad>(); |
2117 overlay_quad->SetNew(root_pass->CreateAndAppendSharedQuadState(), | 2117 overlay_quad->SetNew(root_pass->CreateAndAppendSharedQuadState(), |
2118 viewport_rect, viewport_rect, viewport_rect, resource_id, | 2118 viewport_rect, viewport_rect, viewport_rect, resource_id, |
2119 premultiplied_alpha, gfx::PointF(0, 0), | 2119 premultiplied_alpha, gfx::PointF(0, 0), |
(...skipping 95 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2215 const gfx::RectF& uv_rect)); | 2215 const gfx::RectF& uv_rect)); |
2216 }; | 2216 }; |
2217 | 2217 |
2218 TEST_F(GLRendererTest, OverlaySyncTokensAreProcessed) { | 2218 TEST_F(GLRendererTest, OverlaySyncTokensAreProcessed) { |
2219 scoped_ptr<WaitSyncTokenCountingContext> context_owned( | 2219 scoped_ptr<WaitSyncTokenCountingContext> context_owned( |
2220 new WaitSyncTokenCountingContext); | 2220 new WaitSyncTokenCountingContext); |
2221 WaitSyncTokenCountingContext* context = context_owned.get(); | 2221 WaitSyncTokenCountingContext* context = context_owned.get(); |
2222 | 2222 |
2223 MockOverlayScheduler overlay_scheduler; | 2223 MockOverlayScheduler overlay_scheduler; |
2224 scoped_refptr<TestContextProvider> context_provider = | 2224 scoped_refptr<TestContextProvider> context_provider = |
2225 TestContextProvider::Create(context_owned.Pass()); | 2225 TestContextProvider::Create(std::move(context_owned)); |
2226 context_provider->support()->SetScheduleOverlayPlaneCallback(base::Bind( | 2226 context_provider->support()->SetScheduleOverlayPlaneCallback(base::Bind( |
2227 &MockOverlayScheduler::Schedule, base::Unretained(&overlay_scheduler))); | 2227 &MockOverlayScheduler::Schedule, base::Unretained(&overlay_scheduler))); |
2228 | 2228 |
2229 FakeOutputSurfaceClient output_surface_client; | 2229 FakeOutputSurfaceClient output_surface_client; |
2230 scoped_ptr<OutputSurface> output_surface( | 2230 scoped_ptr<OutputSurface> output_surface( |
2231 FakeOutputSurface::Create3d(context_provider)); | 2231 FakeOutputSurface::Create3d(context_provider)); |
2232 CHECK(output_surface->BindToClient(&output_surface_client)); | 2232 CHECK(output_surface->BindToClient(&output_surface_client)); |
2233 | 2233 |
2234 scoped_ptr<SharedBitmapManager> shared_bitmap_manager( | 2234 scoped_ptr<SharedBitmapManager> shared_bitmap_manager( |
2235 new TestSharedBitmapManager()); | 2235 new TestSharedBitmapManager()); |
(...skipping 18 matching lines...) Expand all Loading... |
2254 viewport_rect, gfx::Transform()); | 2254 viewport_rect, gfx::Transform()); |
2255 root_pass->has_transparent_background = false; | 2255 root_pass->has_transparent_background = false; |
2256 | 2256 |
2257 gpu::SyncToken sync_token(29); | 2257 gpu::SyncToken sync_token(29); |
2258 TextureMailbox mailbox = | 2258 TextureMailbox mailbox = |
2259 TextureMailbox(gpu::Mailbox::Generate(), sync_token, GL_TEXTURE_2D, | 2259 TextureMailbox(gpu::Mailbox::Generate(), sync_token, GL_TEXTURE_2D, |
2260 gfx::Size(256, 256), true); | 2260 gfx::Size(256, 256), true); |
2261 scoped_ptr<SingleReleaseCallbackImpl> release_callback = | 2261 scoped_ptr<SingleReleaseCallbackImpl> release_callback = |
2262 SingleReleaseCallbackImpl::Create(base::Bind(&MailboxReleased)); | 2262 SingleReleaseCallbackImpl::Create(base::Bind(&MailboxReleased)); |
2263 ResourceId resource_id = resource_provider->CreateResourceFromTextureMailbox( | 2263 ResourceId resource_id = resource_provider->CreateResourceFromTextureMailbox( |
2264 mailbox, release_callback.Pass()); | 2264 mailbox, std::move(release_callback)); |
2265 bool premultiplied_alpha = false; | 2265 bool premultiplied_alpha = false; |
2266 bool flipped = false; | 2266 bool flipped = false; |
2267 bool nearest_neighbor = false; | 2267 bool nearest_neighbor = false; |
2268 float vertex_opacity[4] = {1.0f, 1.0f, 1.0f, 1.0f}; | 2268 float vertex_opacity[4] = {1.0f, 1.0f, 1.0f, 1.0f}; |
2269 gfx::PointF uv_top_left(0, 0); | 2269 gfx::PointF uv_top_left(0, 0); |
2270 gfx::PointF uv_bottom_right(1, 1); | 2270 gfx::PointF uv_bottom_right(1, 1); |
2271 | 2271 |
2272 TextureDrawQuad* overlay_quad = | 2272 TextureDrawQuad* overlay_quad = |
2273 root_pass->CreateAndAppendDrawQuad<TextureDrawQuad>(); | 2273 root_pass->CreateAndAppendDrawQuad<TextureDrawQuad>(); |
2274 SharedQuadState* shared_state = root_pass->CreateAndAppendSharedQuadState(); | 2274 SharedQuadState* shared_state = root_pass->CreateAndAppendSharedQuadState(); |
(...skipping 10 matching lines...) Expand all Loading... |
2285 EXPECT_CALL(overlay_scheduler, | 2285 EXPECT_CALL(overlay_scheduler, |
2286 Schedule(1, gfx::OVERLAY_TRANSFORM_NONE, _, viewport_rect, | 2286 Schedule(1, gfx::OVERLAY_TRANSFORM_NONE, _, viewport_rect, |
2287 BoundingRect(uv_top_left, uv_bottom_right))).Times(1); | 2287 BoundingRect(uv_top_left, uv_bottom_right))).Times(1); |
2288 | 2288 |
2289 renderer.DrawFrame(&render_passes_in_draw_order_, 1.f, viewport_rect, | 2289 renderer.DrawFrame(&render_passes_in_draw_order_, 1.f, viewport_rect, |
2290 viewport_rect, false); | 2290 viewport_rect, false); |
2291 } | 2291 } |
2292 | 2292 |
2293 } // namespace | 2293 } // namespace |
2294 } // namespace cc | 2294 } // namespace cc |
OLD | NEW |