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
3 // found in the LICENSE file.
5 #include "cc/yuv_video_draw_quad.h"
7 #include "base/logging.h"
11 YUVVideoDrawQuad::YUVVideoDrawQuad() {}
12 YUVVideoDrawQuad::~YUVVideoDrawQuad() {}
14 scoped_ptr
<YUVVideoDrawQuad
> YUVVideoDrawQuad::Create() {
15 return make_scoped_ptr(new YUVVideoDrawQuad
);
18 void YUVVideoDrawQuad::SetNew(const SharedQuadState
* shared_quad_state
,
20 gfx::Rect opaque_rect
,
22 const VideoLayerImpl::FramePlane
& y_plane
,
23 const VideoLayerImpl::FramePlane
& u_plane
,
24 const VideoLayerImpl::FramePlane
& v_plane
) {
25 gfx::Rect visible_rect
= rect
;
26 bool needs_blending
= false;
27 DrawQuad::SetAll(shared_quad_state
, DrawQuad::YUV_VIDEO_CONTENT
, rect
,
28 opaque_rect
, visible_rect
, needs_blending
);
29 this->tex_scale
= tex_scale
;
30 this->y_plane
= y_plane
;
31 this->u_plane
= u_plane
;
32 this->v_plane
= v_plane
;
35 void YUVVideoDrawQuad::SetAll(const SharedQuadState
* shared_quad_state
,
37 gfx::Rect opaque_rect
,
38 gfx::Rect visible_rect
,
41 const VideoLayerImpl::FramePlane
& y_plane
,
42 const VideoLayerImpl::FramePlane
& u_plane
,
43 const VideoLayerImpl::FramePlane
& v_plane
) {
44 DrawQuad::SetAll(shared_quad_state
, DrawQuad::YUV_VIDEO_CONTENT
, rect
,
45 opaque_rect
, visible_rect
, needs_blending
);
46 this->tex_scale
= tex_scale
;
47 this->y_plane
= y_plane
;
48 this->u_plane
= u_plane
;
49 this->v_plane
= v_plane
;
52 const YUVVideoDrawQuad
* YUVVideoDrawQuad::MaterialCast(
53 const DrawQuad
* quad
) {
54 DCHECK(quad
->material
== DrawQuad::YUV_VIDEO_CONTENT
);
55 return static_cast<const YUVVideoDrawQuad
*>(quad
);