[GCM] Remove GCMDriver::Purge and GCMClient::CheckOut
[chromium-blink-merge.git] / cc / quads / yuv_video_draw_quad.cc
blob612362e5e8cc8b8b52adb500b7a85cade2d1d01d
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/debug/trace_event_argument.h"
8 #include "base/logging.h"
9 #include "base/values.h"
10 #include "cc/base/math_util.h"
12 namespace cc {
14 YUVVideoDrawQuad::YUVVideoDrawQuad()
15 : y_plane_resource_id(0),
16 u_plane_resource_id(0),
17 v_plane_resource_id(0),
18 a_plane_resource_id(0) {}
19 YUVVideoDrawQuad::~YUVVideoDrawQuad() {}
21 void YUVVideoDrawQuad::SetNew(const SharedQuadState* shared_quad_state,
22 const gfx::Rect& rect,
23 const gfx::Rect& opaque_rect,
24 const gfx::Rect& visible_rect,
25 const gfx::RectF& tex_coord_rect,
26 unsigned y_plane_resource_id,
27 unsigned u_plane_resource_id,
28 unsigned v_plane_resource_id,
29 unsigned a_plane_resource_id,
30 ColorSpace color_space) {
31 bool needs_blending = false;
32 DrawQuad::SetAll(shared_quad_state, DrawQuad::YUV_VIDEO_CONTENT, rect,
33 opaque_rect, visible_rect, needs_blending);
34 this->tex_coord_rect = tex_coord_rect;
35 this->y_plane_resource_id = y_plane_resource_id;
36 this->u_plane_resource_id = u_plane_resource_id;
37 this->v_plane_resource_id = v_plane_resource_id;
38 this->a_plane_resource_id = a_plane_resource_id;
39 this->color_space = color_space;
42 void YUVVideoDrawQuad::SetAll(const SharedQuadState* shared_quad_state,
43 const gfx::Rect& rect,
44 const gfx::Rect& opaque_rect,
45 const gfx::Rect& visible_rect,
46 bool needs_blending,
47 const gfx::RectF& tex_coord_rect,
48 unsigned y_plane_resource_id,
49 unsigned u_plane_resource_id,
50 unsigned v_plane_resource_id,
51 unsigned a_plane_resource_id,
52 ColorSpace color_space) {
53 DrawQuad::SetAll(shared_quad_state, DrawQuad::YUV_VIDEO_CONTENT, rect,
54 opaque_rect, visible_rect, needs_blending);
55 this->tex_coord_rect = tex_coord_rect;
56 this->y_plane_resource_id = y_plane_resource_id;
57 this->u_plane_resource_id = u_plane_resource_id;
58 this->v_plane_resource_id = v_plane_resource_id;
59 this->a_plane_resource_id = a_plane_resource_id;
60 this->color_space = color_space;
63 void YUVVideoDrawQuad::IterateResources(
64 const ResourceIteratorCallback& callback) {
65 y_plane_resource_id = callback.Run(y_plane_resource_id);
66 u_plane_resource_id = callback.Run(u_plane_resource_id);
67 v_plane_resource_id = callback.Run(v_plane_resource_id);
68 if (a_plane_resource_id)
69 a_plane_resource_id = callback.Run(a_plane_resource_id);
72 const YUVVideoDrawQuad* YUVVideoDrawQuad::MaterialCast(
73 const DrawQuad* quad) {
74 DCHECK(quad->material == DrawQuad::YUV_VIDEO_CONTENT);
75 return static_cast<const YUVVideoDrawQuad*>(quad);
78 void YUVVideoDrawQuad::ExtendValue(base::debug::TracedValue* value) const {
79 value->BeginArray("tex_coord_rect");
80 MathUtil::AddToTracedValue(tex_coord_rect, value);
81 value->EndArray();
82 value->SetInteger("y_plane_resource_id", y_plane_resource_id);
83 value->SetInteger("u_plane_resource_id", u_plane_resource_id);
84 value->SetInteger("v_plane_resource_id", v_plane_resource_id);
85 value->SetInteger("a_plane_resource_id", a_plane_resource_id);
88 } // namespace cc