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