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& ya_tex_coord_rect, |
| 26 const gfx::RectF& uv_tex_coord_rect, |
26 const gfx::Size& ya_tex_size, | 27 const gfx::Size& ya_tex_size, |
27 const gfx::Size& uv_tex_size, | 28 const gfx::Size& uv_tex_size, |
28 unsigned y_plane_resource_id, | 29 unsigned y_plane_resource_id, |
29 unsigned u_plane_resource_id, | 30 unsigned u_plane_resource_id, |
30 unsigned v_plane_resource_id, | 31 unsigned v_plane_resource_id, |
31 unsigned a_plane_resource_id, | 32 unsigned a_plane_resource_id, |
32 ColorSpace color_space) { | 33 ColorSpace color_space) { |
33 bool needs_blending = false; | 34 bool needs_blending = false; |
34 DrawQuad::SetAll(shared_quad_state, DrawQuad::YUV_VIDEO_CONTENT, rect, | 35 DrawQuad::SetAll(shared_quad_state, DrawQuad::YUV_VIDEO_CONTENT, rect, |
35 opaque_rect, visible_rect, needs_blending); | 36 opaque_rect, visible_rect, needs_blending); |
36 this->tex_coord_rect = tex_coord_rect; | 37 this->ya_tex_coord_rect = ya_tex_coord_rect; |
| 38 this->uv_tex_coord_rect = uv_tex_coord_rect; |
37 this->ya_tex_size = ya_tex_size; | 39 this->ya_tex_size = ya_tex_size; |
38 this->uv_tex_size = uv_tex_size; | 40 this->uv_tex_size = uv_tex_size; |
39 this->y_plane_resource_id = y_plane_resource_id; | 41 this->y_plane_resource_id = y_plane_resource_id; |
40 this->u_plane_resource_id = u_plane_resource_id; | 42 this->u_plane_resource_id = u_plane_resource_id; |
41 this->v_plane_resource_id = v_plane_resource_id; | 43 this->v_plane_resource_id = v_plane_resource_id; |
42 this->a_plane_resource_id = a_plane_resource_id; | 44 this->a_plane_resource_id = a_plane_resource_id; |
43 this->color_space = color_space; | 45 this->color_space = color_space; |
44 } | 46 } |
45 | 47 |
46 void YUVVideoDrawQuad::SetAll(const SharedQuadState* shared_quad_state, | 48 void YUVVideoDrawQuad::SetAll(const SharedQuadState* shared_quad_state, |
47 const gfx::Rect& rect, | 49 const gfx::Rect& rect, |
48 const gfx::Rect& opaque_rect, | 50 const gfx::Rect& opaque_rect, |
49 const gfx::Rect& visible_rect, | 51 const gfx::Rect& visible_rect, |
50 bool needs_blending, | 52 bool needs_blending, |
51 const gfx::RectF& tex_coord_rect, | 53 const gfx::RectF& ya_tex_coord_rect, |
| 54 const gfx::RectF& uv_tex_coord_rect, |
52 const gfx::Size& ya_tex_size, | 55 const gfx::Size& ya_tex_size, |
53 const gfx::Size& uv_tex_size, | 56 const gfx::Size& uv_tex_size, |
54 unsigned y_plane_resource_id, | 57 unsigned y_plane_resource_id, |
55 unsigned u_plane_resource_id, | 58 unsigned u_plane_resource_id, |
56 unsigned v_plane_resource_id, | 59 unsigned v_plane_resource_id, |
57 unsigned a_plane_resource_id, | 60 unsigned a_plane_resource_id, |
58 ColorSpace color_space) { | 61 ColorSpace color_space) { |
59 DrawQuad::SetAll(shared_quad_state, DrawQuad::YUV_VIDEO_CONTENT, rect, | 62 DrawQuad::SetAll(shared_quad_state, DrawQuad::YUV_VIDEO_CONTENT, rect, |
60 opaque_rect, visible_rect, needs_blending); | 63 opaque_rect, visible_rect, needs_blending); |
61 this->tex_coord_rect = tex_coord_rect; | 64 this->ya_tex_coord_rect = ya_tex_coord_rect; |
| 65 this->uv_tex_coord_rect = uv_tex_coord_rect; |
62 this->ya_tex_size = ya_tex_size; | 66 this->ya_tex_size = ya_tex_size; |
63 this->uv_tex_size = uv_tex_size; | 67 this->uv_tex_size = uv_tex_size; |
64 this->y_plane_resource_id = y_plane_resource_id; | 68 this->y_plane_resource_id = y_plane_resource_id; |
65 this->u_plane_resource_id = u_plane_resource_id; | 69 this->u_plane_resource_id = u_plane_resource_id; |
66 this->v_plane_resource_id = v_plane_resource_id; | 70 this->v_plane_resource_id = v_plane_resource_id; |
67 this->a_plane_resource_id = a_plane_resource_id; | 71 this->a_plane_resource_id = a_plane_resource_id; |
68 this->color_space = color_space; | 72 this->color_space = color_space; |
69 } | 73 } |
70 | 74 |
71 void YUVVideoDrawQuad::IterateResources( | 75 void YUVVideoDrawQuad::IterateResources( |
72 const ResourceIteratorCallback& callback) { | 76 const ResourceIteratorCallback& callback) { |
73 y_plane_resource_id = callback.Run(y_plane_resource_id); | 77 y_plane_resource_id = callback.Run(y_plane_resource_id); |
74 u_plane_resource_id = callback.Run(u_plane_resource_id); | 78 u_plane_resource_id = callback.Run(u_plane_resource_id); |
75 v_plane_resource_id = callback.Run(v_plane_resource_id); | 79 v_plane_resource_id = callback.Run(v_plane_resource_id); |
76 if (a_plane_resource_id) | 80 if (a_plane_resource_id) |
77 a_plane_resource_id = callback.Run(a_plane_resource_id); | 81 a_plane_resource_id = callback.Run(a_plane_resource_id); |
78 } | 82 } |
79 | 83 |
80 const YUVVideoDrawQuad* YUVVideoDrawQuad::MaterialCast( | 84 const YUVVideoDrawQuad* YUVVideoDrawQuad::MaterialCast( |
81 const DrawQuad* quad) { | 85 const DrawQuad* quad) { |
82 DCHECK(quad->material == DrawQuad::YUV_VIDEO_CONTENT); | 86 DCHECK(quad->material == DrawQuad::YUV_VIDEO_CONTENT); |
83 return static_cast<const YUVVideoDrawQuad*>(quad); | 87 return static_cast<const YUVVideoDrawQuad*>(quad); |
84 } | 88 } |
85 | 89 |
86 void YUVVideoDrawQuad::ExtendValue( | 90 void YUVVideoDrawQuad::ExtendValue( |
87 base::trace_event::TracedValue* value) const { | 91 base::trace_event::TracedValue* value) const { |
88 MathUtil::AddToTracedValue("tex_coord_rect", tex_coord_rect, value); | 92 MathUtil::AddToTracedValue("ya_tex_coord_rect", ya_tex_coord_rect, value); |
| 93 MathUtil::AddToTracedValue("uv_tex_coord_rect", uv_tex_coord_rect, value); |
89 MathUtil::AddToTracedValue("ya_tex_size", ya_tex_size, value); | 94 MathUtil::AddToTracedValue("ya_tex_size", ya_tex_size, value); |
90 MathUtil::AddToTracedValue("uv_tex_size", uv_tex_size, value); | 95 MathUtil::AddToTracedValue("uv_tex_size", uv_tex_size, value); |
91 value->SetInteger("y_plane_resource_id", y_plane_resource_id); | 96 value->SetInteger("y_plane_resource_id", y_plane_resource_id); |
92 value->SetInteger("u_plane_resource_id", u_plane_resource_id); | 97 value->SetInteger("u_plane_resource_id", u_plane_resource_id); |
93 value->SetInteger("v_plane_resource_id", v_plane_resource_id); | 98 value->SetInteger("v_plane_resource_id", v_plane_resource_id); |
94 value->SetInteger("a_plane_resource_id", a_plane_resource_id); | 99 value->SetInteger("a_plane_resource_id", a_plane_resource_id); |
95 } | 100 } |
96 | 101 |
97 } // namespace cc | 102 } // namespace cc |
OLD | NEW |