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 #ifndef CC_QUADS_YUV_VIDEO_DRAW_QUAD_H_ | 5 #ifndef CC_QUADS_YUV_VIDEO_DRAW_QUAD_H_ |
6 #define CC_QUADS_YUV_VIDEO_DRAW_QUAD_H_ | 6 #define CC_QUADS_YUV_VIDEO_DRAW_QUAD_H_ |
7 | 7 |
8 #include <stddef.h> | 8 #include <stddef.h> |
9 | 9 |
10 #include <memory> | 10 #include <memory> |
11 | 11 |
12 #include "cc/base/cc_export.h" | 12 #include "cc/base/cc_export.h" |
13 #include "cc/quads/draw_quad.h" | 13 #include "cc/quads/draw_quad.h" |
| 14 #include "ui/gfx/color_space.h" |
14 #include "ui/gfx/geometry/rect_f.h" | 15 #include "ui/gfx/geometry/rect_f.h" |
15 #include "ui/gfx/geometry/size.h" | 16 #include "ui/gfx/geometry/size.h" |
16 | 17 |
17 namespace cc { | 18 namespace cc { |
18 | 19 |
19 class CC_EXPORT YUVVideoDrawQuad : public DrawQuad { | 20 class CC_EXPORT YUVVideoDrawQuad : public DrawQuad { |
20 public: | 21 public: |
21 static const size_t kYPlaneResourceIdIndex = 0; | 22 static const size_t kYPlaneResourceIdIndex = 0; |
22 static const size_t kUPlaneResourceIdIndex = 1; | 23 static const size_t kUPlaneResourceIdIndex = 1; |
23 static const size_t kVPlaneResourceIdIndex = 2; | 24 static const size_t kVPlaneResourceIdIndex = 2; |
(...skipping 22 matching lines...) Expand all Loading... |
46 // coordinates consistent across all quad types: crbug.com/487370 | 47 // coordinates consistent across all quad types: crbug.com/487370 |
47 const gfx::RectF& ya_tex_coord_rect, | 48 const gfx::RectF& ya_tex_coord_rect, |
48 const gfx::RectF& uv_tex_coord_rect, | 49 const gfx::RectF& uv_tex_coord_rect, |
49 const gfx::Size& ya_tex_size, | 50 const gfx::Size& ya_tex_size, |
50 const gfx::Size& uv_tex_size, | 51 const gfx::Size& uv_tex_size, |
51 unsigned y_plane_resource_id, | 52 unsigned y_plane_resource_id, |
52 unsigned u_plane_resource_id, | 53 unsigned u_plane_resource_id, |
53 unsigned v_plane_resource_id, | 54 unsigned v_plane_resource_id, |
54 unsigned a_plane_resource_id, | 55 unsigned a_plane_resource_id, |
55 ColorSpace color_space, | 56 ColorSpace color_space, |
| 57 const gfx::ColorSpace& video_color_space, |
56 float offset, | 58 float offset, |
57 float multiplier, | 59 float multiplier, |
58 uint32_t bits_per_channel); | 60 uint32_t bits_per_channel); |
59 | 61 |
60 void SetAll(const SharedQuadState* shared_quad_state, | 62 void SetAll(const SharedQuadState* shared_quad_state, |
61 const gfx::Rect& rect, | 63 const gfx::Rect& rect, |
62 const gfx::Rect& opaque_rect, | 64 const gfx::Rect& opaque_rect, |
63 const gfx::Rect& visible_rect, | 65 const gfx::Rect& visible_rect, |
64 bool needs_blending, | 66 bool needs_blending, |
65 // |*_tex_coord_rect| contains non-normalized coordinates. | 67 // |*_tex_coord_rect| contains non-normalized coordinates. |
66 // TODO(reveman): Make the use of normalized vs non-normalized | 68 // TODO(reveman): Make the use of normalized vs non-normalized |
67 // coordinates consistent across all quad types: crbug.com/487370 | 69 // coordinates consistent across all quad types: crbug.com/487370 |
68 const gfx::RectF& ya_tex_coord_rect, | 70 const gfx::RectF& ya_tex_coord_rect, |
69 const gfx::RectF& uv_tex_coord_rect, | 71 const gfx::RectF& uv_tex_coord_rect, |
70 const gfx::Size& ya_tex_size, | 72 const gfx::Size& ya_tex_size, |
71 const gfx::Size& uv_tex_size, | 73 const gfx::Size& uv_tex_size, |
72 unsigned y_plane_resource_id, | 74 unsigned y_plane_resource_id, |
73 unsigned u_plane_resource_id, | 75 unsigned u_plane_resource_id, |
74 unsigned v_plane_resource_id, | 76 unsigned v_plane_resource_id, |
75 unsigned a_plane_resource_id, | 77 unsigned a_plane_resource_id, |
76 ColorSpace color_space, | 78 ColorSpace color_space, |
| 79 const gfx::ColorSpace& video_color_space, |
77 float offset, | 80 float offset, |
78 float multiplier, | 81 float multiplier, |
79 uint32_t bits_per_channel); | 82 uint32_t bits_per_channel); |
80 | 83 |
81 gfx::RectF ya_tex_coord_rect; | 84 gfx::RectF ya_tex_coord_rect; |
82 gfx::RectF uv_tex_coord_rect; | 85 gfx::RectF uv_tex_coord_rect; |
83 gfx::Size ya_tex_size; | 86 gfx::Size ya_tex_size; |
84 gfx::Size uv_tex_size; | 87 gfx::Size uv_tex_size; |
85 ColorSpace color_space; | 88 ColorSpace color_space; |
86 float resource_offset = 0.0f; | 89 float resource_offset = 0.0f; |
87 float resource_multiplier = 1.0f; | 90 float resource_multiplier = 1.0f; |
88 uint32_t bits_per_channel = 8; | 91 uint32_t bits_per_channel = 8; |
| 92 // TODO(hubbe): Move to ResourceProvider::ScopedSamplerGL. |
| 93 gfx::ColorSpace video_color_space; |
89 | 94 |
90 static const YUVVideoDrawQuad* MaterialCast(const DrawQuad*); | 95 static const YUVVideoDrawQuad* MaterialCast(const DrawQuad*); |
91 | 96 |
92 ResourceId y_plane_resource_id() const { | 97 ResourceId y_plane_resource_id() const { |
93 return resources.ids[kYPlaneResourceIdIndex]; | 98 return resources.ids[kYPlaneResourceIdIndex]; |
94 } | 99 } |
95 ResourceId u_plane_resource_id() const { | 100 ResourceId u_plane_resource_id() const { |
96 return resources.ids[kUPlaneResourceIdIndex]; | 101 return resources.ids[kUPlaneResourceIdIndex]; |
97 } | 102 } |
98 ResourceId v_plane_resource_id() const { | 103 ResourceId v_plane_resource_id() const { |
99 return resources.ids[kVPlaneResourceIdIndex]; | 104 return resources.ids[kVPlaneResourceIdIndex]; |
100 } | 105 } |
101 ResourceId a_plane_resource_id() const { | 106 ResourceId a_plane_resource_id() const { |
102 return resources.ids[kAPlaneResourceIdIndex]; | 107 return resources.ids[kAPlaneResourceIdIndex]; |
103 } | 108 } |
104 | 109 |
105 private: | 110 private: |
106 void ExtendValue(base::trace_event::TracedValue* value) const override; | 111 void ExtendValue(base::trace_event::TracedValue* value) const override; |
107 }; | 112 }; |
108 | 113 |
109 } // namespace cc | 114 } // namespace cc |
110 | 115 |
111 #endif // CC_QUADS_YUV_VIDEO_DRAW_QUAD_H_ | 116 #endif // CC_QUADS_YUV_VIDEO_DRAW_QUAD_H_ |
OLD | NEW |