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"
15 class CC_EXPORT YUVVideoDrawQuad
: public DrawQuad
{
18 REC_601
, // SDTV standard with restricted "studio swing" color range.
19 REC_709
, // HDTV standard with restricted "studio swing" color range.
20 JPEG
, // Full color range [0, 255] JPEG color space.
21 COLOR_SPACE_LAST
= JPEG
24 ~YUVVideoDrawQuad() override
;
28 void SetNew(const SharedQuadState
* shared_quad_state
,
29 const gfx::Rect
& rect
,
30 const gfx::Rect
& opaque_rect
,
31 const gfx::Rect
& visible_rect
,
32 // |*_tex_coord_rect| contains non-normalized coordinates.
33 // TODO(reveman): Make the use of normalized vs non-normalized
34 // coordinates consistent across all quad types: crbug.com/487370
35 const gfx::RectF
& ya_tex_coord_rect
,
36 const gfx::RectF
& uv_tex_coord_rect
,
37 const gfx::Size
& ya_tex_size
,
38 const gfx::Size
& uv_tex_size
,
39 unsigned y_plane_resource_id
,
40 unsigned u_plane_resource_id
,
41 unsigned v_plane_resource_id
,
42 unsigned a_plane_resource_id
,
43 ColorSpace color_space
);
45 void SetAll(const SharedQuadState
* shared_quad_state
,
46 const gfx::Rect
& rect
,
47 const gfx::Rect
& opaque_rect
,
48 const gfx::Rect
& visible_rect
,
50 // |*_tex_coord_rect| contains non-normalized coordinates.
51 // TODO(reveman): Make the use of normalized vs non-normalized
52 // coordinates consistent across all quad types: crbug.com/487370
53 const gfx::RectF
& ya_tex_coord_rect
,
54 const gfx::RectF
& uv_tex_coord_rect
,
55 const gfx::Size
& ya_tex_size
,
56 const gfx::Size
& uv_tex_size
,
57 unsigned y_plane_resource_id
,
58 unsigned u_plane_resource_id
,
59 unsigned v_plane_resource_id
,
60 unsigned a_plane_resource_id
,
61 ColorSpace color_space
);
63 gfx::RectF ya_tex_coord_rect
;
64 gfx::RectF uv_tex_coord_rect
;
65 gfx::Size ya_tex_size
;
66 gfx::Size uv_tex_size
;
67 ColorSpace color_space
;
69 static const YUVVideoDrawQuad
* MaterialCast(const DrawQuad
*);
71 ResourceId
y_plane_resource_id() const {
72 return resources
.ids
[kYPlaneResourceIdIndex
];
74 ResourceId
u_plane_resource_id() const {
75 return resources
.ids
[kUPlaneResourceIdIndex
];
77 ResourceId
v_plane_resource_id() const {
78 return resources
.ids
[kVPlaneResourceIdIndex
];
80 ResourceId
a_plane_resource_id() const {
81 return resources
.ids
[kAPlaneResourceIdIndex
];
85 static const size_t kYPlaneResourceIdIndex
= 0;
86 static const size_t kUPlaneResourceIdIndex
= 1;
87 static const size_t kVPlaneResourceIdIndex
= 2;
88 static const size_t kAPlaneResourceIdIndex
= 3;
90 void ExtendValue(base::trace_event::TracedValue
* value
) const override
;
95 #endif // CC_QUADS_YUV_VIDEO_DRAW_QUAD_H_