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 "cc/quads/yuv_video_draw_quad.h" | 5 #include "cc/quads/yuv_video_draw_quad.h" |
| 6 | 6 |
| 7 #include "base/logging.h" | 7 #include "base/logging.h" |
| 8 | 8 |
| 9 namespace cc { | 9 namespace cc { |
| 10 | 10 |
| 11 YUVVideoDrawQuad::YUVVideoDrawQuad() {} | 11 YUVVideoDrawQuad::YUVVideoDrawQuad() {} |
| 12 YUVVideoDrawQuad::~YUVVideoDrawQuad() {} | 12 YUVVideoDrawQuad::~YUVVideoDrawQuad() {} |
| 13 | 13 |
| 14 scoped_ptr<YUVVideoDrawQuad> YUVVideoDrawQuad::Create() { | 14 scoped_ptr<YUVVideoDrawQuad> YUVVideoDrawQuad::Create() { |
| 15 return make_scoped_ptr(new YUVVideoDrawQuad); | 15 return make_scoped_ptr(new YUVVideoDrawQuad); |
| 16 } | 16 } |
| 17 | 17 |
| 18 void YUVVideoDrawQuad::SetNew(const SharedQuadState* shared_quad_state, | 18 void YUVVideoDrawQuad::SetNew(const SharedQuadState* shared_quad_state, |
| 19 gfx::Rect rect, | 19 gfx::Rect rect, |
| 20 gfx::Rect opaque_rect, | 20 gfx::Rect opaque_rect, |
| 21 gfx::SizeF tex_scale, | 21 gfx::SizeF tex_scale, |
| 22 const VideoLayerImpl::FramePlane& y_plane, | 22 const VideoLayerImpl::FramePlane* y_plane, |
| 23 const VideoLayerImpl::FramePlane& u_plane, | 23 const VideoLayerImpl::FramePlane* u_plane, |
| 24 const VideoLayerImpl::FramePlane& v_plane) { | 24 const VideoLayerImpl::FramePlane* v_plane, |
| 25 const VideoLayerImpl::FramePlane* a_plane) { | |
| 25 gfx::Rect visible_rect = rect; | 26 gfx::Rect visible_rect = rect; |
| 26 bool needs_blending = false; | 27 bool needs_blending = true; |
|
danakj
2013/04/04 22:18:45
This is true only if there's an a_plane present, r
vignesh
2013/04/05 22:00:29
Right. Sorry, my bad.
Done.
| |
| 27 DrawQuad::SetAll(shared_quad_state, DrawQuad::YUV_VIDEO_CONTENT, rect, | 28 SetAll(shared_quad_state, rect, opaque_rect, visible_rect, needs_blending, |
| 28 opaque_rect, visible_rect, needs_blending); | 29 tex_scale, y_plane, u_plane, v_plane, a_plane); |
| 29 this->tex_scale = tex_scale; | |
| 30 this->y_plane = y_plane; | |
| 31 this->u_plane = u_plane; | |
| 32 this->v_plane = v_plane; | |
| 33 } | 30 } |
| 34 | 31 |
| 35 void YUVVideoDrawQuad::SetAll(const SharedQuadState* shared_quad_state, | 32 void YUVVideoDrawQuad::SetAll(const SharedQuadState* shared_quad_state, |
| 36 gfx::Rect rect, | 33 gfx::Rect rect, |
| 37 gfx::Rect opaque_rect, | 34 gfx::Rect opaque_rect, |
| 38 gfx::Rect visible_rect, | 35 gfx::Rect visible_rect, |
| 39 bool needs_blending, | 36 bool needs_blending, |
| 40 gfx::SizeF tex_scale, | 37 gfx::SizeF tex_scale, |
| 41 const VideoLayerImpl::FramePlane& y_plane, | 38 const VideoLayerImpl::FramePlane* y_plane, |
| 42 const VideoLayerImpl::FramePlane& u_plane, | 39 const VideoLayerImpl::FramePlane* u_plane, |
| 43 const VideoLayerImpl::FramePlane& v_plane) { | 40 const VideoLayerImpl::FramePlane* v_plane, |
| 41 const VideoLayerImpl::FramePlane* a_plane) { | |
| 44 DrawQuad::SetAll(shared_quad_state, DrawQuad::YUV_VIDEO_CONTENT, rect, | 42 DrawQuad::SetAll(shared_quad_state, DrawQuad::YUV_VIDEO_CONTENT, rect, |
| 45 opaque_rect, visible_rect, needs_blending); | 43 opaque_rect, visible_rect, needs_blending); |
| 46 this->tex_scale = tex_scale; | 44 this->tex_scale = tex_scale; |
| 47 this->y_plane = y_plane; | 45 this->y_plane = *y_plane; |
| 48 this->u_plane = u_plane; | 46 this->u_plane = *u_plane; |
| 49 this->v_plane = v_plane; | 47 this->v_plane = *v_plane; |
| 48 if (a_plane) | |
| 49 this->a_plane = *a_plane; | |
| 50 } | 50 } |
| 51 | 51 |
| 52 void YUVVideoDrawQuad::IterateResources( | 52 void YUVVideoDrawQuad::IterateResources( |
| 53 const ResourceIteratorCallback& callback) { | 53 const ResourceIteratorCallback& callback) { |
| 54 y_plane.resource_id = callback.Run(y_plane.resource_id); | 54 y_plane.resource_id = callback.Run(y_plane.resource_id); |
| 55 u_plane.resource_id = callback.Run(u_plane.resource_id); | 55 u_plane.resource_id = callback.Run(u_plane.resource_id); |
| 56 v_plane.resource_id = callback.Run(v_plane.resource_id); | 56 v_plane.resource_id = callback.Run(v_plane.resource_id); |
| 57 if(a_plane.resource_id) | |
|
danakj
2013/04/04 22:18:45
nit: space before (
vignesh
2013/04/05 22:00:29
Done.
| |
| 58 a_plane.resource_id = callback.Run(a_plane.resource_id); | |
| 57 } | 59 } |
| 58 | 60 |
| 59 const YUVVideoDrawQuad* YUVVideoDrawQuad::MaterialCast( | 61 const YUVVideoDrawQuad* YUVVideoDrawQuad::MaterialCast( |
| 60 const DrawQuad* quad) { | 62 const DrawQuad* quad) { |
| 61 DCHECK(quad->material == DrawQuad::YUV_VIDEO_CONTENT); | 63 DCHECK(quad->material == DrawQuad::YUV_VIDEO_CONTENT); |
| 62 return static_cast<const YUVVideoDrawQuad*>(quad); | 64 return static_cast<const YUVVideoDrawQuad*>(quad); |
| 63 } | 65 } |
| 64 | 66 |
| 65 } // namespace cc | 67 } // namespace cc |
| OLD | NEW |