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