| 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 #include "base/trace_event/trace_event_argument.h" | 8 #include "base/trace_event/trace_event_argument.h" |
| 9 #include "base/values.h" | 9 #include "base/values.h" |
| 10 #include "cc/base/math_util.h" | 10 #include "cc/base/math_util.h" |
| 11 | 11 |
| 12 namespace cc { | 12 namespace cc { |
| 13 | 13 |
| 14 YUVVideoDrawQuad::YUVVideoDrawQuad() | 14 YUVVideoDrawQuad::YUVVideoDrawQuad() |
| 15 : y_plane_resource_id(0), | 15 : y_plane_resource_id(0), |
| 16 u_plane_resource_id(0), | 16 u_plane_resource_id(0), |
| 17 v_plane_resource_id(0), | 17 v_plane_resource_id(0), |
| 18 a_plane_resource_id(0) {} | 18 a_plane_resource_id(0) {} |
| 19 YUVVideoDrawQuad::~YUVVideoDrawQuad() {} | 19 YUVVideoDrawQuad::~YUVVideoDrawQuad() {} |
| 20 | 20 |
| 21 void YUVVideoDrawQuad::SetNew(const SharedQuadState* shared_quad_state, | 21 void YUVVideoDrawQuad::SetNew(const SharedQuadState* shared_quad_state, |
| 22 const gfx::Rect& rect, | 22 const gfx::Rect& rect, |
| 23 const gfx::Rect& opaque_rect, | 23 const gfx::Rect& opaque_rect, |
| 24 const gfx::Rect& visible_rect, | 24 const gfx::Rect& visible_rect, |
| 25 const gfx::RectF& tex_coord_rect, | 25 const gfx::RectF& tex_coord_rect, |
| 26 const gfx::Size& tex_size, |
| 26 unsigned y_plane_resource_id, | 27 unsigned y_plane_resource_id, |
| 27 unsigned u_plane_resource_id, | 28 unsigned u_plane_resource_id, |
| 28 unsigned v_plane_resource_id, | 29 unsigned v_plane_resource_id, |
| 29 unsigned a_plane_resource_id, | 30 unsigned a_plane_resource_id, |
| 30 ColorSpace color_space) { | 31 ColorSpace color_space) { |
| 31 bool needs_blending = false; | 32 bool needs_blending = false; |
| 32 DrawQuad::SetAll(shared_quad_state, DrawQuad::YUV_VIDEO_CONTENT, rect, | 33 DrawQuad::SetAll(shared_quad_state, DrawQuad::YUV_VIDEO_CONTENT, rect, |
| 33 opaque_rect, visible_rect, needs_blending); | 34 opaque_rect, visible_rect, needs_blending); |
| 34 this->tex_coord_rect = tex_coord_rect; | 35 this->tex_coord_rect = tex_coord_rect; |
| 36 this->tex_size = tex_size; |
| 35 this->y_plane_resource_id = y_plane_resource_id; | 37 this->y_plane_resource_id = y_plane_resource_id; |
| 36 this->u_plane_resource_id = u_plane_resource_id; | 38 this->u_plane_resource_id = u_plane_resource_id; |
| 37 this->v_plane_resource_id = v_plane_resource_id; | 39 this->v_plane_resource_id = v_plane_resource_id; |
| 38 this->a_plane_resource_id = a_plane_resource_id; | 40 this->a_plane_resource_id = a_plane_resource_id; |
| 39 this->color_space = color_space; | 41 this->color_space = color_space; |
| 40 } | 42 } |
| 41 | 43 |
| 42 void YUVVideoDrawQuad::SetAll(const SharedQuadState* shared_quad_state, | 44 void YUVVideoDrawQuad::SetAll(const SharedQuadState* shared_quad_state, |
| 43 const gfx::Rect& rect, | 45 const gfx::Rect& rect, |
| 44 const gfx::Rect& opaque_rect, | 46 const gfx::Rect& opaque_rect, |
| 45 const gfx::Rect& visible_rect, | 47 const gfx::Rect& visible_rect, |
| 46 bool needs_blending, | 48 bool needs_blending, |
| 47 const gfx::RectF& tex_coord_rect, | 49 const gfx::RectF& tex_coord_rect, |
| 50 const gfx::Size& tex_size, |
| 48 unsigned y_plane_resource_id, | 51 unsigned y_plane_resource_id, |
| 49 unsigned u_plane_resource_id, | 52 unsigned u_plane_resource_id, |
| 50 unsigned v_plane_resource_id, | 53 unsigned v_plane_resource_id, |
| 51 unsigned a_plane_resource_id, | 54 unsigned a_plane_resource_id, |
| 52 ColorSpace color_space) { | 55 ColorSpace color_space) { |
| 53 DrawQuad::SetAll(shared_quad_state, DrawQuad::YUV_VIDEO_CONTENT, rect, | 56 DrawQuad::SetAll(shared_quad_state, DrawQuad::YUV_VIDEO_CONTENT, rect, |
| 54 opaque_rect, visible_rect, needs_blending); | 57 opaque_rect, visible_rect, needs_blending); |
| 55 this->tex_coord_rect = tex_coord_rect; | 58 this->tex_coord_rect = tex_coord_rect; |
| 59 this->tex_size = tex_size; |
| 56 this->y_plane_resource_id = y_plane_resource_id; | 60 this->y_plane_resource_id = y_plane_resource_id; |
| 57 this->u_plane_resource_id = u_plane_resource_id; | 61 this->u_plane_resource_id = u_plane_resource_id; |
| 58 this->v_plane_resource_id = v_plane_resource_id; | 62 this->v_plane_resource_id = v_plane_resource_id; |
| 59 this->a_plane_resource_id = a_plane_resource_id; | 63 this->a_plane_resource_id = a_plane_resource_id; |
| 60 this->color_space = color_space; | 64 this->color_space = color_space; |
| 61 } | 65 } |
| 62 | 66 |
| 63 void YUVVideoDrawQuad::IterateResources( | 67 void YUVVideoDrawQuad::IterateResources( |
| 64 const ResourceIteratorCallback& callback) { | 68 const ResourceIteratorCallback& callback) { |
| 65 y_plane_resource_id = callback.Run(y_plane_resource_id); | 69 y_plane_resource_id = callback.Run(y_plane_resource_id); |
| 66 u_plane_resource_id = callback.Run(u_plane_resource_id); | 70 u_plane_resource_id = callback.Run(u_plane_resource_id); |
| 67 v_plane_resource_id = callback.Run(v_plane_resource_id); | 71 v_plane_resource_id = callback.Run(v_plane_resource_id); |
| 68 if (a_plane_resource_id) | 72 if (a_plane_resource_id) |
| 69 a_plane_resource_id = callback.Run(a_plane_resource_id); | 73 a_plane_resource_id = callback.Run(a_plane_resource_id); |
| 70 } | 74 } |
| 71 | 75 |
| 72 const YUVVideoDrawQuad* YUVVideoDrawQuad::MaterialCast( | 76 const YUVVideoDrawQuad* YUVVideoDrawQuad::MaterialCast( |
| 73 const DrawQuad* quad) { | 77 const DrawQuad* quad) { |
| 74 DCHECK(quad->material == DrawQuad::YUV_VIDEO_CONTENT); | 78 DCHECK(quad->material == DrawQuad::YUV_VIDEO_CONTENT); |
| 75 return static_cast<const YUVVideoDrawQuad*>(quad); | 79 return static_cast<const YUVVideoDrawQuad*>(quad); |
| 76 } | 80 } |
| 77 | 81 |
| 78 void YUVVideoDrawQuad::ExtendValue(base::debug::TracedValue* value) const { | 82 void YUVVideoDrawQuad::ExtendValue(base::debug::TracedValue* value) const { |
| 79 MathUtil::AddToTracedValue("tex_coord_rect", tex_coord_rect, value); | 83 MathUtil::AddToTracedValue("tex_coord_rect", tex_coord_rect, value); |
| 84 MathUtil::AddToTracedValue("tex_size", tex_size, value); |
| 80 value->SetInteger("y_plane_resource_id", y_plane_resource_id); | 85 value->SetInteger("y_plane_resource_id", y_plane_resource_id); |
| 81 value->SetInteger("u_plane_resource_id", u_plane_resource_id); | 86 value->SetInteger("u_plane_resource_id", u_plane_resource_id); |
| 82 value->SetInteger("v_plane_resource_id", v_plane_resource_id); | 87 value->SetInteger("v_plane_resource_id", v_plane_resource_id); |
| 83 value->SetInteger("a_plane_resource_id", a_plane_resource_id); | 88 value->SetInteger("a_plane_resource_id", a_plane_resource_id); |
| 84 } | 89 } |
| 85 | 90 |
| 86 } // namespace cc | 91 } // namespace cc |
| OLD | NEW |