Chromium Code Reviews| 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 const gfx::Size ya_tex_size = video_frame->coded_size(); | |
| 251 const gfx::Size uv_tex_size = media::VideoFrame::PlaneSize( | |
| 252 video_frame->format(), media::VideoFrame::kUPlane, | |
| 253 video_frame->coded_size()); | |
| 254 DCHECK(uv_tex_size == media::VideoFrame::PlaneSize( | |
| 255 video_frame->format(), media::VideoFrame::kVPlane, | |
| 256 video_frame->coded_size())); | |
| 257 if (with_alpha) { | |
| 258 DCHECK(ya_tex_size == media::VideoFrame::PlaneSize( | |
|
enne (OOO)
2015/03/18 19:25:57
DCHECK_EQ
| |
| 259 video_frame->format(), media::VideoFrame::kAPlane, | |
| 260 video_frame->coded_size())); | |
| 261 } | |
| 262 | |
| 250 YUVVideoDrawQuad* yuv_quad = | 263 YUVVideoDrawQuad* yuv_quad = |
| 251 render_pass->CreateAndAppendDrawQuad<YUVVideoDrawQuad>(); | 264 render_pass->CreateAndAppendDrawQuad<YUVVideoDrawQuad>(); |
| 252 yuv_quad->SetNew(shared_state, rect, opaque_rect, rect, tex_coord_rect, | 265 yuv_quad->SetNew(shared_state, rect, opaque_rect, rect, tex_coord_rect, |
| 253 video_frame->coded_size(), y_resource, u_resource, | 266 ya_tex_size, uv_tex_size, y_resource, u_resource, v_resource, |
| 254 v_resource, a_resource, color_space); | 267 a_resource, color_space); |
| 255 } | 268 } |
| 256 | 269 |
| 257 void CreateTestYUVVideoDrawQuad_Striped( | 270 void CreateTestYUVVideoDrawQuad_Striped( |
| 258 const SharedQuadState* shared_state, | 271 const SharedQuadState* shared_state, |
| 259 media::VideoFrame::Format format, | 272 media::VideoFrame::Format format, |
| 260 bool is_transparent, | 273 bool is_transparent, |
| 261 const gfx::RectF& tex_coord_rect, | 274 const gfx::RectF& tex_coord_rect, |
| 262 RenderPass* render_pass, | 275 RenderPass* render_pass, |
| 263 VideoResourceUpdater* video_resource_updater, | 276 VideoResourceUpdater* video_resource_updater, |
| 264 const gfx::Rect& rect, | 277 const gfx::Rect& rect, |
| (...skipping 661 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 926 static_cast<float>(green_rect.y()) / background_size.height(), | 939 static_cast<float>(green_rect.y()) / background_size.height(), |
| 927 static_cast<float>(green_rect.width()) / background_size.width(), | 940 static_cast<float>(green_rect.width()) / background_size.width(), |
| 928 static_cast<float>(green_rect.height()) / background_size.height()); | 941 static_cast<float>(green_rect.height()) / background_size.height()); |
| 929 | 942 |
| 930 // YUV of (149,43,21) should be green (0,255,0) in RGB. | 943 // YUV of (149,43,21) should be green (0,255,0) in RGB. |
| 931 // Create a video frame that has a non-green background rect, with a | 944 // Create a video frame that has a non-green background rect, with a |
| 932 // green sub-rectangle that should be the only thing displayed in | 945 // green sub-rectangle that should be the only thing displayed in |
| 933 // the final image. Bleeding will appear on all four sides of the video | 946 // the final image. Bleeding will appear on all four sides of the video |
| 934 // if the tex coords are not clamped. | 947 // if the tex coords are not clamped. |
| 935 CreateTestYUVVideoDrawQuad_TwoColor( | 948 CreateTestYUVVideoDrawQuad_TwoColor( |
| 936 shared_state, format, false, tex_coord_rect, background_size, 0, 0, 0, | 949 shared_state, format, false, tex_coord_rect, background_size, 128, 128, |
| 937 green_rect, 149, 43, 21, pass.get(), video_resource_updater_.get(), | 950 128, green_rect, 149, 43, 21, pass.get(), video_resource_updater_.get(), |
| 938 resource_provider_.get()); | 951 resource_provider_.get()); |
| 939 pass_list->push_back(pass.Pass()); | 952 pass_list->push_back(pass.Pass()); |
| 940 } | 953 } |
| 941 | 954 |
| 942 void SetUp() override { | 955 void SetUp() override { |
| 943 GLRendererPixelTest::SetUp(); | 956 GLRendererPixelTest::SetUp(); |
| 944 video_resource_updater_.reset(new VideoResourceUpdater( | 957 video_resource_updater_.reset(new VideoResourceUpdater( |
| 945 output_surface_->context_provider(), resource_provider_.get())); | 958 output_surface_->context_provider(), resource_provider_.get())); |
| 946 } | 959 } |
| 947 | 960 |
| (...skipping 1949 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 2897 ? FILE_PATH_LITERAL("four_blue_green_checkers.png") | 2910 ? FILE_PATH_LITERAL("four_blue_green_checkers.png") |
| 2898 : FILE_PATH_LITERAL("checkers_big.png"); | 2911 : FILE_PATH_LITERAL("checkers_big.png"); |
| 2899 EXPECT_TRUE(this->RunPixelTest(&pass_list, base::FilePath(path), | 2912 EXPECT_TRUE(this->RunPixelTest(&pass_list, base::FilePath(path), |
| 2900 ExactPixelComparator(true))); | 2913 ExactPixelComparator(true))); |
| 2901 } | 2914 } |
| 2902 | 2915 |
| 2903 #endif // !defined(OS_ANDROID) | 2916 #endif // !defined(OS_ANDROID) |
| 2904 | 2917 |
| 2905 } // namespace | 2918 } // namespace |
| 2906 } // namespace cc | 2919 } // namespace cc |
| OLD | NEW |