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.
5 #ifndef CC_QUADS_YUV_VIDEO_DRAW_QUAD_H_
6 #define CC_QUADS_YUV_VIDEO_DRAW_QUAD_H_
8 #include "base/basictypes.h"
9 #include "base/memory/scoped_ptr.h"
10 #include "cc/base/cc_export.h"
11 #include "cc/quads/draw_quad.h"
12 #include "ui/gfx/geometry/rect_f.h"
13 #include "ui/gfx/geometry/size.h"
17 class CC_EXPORT YUVVideoDrawQuad
: public DrawQuad
{
20 REC_601
, // SDTV standard with restricted "studio swing" color range.
21 REC_709
, // HDTV standard with restricted "studio swing" color range.
22 JPEG
, // Full color range [0, 255] JPEG color space.
23 COLOR_SPACE_LAST
= JPEG
26 ~YUVVideoDrawQuad() override
;
30 void SetNew(const SharedQuadState
* shared_quad_state
,
31 const gfx::Rect
& rect
,
32 const gfx::Rect
& opaque_rect
,
33 const gfx::Rect
& visible_rect
,
34 // |*_tex_coord_rect| contains non-normalized coordinates.
35 // TODO(reveman): Make the use of normalized vs non-normalized
36 // coordinates consistent across all quad types: crbug.com/487370
37 const gfx::RectF
& ya_tex_coord_rect
,
38 const gfx::RectF
& uv_tex_coord_rect
,
39 const gfx::Size
& ya_tex_size
,
40 const gfx::Size
& uv_tex_size
,
41 unsigned y_plane_resource_id
,
42 unsigned u_plane_resource_id
,
43 unsigned v_plane_resource_id
,
44 unsigned a_plane_resource_id
,
45 ColorSpace color_space
);
47 void SetAll(const SharedQuadState
* shared_quad_state
,
48 const gfx::Rect
& rect
,
49 const gfx::Rect
& opaque_rect
,
50 const gfx::Rect
& visible_rect
,
52 // |*_tex_coord_rect| contains non-normalized coordinates.
53 // TODO(reveman): Make the use of normalized vs non-normalized
54 // coordinates consistent across all quad types: crbug.com/487370
55 const gfx::RectF
& ya_tex_coord_rect
,
56 const gfx::RectF
& uv_tex_coord_rect
,
57 const gfx::Size
& ya_tex_size
,
58 const gfx::Size
& uv_tex_size
,
59 unsigned y_plane_resource_id
,
60 unsigned u_plane_resource_id
,
61 unsigned v_plane_resource_id
,
62 unsigned a_plane_resource_id
,
63 ColorSpace color_space
);
65 gfx::RectF ya_tex_coord_rect
;
66 gfx::RectF uv_tex_coord_rect
;
67 gfx::Size ya_tex_size
;
68 gfx::Size uv_tex_size
;
69 ColorSpace color_space
;
71 static const YUVVideoDrawQuad
* MaterialCast(const DrawQuad
*);
73 ResourceId
y_plane_resource_id() const {
74 return resources
.ids
[kYPlaneResourceIdIndex
];
76 ResourceId
u_plane_resource_id() const {
77 return resources
.ids
[kUPlaneResourceIdIndex
];
79 ResourceId
v_plane_resource_id() const {
80 return resources
.ids
[kVPlaneResourceIdIndex
];
82 ResourceId
a_plane_resource_id() const {
83 return resources
.ids
[kAPlaneResourceIdIndex
];
87 static const size_t kYPlaneResourceIdIndex
= 0;
88 static const size_t kUPlaneResourceIdIndex
= 1;
89 static const size_t kVPlaneResourceIdIndex
= 2;
90 static const size_t kAPlaneResourceIdIndex
= 3;
92 void ExtendValue(base::trace_event::TracedValue
* value
) const override
;
97 #endif // CC_QUADS_YUV_VIDEO_DRAW_QUAD_H_