| 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 : y_plane_resource_id(0), |
| 13 u_plane_resource_id(0), |
| 14 v_plane_resource_id(0) {} |
| 12 YUVVideoDrawQuad::~YUVVideoDrawQuad() {} | 15 YUVVideoDrawQuad::~YUVVideoDrawQuad() {} |
| 13 | 16 |
| 14 scoped_ptr<YUVVideoDrawQuad> YUVVideoDrawQuad::Create() { | 17 scoped_ptr<YUVVideoDrawQuad> YUVVideoDrawQuad::Create() { |
| 15 return make_scoped_ptr(new YUVVideoDrawQuad); | 18 return make_scoped_ptr(new YUVVideoDrawQuad); |
| 16 } | 19 } |
| 17 | 20 |
| 18 void YUVVideoDrawQuad::SetNew(const SharedQuadState* shared_quad_state, | 21 void YUVVideoDrawQuad::SetNew(const SharedQuadState* shared_quad_state, |
| 19 gfx::Rect rect, | 22 gfx::Rect rect, |
| 20 gfx::Rect opaque_rect, | 23 gfx::Rect opaque_rect, |
| 21 gfx::SizeF tex_scale, | 24 gfx::SizeF tex_scale, |
| 22 const VideoLayerImpl::FramePlane& y_plane, | 25 unsigned y_plane_resource_id, |
| 23 const VideoLayerImpl::FramePlane& u_plane, | 26 unsigned u_plane_resource_id, |
| 24 const VideoLayerImpl::FramePlane& v_plane) { | 27 unsigned v_plane_resource_id) { |
| 25 gfx::Rect visible_rect = rect; | 28 gfx::Rect visible_rect = rect; |
| 26 bool needs_blending = false; | 29 bool needs_blending = false; |
| 27 DrawQuad::SetAll(shared_quad_state, DrawQuad::YUV_VIDEO_CONTENT, rect, | 30 DrawQuad::SetAll(shared_quad_state, DrawQuad::YUV_VIDEO_CONTENT, rect, |
| 28 opaque_rect, visible_rect, needs_blending); | 31 opaque_rect, visible_rect, needs_blending); |
| 29 this->tex_scale = tex_scale; | 32 this->tex_scale = tex_scale; |
| 30 this->y_plane = y_plane; | 33 this->y_plane_resource_id = y_plane_resource_id; |
| 31 this->u_plane = u_plane; | 34 this->u_plane_resource_id = u_plane_resource_id; |
| 32 this->v_plane = v_plane; | 35 this->v_plane_resource_id = v_plane_resource_id; |
| 33 } | 36 } |
| 34 | 37 |
| 35 void YUVVideoDrawQuad::SetAll(const SharedQuadState* shared_quad_state, | 38 void YUVVideoDrawQuad::SetAll(const SharedQuadState* shared_quad_state, |
| 36 gfx::Rect rect, | 39 gfx::Rect rect, |
| 37 gfx::Rect opaque_rect, | 40 gfx::Rect opaque_rect, |
| 38 gfx::Rect visible_rect, | 41 gfx::Rect visible_rect, |
| 39 bool needs_blending, | 42 bool needs_blending, |
| 40 gfx::SizeF tex_scale, | 43 gfx::SizeF tex_scale, |
| 41 const VideoLayerImpl::FramePlane& y_plane, | 44 unsigned y_plane_resource_id, |
| 42 const VideoLayerImpl::FramePlane& u_plane, | 45 unsigned u_plane_resource_id, |
| 43 const VideoLayerImpl::FramePlane& v_plane) { | 46 unsigned v_plane_resource_id) { |
| 44 DrawQuad::SetAll(shared_quad_state, DrawQuad::YUV_VIDEO_CONTENT, rect, | 47 DrawQuad::SetAll(shared_quad_state, DrawQuad::YUV_VIDEO_CONTENT, rect, |
| 45 opaque_rect, visible_rect, needs_blending); | 48 opaque_rect, visible_rect, needs_blending); |
| 46 this->tex_scale = tex_scale; | 49 this->tex_scale = tex_scale; |
| 47 this->y_plane = y_plane; | 50 this->y_plane_resource_id = y_plane_resource_id; |
| 48 this->u_plane = u_plane; | 51 this->u_plane_resource_id = u_plane_resource_id; |
| 49 this->v_plane = v_plane; | 52 this->v_plane_resource_id = v_plane_resource_id; |
| 50 } | 53 } |
| 51 | 54 |
| 52 void YUVVideoDrawQuad::IterateResources( | 55 void YUVVideoDrawQuad::IterateResources( |
| 53 const ResourceIteratorCallback& callback) { | 56 const ResourceIteratorCallback& callback) { |
| 54 y_plane.resource_id = callback.Run(y_plane.resource_id); | 57 y_plane_resource_id = callback.Run(y_plane_resource_id); |
| 55 u_plane.resource_id = callback.Run(u_plane.resource_id); | 58 u_plane_resource_id = callback.Run(u_plane_resource_id); |
| 56 v_plane.resource_id = callback.Run(v_plane.resource_id); | 59 v_plane_resource_id = callback.Run(v_plane_resource_id); |
| 57 } | 60 } |
| 58 | 61 |
| 59 const YUVVideoDrawQuad* YUVVideoDrawQuad::MaterialCast( | 62 const YUVVideoDrawQuad* YUVVideoDrawQuad::MaterialCast( |
| 60 const DrawQuad* quad) { | 63 const DrawQuad* quad) { |
| 61 DCHECK(quad->material == DrawQuad::YUV_VIDEO_CONTENT); | 64 DCHECK(quad->material == DrawQuad::YUV_VIDEO_CONTENT); |
| 62 return static_cast<const YUVVideoDrawQuad*>(quad); | 65 return static_cast<const YUVVideoDrawQuad*>(quad); |
| 63 } | 66 } |
| 64 | 67 |
| 65 } // namespace cc | 68 } // namespace cc |
| OLD | NEW |