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" |
(...skipping 13 matching lines...) Expand all Loading... |
24 const gfx::Rect& visible_rect, | 24 const gfx::Rect& visible_rect, |
25 const gfx::RectF& ya_tex_coord_rect, | 25 const gfx::RectF& ya_tex_coord_rect, |
26 const gfx::RectF& uv_tex_coord_rect, | 26 const gfx::RectF& uv_tex_coord_rect, |
27 const gfx::Size& ya_tex_size, | 27 const gfx::Size& ya_tex_size, |
28 const gfx::Size& uv_tex_size, | 28 const gfx::Size& uv_tex_size, |
29 unsigned y_plane_resource_id, | 29 unsigned y_plane_resource_id, |
30 unsigned u_plane_resource_id, | 30 unsigned u_plane_resource_id, |
31 unsigned v_plane_resource_id, | 31 unsigned v_plane_resource_id, |
32 unsigned a_plane_resource_id, | 32 unsigned a_plane_resource_id, |
33 ColorSpace color_space, | 33 ColorSpace color_space, |
| 34 const gfx::ColorSpace& video_color_space, |
34 float offset, | 35 float offset, |
35 float multiplier, | 36 float multiplier, |
36 uint32_t bits_per_channel) { | 37 uint32_t bits_per_channel) { |
37 bool needs_blending = false; | 38 bool needs_blending = false; |
38 DrawQuad::SetAll(shared_quad_state, DrawQuad::YUV_VIDEO_CONTENT, rect, | 39 DrawQuad::SetAll(shared_quad_state, DrawQuad::YUV_VIDEO_CONTENT, rect, |
39 opaque_rect, visible_rect, needs_blending); | 40 opaque_rect, visible_rect, needs_blending); |
40 this->ya_tex_coord_rect = ya_tex_coord_rect; | 41 this->ya_tex_coord_rect = ya_tex_coord_rect; |
41 this->uv_tex_coord_rect = uv_tex_coord_rect; | 42 this->uv_tex_coord_rect = uv_tex_coord_rect; |
42 this->ya_tex_size = ya_tex_size; | 43 this->ya_tex_size = ya_tex_size; |
43 this->uv_tex_size = uv_tex_size; | 44 this->uv_tex_size = uv_tex_size; |
44 resources.ids[kYPlaneResourceIdIndex] = y_plane_resource_id; | 45 resources.ids[kYPlaneResourceIdIndex] = y_plane_resource_id; |
45 resources.ids[kUPlaneResourceIdIndex] = u_plane_resource_id; | 46 resources.ids[kUPlaneResourceIdIndex] = u_plane_resource_id; |
46 resources.ids[kVPlaneResourceIdIndex] = v_plane_resource_id; | 47 resources.ids[kVPlaneResourceIdIndex] = v_plane_resource_id; |
47 resources.ids[kAPlaneResourceIdIndex] = a_plane_resource_id; | 48 resources.ids[kAPlaneResourceIdIndex] = a_plane_resource_id; |
48 resources.count = a_plane_resource_id ? 4 : 3; | 49 resources.count = a_plane_resource_id ? 4 : 3; |
49 this->color_space = color_space; | 50 this->color_space = color_space; |
| 51 this->video_color_space = video_color_space; |
50 this->resource_offset = offset; | 52 this->resource_offset = offset; |
51 this->resource_multiplier = multiplier; | 53 this->resource_multiplier = multiplier; |
52 this->bits_per_channel = bits_per_channel; | 54 this->bits_per_channel = bits_per_channel; |
53 } | 55 } |
54 | 56 |
55 void YUVVideoDrawQuad::SetAll(const SharedQuadState* shared_quad_state, | 57 void YUVVideoDrawQuad::SetAll(const SharedQuadState* shared_quad_state, |
56 const gfx::Rect& rect, | 58 const gfx::Rect& rect, |
57 const gfx::Rect& opaque_rect, | 59 const gfx::Rect& opaque_rect, |
58 const gfx::Rect& visible_rect, | 60 const gfx::Rect& visible_rect, |
59 bool needs_blending, | 61 bool needs_blending, |
60 const gfx::RectF& ya_tex_coord_rect, | 62 const gfx::RectF& ya_tex_coord_rect, |
61 const gfx::RectF& uv_tex_coord_rect, | 63 const gfx::RectF& uv_tex_coord_rect, |
62 const gfx::Size& ya_tex_size, | 64 const gfx::Size& ya_tex_size, |
63 const gfx::Size& uv_tex_size, | 65 const gfx::Size& uv_tex_size, |
64 unsigned y_plane_resource_id, | 66 unsigned y_plane_resource_id, |
65 unsigned u_plane_resource_id, | 67 unsigned u_plane_resource_id, |
66 unsigned v_plane_resource_id, | 68 unsigned v_plane_resource_id, |
67 unsigned a_plane_resource_id, | 69 unsigned a_plane_resource_id, |
68 ColorSpace color_space, | 70 ColorSpace color_space, |
| 71 const gfx::ColorSpace& video_color_space, |
69 float offset, | 72 float offset, |
70 float multiplier, | 73 float multiplier, |
71 uint32_t bits_per_channel) { | 74 uint32_t bits_per_channel) { |
72 DrawQuad::SetAll(shared_quad_state, DrawQuad::YUV_VIDEO_CONTENT, rect, | 75 DrawQuad::SetAll(shared_quad_state, DrawQuad::YUV_VIDEO_CONTENT, rect, |
73 opaque_rect, visible_rect, needs_blending); | 76 opaque_rect, visible_rect, needs_blending); |
74 this->ya_tex_coord_rect = ya_tex_coord_rect; | 77 this->ya_tex_coord_rect = ya_tex_coord_rect; |
75 this->uv_tex_coord_rect = uv_tex_coord_rect; | 78 this->uv_tex_coord_rect = uv_tex_coord_rect; |
76 this->ya_tex_size = ya_tex_size; | 79 this->ya_tex_size = ya_tex_size; |
77 this->uv_tex_size = uv_tex_size; | 80 this->uv_tex_size = uv_tex_size; |
78 resources.ids[kYPlaneResourceIdIndex] = y_plane_resource_id; | 81 resources.ids[kYPlaneResourceIdIndex] = y_plane_resource_id; |
79 resources.ids[kUPlaneResourceIdIndex] = u_plane_resource_id; | 82 resources.ids[kUPlaneResourceIdIndex] = u_plane_resource_id; |
80 resources.ids[kVPlaneResourceIdIndex] = v_plane_resource_id; | 83 resources.ids[kVPlaneResourceIdIndex] = v_plane_resource_id; |
81 resources.ids[kAPlaneResourceIdIndex] = a_plane_resource_id; | 84 resources.ids[kAPlaneResourceIdIndex] = a_plane_resource_id; |
82 resources.count = resources.ids[kAPlaneResourceIdIndex] ? 4 : 3; | 85 resources.count = resources.ids[kAPlaneResourceIdIndex] ? 4 : 3; |
83 this->color_space = color_space; | 86 this->color_space = color_space; |
| 87 this->video_color_space = video_color_space; |
84 this->resource_offset = offset; | 88 this->resource_offset = offset; |
85 this->resource_multiplier = multiplier; | 89 this->resource_multiplier = multiplier; |
86 this->bits_per_channel = bits_per_channel; | 90 this->bits_per_channel = bits_per_channel; |
87 } | 91 } |
88 | 92 |
89 const YUVVideoDrawQuad* YUVVideoDrawQuad::MaterialCast( | 93 const YUVVideoDrawQuad* YUVVideoDrawQuad::MaterialCast( |
90 const DrawQuad* quad) { | 94 const DrawQuad* quad) { |
91 DCHECK(quad->material == DrawQuad::YUV_VIDEO_CONTENT); | 95 DCHECK(quad->material == DrawQuad::YUV_VIDEO_CONTENT); |
92 return static_cast<const YUVVideoDrawQuad*>(quad); | 96 return static_cast<const YUVVideoDrawQuad*>(quad); |
93 } | 97 } |
94 | 98 |
95 void YUVVideoDrawQuad::ExtendValue( | 99 void YUVVideoDrawQuad::ExtendValue( |
96 base::trace_event::TracedValue* value) const { | 100 base::trace_event::TracedValue* value) const { |
97 MathUtil::AddToTracedValue("ya_tex_coord_rect", ya_tex_coord_rect, value); | 101 MathUtil::AddToTracedValue("ya_tex_coord_rect", ya_tex_coord_rect, value); |
98 MathUtil::AddToTracedValue("uv_tex_coord_rect", uv_tex_coord_rect, value); | 102 MathUtil::AddToTracedValue("uv_tex_coord_rect", uv_tex_coord_rect, value); |
99 MathUtil::AddToTracedValue("ya_tex_size", ya_tex_size, value); | 103 MathUtil::AddToTracedValue("ya_tex_size", ya_tex_size, value); |
100 MathUtil::AddToTracedValue("uv_tex_size", uv_tex_size, value); | 104 MathUtil::AddToTracedValue("uv_tex_size", uv_tex_size, value); |
101 value->SetInteger("y_plane_resource_id", | 105 value->SetInteger("y_plane_resource_id", |
102 resources.ids[kYPlaneResourceIdIndex]); | 106 resources.ids[kYPlaneResourceIdIndex]); |
103 value->SetInteger("u_plane_resource_id", | 107 value->SetInteger("u_plane_resource_id", |
104 resources.ids[kUPlaneResourceIdIndex]); | 108 resources.ids[kUPlaneResourceIdIndex]); |
105 value->SetInteger("v_plane_resource_id", | 109 value->SetInteger("v_plane_resource_id", |
106 resources.ids[kVPlaneResourceIdIndex]); | 110 resources.ids[kVPlaneResourceIdIndex]); |
107 value->SetInteger("a_plane_resource_id", | 111 value->SetInteger("a_plane_resource_id", |
108 resources.ids[kAPlaneResourceIdIndex]); | 112 resources.ids[kAPlaneResourceIdIndex]); |
109 } | 113 } |
110 | 114 |
111 } // namespace cc | 115 } // namespace cc |
OLD | NEW |