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/geometry/rect_f.h" | 14 #include "ui/gfx/geometry/rect_f.h" |
15 #include "ui/gfx/geometry/size.h" | 15 #include "ui/gfx/geometry/size.h" |
16 | 16 |
17 namespace cc { | 17 namespace cc { |
18 | 18 |
19 class CC_EXPORT YUVVideoDrawQuad : public DrawQuad { | 19 class CC_EXPORT YUVVideoDrawQuad : public DrawQuad { |
20 public: | 20 public: |
21 static const size_t kYPlaneResourceIdIndex = 0; | 21 static const size_t kYPlaneResourceIdIndex = 0; |
22 static const size_t kUPlaneResourceIdIndex = 1; | 22 static const size_t kUPlaneResourceIdIndex = 1; |
23 static const size_t kVPlaneResourceIdIndex = 2; | 23 static const size_t kVPlaneResourceIdIndex = 2; |
24 static const size_t kAPlaneResourceIdIndex = 3; | 24 static const size_t kAPlaneResourceIdIndex = 3; |
25 | 25 |
| 26 enum : uint32_t { kMinBitsPerChannel = 8, kMaxBitsPerChannel = 24 }; |
| 27 |
26 enum ColorSpace { | 28 enum ColorSpace { |
27 REC_601, // SDTV standard with restricted "studio swing" color range. | 29 REC_601, // SDTV standard with restricted "studio swing" color range. |
28 REC_709, // HDTV standard with restricted "studio swing" color range. | 30 REC_709, // HDTV standard with restricted "studio swing" color range. |
29 JPEG, // Full color range [0, 255] JPEG color space. | 31 JPEG, // Full color range [0, 255] JPEG color space. |
30 COLOR_SPACE_LAST = JPEG | 32 COLOR_SPACE_LAST = JPEG |
31 }; | 33 }; |
32 | 34 |
33 ~YUVVideoDrawQuad() override; | 35 ~YUVVideoDrawQuad() override; |
34 | 36 |
35 YUVVideoDrawQuad(); | 37 YUVVideoDrawQuad(); |
36 YUVVideoDrawQuad(const YUVVideoDrawQuad& other); | 38 YUVVideoDrawQuad(const YUVVideoDrawQuad& other); |
37 | 39 |
38 void SetNew(const SharedQuadState* shared_quad_state, | 40 void SetNew(const SharedQuadState* shared_quad_state, |
39 const gfx::Rect& rect, | 41 const gfx::Rect& rect, |
40 const gfx::Rect& opaque_rect, | 42 const gfx::Rect& opaque_rect, |
41 const gfx::Rect& visible_rect, | 43 const gfx::Rect& visible_rect, |
42 // |*_tex_coord_rect| contains non-normalized coordinates. | 44 // |*_tex_coord_rect| contains non-normalized coordinates. |
43 // TODO(reveman): Make the use of normalized vs non-normalized | 45 // TODO(reveman): Make the use of normalized vs non-normalized |
44 // coordinates consistent across all quad types: crbug.com/487370 | 46 // coordinates consistent across all quad types: crbug.com/487370 |
45 const gfx::RectF& ya_tex_coord_rect, | 47 const gfx::RectF& ya_tex_coord_rect, |
46 const gfx::RectF& uv_tex_coord_rect, | 48 const gfx::RectF& uv_tex_coord_rect, |
47 const gfx::Size& ya_tex_size, | 49 const gfx::Size& ya_tex_size, |
48 const gfx::Size& uv_tex_size, | 50 const gfx::Size& uv_tex_size, |
49 unsigned y_plane_resource_id, | 51 unsigned y_plane_resource_id, |
50 unsigned u_plane_resource_id, | 52 unsigned u_plane_resource_id, |
51 unsigned v_plane_resource_id, | 53 unsigned v_plane_resource_id, |
52 unsigned a_plane_resource_id, | 54 unsigned a_plane_resource_id, |
53 ColorSpace color_space, | 55 ColorSpace color_space, |
54 float offset, | 56 float offset, |
55 float multiplier); | 57 float multiplier, |
| 58 uint32_t bits_per_channel); |
56 | 59 |
57 void SetAll(const SharedQuadState* shared_quad_state, | 60 void SetAll(const SharedQuadState* shared_quad_state, |
58 const gfx::Rect& rect, | 61 const gfx::Rect& rect, |
59 const gfx::Rect& opaque_rect, | 62 const gfx::Rect& opaque_rect, |
60 const gfx::Rect& visible_rect, | 63 const gfx::Rect& visible_rect, |
61 bool needs_blending, | 64 bool needs_blending, |
62 // |*_tex_coord_rect| contains non-normalized coordinates. | 65 // |*_tex_coord_rect| contains non-normalized coordinates. |
63 // TODO(reveman): Make the use of normalized vs non-normalized | 66 // TODO(reveman): Make the use of normalized vs non-normalized |
64 // coordinates consistent across all quad types: crbug.com/487370 | 67 // coordinates consistent across all quad types: crbug.com/487370 |
65 const gfx::RectF& ya_tex_coord_rect, | 68 const gfx::RectF& ya_tex_coord_rect, |
66 const gfx::RectF& uv_tex_coord_rect, | 69 const gfx::RectF& uv_tex_coord_rect, |
67 const gfx::Size& ya_tex_size, | 70 const gfx::Size& ya_tex_size, |
68 const gfx::Size& uv_tex_size, | 71 const gfx::Size& uv_tex_size, |
69 unsigned y_plane_resource_id, | 72 unsigned y_plane_resource_id, |
70 unsigned u_plane_resource_id, | 73 unsigned u_plane_resource_id, |
71 unsigned v_plane_resource_id, | 74 unsigned v_plane_resource_id, |
72 unsigned a_plane_resource_id, | 75 unsigned a_plane_resource_id, |
73 ColorSpace color_space, | 76 ColorSpace color_space, |
74 float offset, | 77 float offset, |
75 float multiplier); | 78 float multiplier, |
| 79 uint32_t bits_per_channel); |
76 | 80 |
77 gfx::RectF ya_tex_coord_rect; | 81 gfx::RectF ya_tex_coord_rect; |
78 gfx::RectF uv_tex_coord_rect; | 82 gfx::RectF uv_tex_coord_rect; |
79 gfx::Size ya_tex_size; | 83 gfx::Size ya_tex_size; |
80 gfx::Size uv_tex_size; | 84 gfx::Size uv_tex_size; |
81 ColorSpace color_space; | 85 ColorSpace color_space; |
82 float resource_offset = 0.0f; | 86 float resource_offset = 0.0f; |
83 float resource_multiplier = 1.0f; | 87 float resource_multiplier = 1.0f; |
| 88 uint32_t bits_per_channel = 8; |
84 | 89 |
85 static const YUVVideoDrawQuad* MaterialCast(const DrawQuad*); | 90 static const YUVVideoDrawQuad* MaterialCast(const DrawQuad*); |
86 | 91 |
87 ResourceId y_plane_resource_id() const { | 92 ResourceId y_plane_resource_id() const { |
88 return resources.ids[kYPlaneResourceIdIndex]; | 93 return resources.ids[kYPlaneResourceIdIndex]; |
89 } | 94 } |
90 ResourceId u_plane_resource_id() const { | 95 ResourceId u_plane_resource_id() const { |
91 return resources.ids[kUPlaneResourceIdIndex]; | 96 return resources.ids[kUPlaneResourceIdIndex]; |
92 } | 97 } |
93 ResourceId v_plane_resource_id() const { | 98 ResourceId v_plane_resource_id() const { |
94 return resources.ids[kVPlaneResourceIdIndex]; | 99 return resources.ids[kVPlaneResourceIdIndex]; |
95 } | 100 } |
96 ResourceId a_plane_resource_id() const { | 101 ResourceId a_plane_resource_id() const { |
97 return resources.ids[kAPlaneResourceIdIndex]; | 102 return resources.ids[kAPlaneResourceIdIndex]; |
98 } | 103 } |
99 | 104 |
100 private: | 105 private: |
101 void ExtendValue(base::trace_event::TracedValue* value) const override; | 106 void ExtendValue(base::trace_event::TracedValue* value) const override; |
102 }; | 107 }; |
103 | 108 |
104 } // namespace cc | 109 } // namespace cc |
105 | 110 |
106 #endif // CC_QUADS_YUV_VIDEO_DRAW_QUAD_H_ | 111 #endif // CC_QUADS_YUV_VIDEO_DRAW_QUAD_H_ |
OLD | NEW |