Revert 284234 "Pass signin_scoped_device_id to DeviceInfoSpecifics."
[chromium-blink-merge.git] / cc / quads / yuv_video_draw_quad.cc
blobd2443ba9d97d7a42b92c6e5f2c76a9f8b4a5e70f
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 #include "cc/quads/yuv_video_draw_quad.h"
7 #include "base/logging.h"
8 #include "base/values.h"
9 #include "cc/base/math_util.h"
11 namespace cc {
13 YUVVideoDrawQuad::YUVVideoDrawQuad()
14 : y_plane_resource_id(0),
15 u_plane_resource_id(0),
16 v_plane_resource_id(0),
17 a_plane_resource_id(0) {}
18 YUVVideoDrawQuad::~YUVVideoDrawQuad() {}
20 void YUVVideoDrawQuad::SetNew(const SharedQuadState* shared_quad_state,
21 const gfx::Rect& rect,
22 const gfx::Rect& opaque_rect,
23 const gfx::Rect& visible_rect,
24 const gfx::RectF& tex_coord_rect,
25 unsigned y_plane_resource_id,
26 unsigned u_plane_resource_id,
27 unsigned v_plane_resource_id,
28 unsigned a_plane_resource_id,
29 ColorSpace color_space) {
30 bool needs_blending = false;
31 DrawQuad::SetAll(shared_quad_state, DrawQuad::YUV_VIDEO_CONTENT, rect,
32 opaque_rect, visible_rect, needs_blending);
33 this->tex_coord_rect = tex_coord_rect;
34 this->y_plane_resource_id = y_plane_resource_id;
35 this->u_plane_resource_id = u_plane_resource_id;
36 this->v_plane_resource_id = v_plane_resource_id;
37 this->a_plane_resource_id = a_plane_resource_id;
38 this->color_space = color_space;
41 void YUVVideoDrawQuad::SetAll(const SharedQuadState* shared_quad_state,
42 const gfx::Rect& rect,
43 const gfx::Rect& opaque_rect,
44 const gfx::Rect& visible_rect,
45 bool needs_blending,
46 const gfx::RectF& tex_coord_rect,
47 unsigned y_plane_resource_id,
48 unsigned u_plane_resource_id,
49 unsigned v_plane_resource_id,
50 unsigned a_plane_resource_id,
51 ColorSpace color_space) {
52 DrawQuad::SetAll(shared_quad_state, DrawQuad::YUV_VIDEO_CONTENT, rect,
53 opaque_rect, visible_rect, needs_blending);
54 this->tex_coord_rect = tex_coord_rect;
55 this->y_plane_resource_id = y_plane_resource_id;
56 this->u_plane_resource_id = u_plane_resource_id;
57 this->v_plane_resource_id = v_plane_resource_id;
58 this->a_plane_resource_id = a_plane_resource_id;
59 this->color_space = color_space;
62 void YUVVideoDrawQuad::IterateResources(
63 const ResourceIteratorCallback& callback) {
64 y_plane_resource_id = callback.Run(y_plane_resource_id);
65 u_plane_resource_id = callback.Run(u_plane_resource_id);
66 v_plane_resource_id = callback.Run(v_plane_resource_id);
67 if (a_plane_resource_id)
68 a_plane_resource_id = callback.Run(a_plane_resource_id);
71 const YUVVideoDrawQuad* YUVVideoDrawQuad::MaterialCast(
72 const DrawQuad* quad) {
73 DCHECK(quad->material == DrawQuad::YUV_VIDEO_CONTENT);
74 return static_cast<const YUVVideoDrawQuad*>(quad);
77 void YUVVideoDrawQuad::ExtendValue(base::DictionaryValue* value) const {
78 value->Set("tex_coord_rect", MathUtil::AsValue(tex_coord_rect).release());
79 value->SetInteger("y_plane_resource_id", y_plane_resource_id);
80 value->SetInteger("u_plane_resource_id", u_plane_resource_id);
81 value->SetInteger("v_plane_resource_id", v_plane_resource_id);
82 value->SetInteger("a_plane_resource_id", a_plane_resource_id);
85 } // namespace cc