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/stream_video_draw_quad.h"
7 #include "base/logging.h"
8 #include "base/trace_event/trace_event_argument.h"
9 #include "base/values.h"
10 #include "cc/base/math_util.h"
14 StreamVideoDrawQuad::StreamVideoDrawQuad() {
17 void StreamVideoDrawQuad::SetNew(const SharedQuadState
* shared_quad_state
,
18 const gfx::Rect
& rect
,
19 const gfx::Rect
& opaque_rect
,
20 const gfx::Rect
& visible_rect
,
22 const gfx::Transform
& matrix
) {
23 bool needs_blending
= false;
24 DrawQuad::SetAll(shared_quad_state
, DrawQuad::STREAM_VIDEO_CONTENT
, rect
,
25 opaque_rect
, visible_rect
, needs_blending
);
26 resources
.ids
[kResourceIdIndex
] = resource_id
;
28 this->matrix
= matrix
;
31 void StreamVideoDrawQuad::SetAll(const SharedQuadState
* shared_quad_state
,
32 const gfx::Rect
& rect
,
33 const gfx::Rect
& opaque_rect
,
34 const gfx::Rect
& visible_rect
,
37 const gfx::Transform
& matrix
) {
38 DrawQuad::SetAll(shared_quad_state
, DrawQuad::STREAM_VIDEO_CONTENT
, rect
,
39 opaque_rect
, visible_rect
, needs_blending
);
40 resources
.ids
[kResourceIdIndex
] = resource_id
;
42 this->matrix
= matrix
;
45 const StreamVideoDrawQuad
* StreamVideoDrawQuad::MaterialCast(
46 const DrawQuad
* quad
) {
47 DCHECK(quad
->material
== DrawQuad::STREAM_VIDEO_CONTENT
);
48 return static_cast<const StreamVideoDrawQuad
*>(quad
);
51 void StreamVideoDrawQuad::ExtendValue(
52 base::trace_event::TracedValue
* value
) const {
53 value
->SetInteger("resource_id", resources
.ids
[kResourceIdIndex
]);
54 MathUtil::AddToTracedValue("matrix", matrix
, value
);