Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(197)

Side by Side Diff: cc/layers/video_layer_impl_unittest.cc

Issue 1125303005: cc: VideoLayerImpl VideoFrame::TEXTURE_YUV_420 support. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« cc/layers/video_layer_impl.cc ('K') | « cc/layers/video_layer_impl.cc ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 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/layers/video_layer_impl.h" 5 #include "cc/layers/video_layer_impl.h"
6 6
7 #include "cc/layers/video_frame_provider_client_impl.h" 7 #include "cc/layers/video_frame_provider_client_impl.h"
8 #include "cc/output/context_provider.h" 8 #include "cc/output/context_provider.h"
9 #include "cc/output/output_surface.h" 9 #include "cc/output/output_surface.h"
10 #include "cc/quads/draw_quad.h" 10 #include "cc/quads/draw_quad.h"
(...skipping 227 matching lines...) Expand 10 before | Expand all | Expand 10 after
238 EXPECT_EQ(1u, impl.quad_list().size()); 238 EXPECT_EQ(1u, impl.quad_list().size());
239 239
240 gfx::Point3F p1(0, impl.quad_list().front()->rect.height(), 0); 240 gfx::Point3F p1(0, impl.quad_list().front()->rect.height(), 0);
241 gfx::Point3F p2(impl.quad_list().front()->rect.width(), 0, 0); 241 gfx::Point3F p2(impl.quad_list().front()->rect.width(), 0, 0);
242 impl.quad_list().front()->quadTransform().TransformPoint(&p1); 242 impl.quad_list().front()->quadTransform().TransformPoint(&p1);
243 impl.quad_list().front()->quadTransform().TransformPoint(&p2); 243 impl.quad_list().front()->quadTransform().TransformPoint(&p2);
244 EXPECT_EQ(gfx::Point3F(100, 50, 0), p1); 244 EXPECT_EQ(gfx::Point3F(100, 50, 0), p1);
245 EXPECT_EQ(gfx::Point3F(0, 0, 0), p2); 245 EXPECT_EQ(gfx::Point3F(0, 0, 0), p2);
246 } 246 }
247 247
248 void EmptyCallback(unsigned sync_point) {
249 }
250 TEST(VideoLayerImplTest, NativeYUVFrameGeneratesYUVQuad) {
251 gfx::Size layer_size(1000, 1000);
252 gfx::Size viewport_size(1000, 1000);
253
254 LayerTestCommon::LayerImplTest impl;
255 DebugSetImplThreadAndMainThreadBlocked(impl.proxy());
256
257 gpu::MailboxHolder mailbox_holder;
258 mailbox_holder.mailbox.name[0] = 1;
259
260 scoped_refptr<media::VideoFrame> video_frame =
261 media::VideoFrame::WrapYUV420NativeTextures(
262 mailbox_holder, mailbox_holder, mailbox_holder,
263 base::Bind(EmptyCallback), gfx::Size(10, 10), gfx::Rect(10, 10),
264 gfx::Size(10, 10), base::TimeDelta(), true);
265 FakeVideoFrameProvider provider;
266 provider.set_frame(video_frame);
267
268 VideoLayerImpl* video_layer_impl =
269 impl.AddChildToRoot<VideoLayerImpl>(&provider, media::VIDEO_ROTATION_0);
270 video_layer_impl->SetBounds(layer_size);
271 video_layer_impl->SetContentBounds(layer_size);
272 video_layer_impl->SetDrawsContent(true);
273
274 gfx::Rect occluded;
275 impl.AppendQuadsWithOcclusion(video_layer_impl, occluded);
276
277 EXPECT_EQ(1u, impl.quad_list().size());
278 const DrawQuad* draw_quad = impl.quad_list().ElementAt(0);
279 EXPECT_EQ(DrawQuad::YUV_VIDEO_CONTENT, draw_quad->material);
280 }
hendrikw 2015/05/14 22:11:19 Should we also check that uv*2==ya here?
Daniele Castagna 2015/05/14 22:23:03 Sure, we have to downcast though, are you ok with
281
248 } // namespace 282 } // namespace
249 } // namespace cc 283 } // namespace cc
OLDNEW
« cc/layers/video_layer_impl.cc ('K') | « cc/layers/video_layer_impl.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698