| 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 "base/message_loop/message_loop.h" | 5 #include "base/message_loop/message_loop.h" |
| 6 #include "cc/layers/append_quads_data.h" | 6 #include "cc/layers/append_quads_data.h" |
| 7 #include "cc/output/gl_renderer.h" | 7 #include "cc/output/gl_renderer.h" |
| 8 #include "cc/quads/draw_quad.h" | 8 #include "cc/quads/draw_quad.h" |
| 9 #include "cc/quads/picture_draw_quad.h" | 9 #include "cc/quads/picture_draw_quad.h" |
| 10 #include "cc/quads/texture_draw_quad.h" | 10 #include "cc/quads/texture_draw_quad.h" |
| (...skipping 229 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 240 SingleReleaseCallbackImpl::Create( | 240 SingleReleaseCallbackImpl::Create( |
| 241 resources.release_callbacks[media::VideoFrame::kVPlane])); | 241 resources.release_callbacks[media::VideoFrame::kVPlane])); |
| 242 ResourceProvider::ResourceId a_resource = 0; | 242 ResourceProvider::ResourceId a_resource = 0; |
| 243 if (with_alpha) { | 243 if (with_alpha) { |
| 244 a_resource = resource_provider->CreateResourceFromTextureMailbox( | 244 a_resource = resource_provider->CreateResourceFromTextureMailbox( |
| 245 resources.mailboxes[media::VideoFrame::kAPlane], | 245 resources.mailboxes[media::VideoFrame::kAPlane], |
| 246 SingleReleaseCallbackImpl::Create( | 246 SingleReleaseCallbackImpl::Create( |
| 247 resources.release_callbacks[media::VideoFrame::kAPlane])); | 247 resources.release_callbacks[media::VideoFrame::kAPlane])); |
| 248 } | 248 } |
| 249 | 249 |
| 250 gfx::Size min_tex_size = video_frame->coded_size(); | |
| 251 for (size_t plane = 0; | |
| 252 plane < media::VideoFrame::NumPlanes(video_frame->format()); ++plane) { | |
| 253 min_tex_size.SetToMin(media::VideoFrame::PlaneSize( | |
| 254 video_frame->format(), plane, video_frame->coded_size())); | |
| 255 } | |
| 256 | |
| 257 YUVVideoDrawQuad* yuv_quad = | 250 YUVVideoDrawQuad* yuv_quad = |
| 258 render_pass->CreateAndAppendDrawQuad<YUVVideoDrawQuad>(); | 251 render_pass->CreateAndAppendDrawQuad<YUVVideoDrawQuad>(); |
| 259 yuv_quad->SetNew(shared_state, rect, opaque_rect, rect, tex_coord_rect, | 252 yuv_quad->SetNew(shared_state, rect, opaque_rect, rect, tex_coord_rect, |
| 260 min_tex_size, y_resource, u_resource, v_resource, a_resource, | 253 video_frame->coded_size(), y_resource, u_resource, |
| 261 color_space); | 254 v_resource, a_resource, color_space); |
| 262 } | 255 } |
| 263 | 256 |
| 264 void CreateTestYUVVideoDrawQuad_Striped( | 257 void CreateTestYUVVideoDrawQuad_Striped( |
| 265 const SharedQuadState* shared_state, | 258 const SharedQuadState* shared_state, |
| 266 media::VideoFrame::Format format, | 259 media::VideoFrame::Format format, |
| 267 bool is_transparent, | 260 bool is_transparent, |
| 268 const gfx::RectF& tex_coord_rect, | 261 const gfx::RectF& tex_coord_rect, |
| 269 RenderPass* render_pass, | 262 RenderPass* render_pass, |
| 270 VideoResourceUpdater* video_resource_updater, | 263 VideoResourceUpdater* video_resource_updater, |
| 271 const gfx::Rect& rect, | 264 const gfx::Rect& rect, |
| (...skipping 661 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 933 static_cast<float>(green_rect.y()) / background_size.height(), | 926 static_cast<float>(green_rect.y()) / background_size.height(), |
| 934 static_cast<float>(green_rect.width()) / background_size.width(), | 927 static_cast<float>(green_rect.width()) / background_size.width(), |
| 935 static_cast<float>(green_rect.height()) / background_size.height()); | 928 static_cast<float>(green_rect.height()) / background_size.height()); |
| 936 | 929 |
| 937 // YUV of (149,43,21) should be green (0,255,0) in RGB. | 930 // YUV of (149,43,21) should be green (0,255,0) in RGB. |
| 938 // Create a video frame that has a non-green background rect, with a | 931 // Create a video frame that has a non-green background rect, with a |
| 939 // green sub-rectangle that should be the only thing displayed in | 932 // green sub-rectangle that should be the only thing displayed in |
| 940 // the final image. Bleeding will appear on all four sides of the video | 933 // the final image. Bleeding will appear on all four sides of the video |
| 941 // if the tex coords are not clamped. | 934 // if the tex coords are not clamped. |
| 942 CreateTestYUVVideoDrawQuad_TwoColor( | 935 CreateTestYUVVideoDrawQuad_TwoColor( |
| 943 shared_state, format, false, tex_coord_rect, background_size, 128, 128, | 936 shared_state, format, false, tex_coord_rect, background_size, 0, 0, 0, |
| 944 128, green_rect, 149, 43, 21, pass.get(), video_resource_updater_.get(), | 937 green_rect, 149, 43, 21, pass.get(), video_resource_updater_.get(), |
| 945 resource_provider_.get()); | 938 resource_provider_.get()); |
| 946 pass_list->push_back(pass.Pass()); | 939 pass_list->push_back(pass.Pass()); |
| 947 } | 940 } |
| 948 | 941 |
| 949 void SetUp() override { | 942 void SetUp() override { |
| 950 GLRendererPixelTest::SetUp(); | 943 GLRendererPixelTest::SetUp(); |
| 951 video_resource_updater_.reset(new VideoResourceUpdater( | 944 video_resource_updater_.reset(new VideoResourceUpdater( |
| 952 output_surface_->context_provider(), resource_provider_.get())); | 945 output_surface_->context_provider(), resource_provider_.get())); |
| 953 } | 946 } |
| 954 | 947 |
| (...skipping 1949 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2904 ? FILE_PATH_LITERAL("four_blue_green_checkers.png") | 2897 ? FILE_PATH_LITERAL("four_blue_green_checkers.png") |
| 2905 : FILE_PATH_LITERAL("checkers_big.png"); | 2898 : FILE_PATH_LITERAL("checkers_big.png"); |
| 2906 EXPECT_TRUE(this->RunPixelTest(&pass_list, base::FilePath(path), | 2899 EXPECT_TRUE(this->RunPixelTest(&pass_list, base::FilePath(path), |
| 2907 ExactPixelComparator(true))); | 2900 ExactPixelComparator(true))); |
| 2908 } | 2901 } |
| 2909 | 2902 |
| 2910 #endif // !defined(OS_ANDROID) | 2903 #endif // !defined(OS_ANDROID) |
| 2911 | 2904 |
| 2912 } // namespace | 2905 } // namespace |
| 2913 } // namespace cc | 2906 } // namespace cc |
| OLD | NEW |