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"
11 StreamVideoDrawQuad::StreamVideoDrawQuad() : resource_id(0) {}
13 scoped_ptr
<StreamVideoDrawQuad
> StreamVideoDrawQuad::Create() {
14 return make_scoped_ptr(new StreamVideoDrawQuad
);
17 void StreamVideoDrawQuad::SetNew(const SharedQuadState
* shared_quad_state
,
19 gfx::Rect opaque_rect
,
21 const gfx::Transform
& matrix
) {
22 gfx::Rect visible_rect
= rect
;
23 bool needs_blending
= false;
24 DrawQuad::SetAll(shared_quad_state
, DrawQuad::STREAM_VIDEO_CONTENT
, rect
,
25 opaque_rect
, visible_rect
, needs_blending
);
26 this->resource_id
= resource_id
;
27 this->matrix
= matrix
;
30 void StreamVideoDrawQuad::SetAll(const SharedQuadState
* shared_quad_state
,
32 gfx::Rect opaque_rect
,
33 gfx::Rect visible_rect
,
36 const gfx::Transform
& matrix
) {
37 DrawQuad::SetAll(shared_quad_state
, DrawQuad::STREAM_VIDEO_CONTENT
, rect
,
38 opaque_rect
, visible_rect
, needs_blending
);
39 this->resource_id
= resource_id
;
40 this->matrix
= matrix
;
43 void StreamVideoDrawQuad::IterateResources(
44 const ResourceIteratorCallback
& callback
) {
45 resource_id
= callback
.Run(resource_id
);
48 const StreamVideoDrawQuad
* StreamVideoDrawQuad::MaterialCast(
49 const DrawQuad
* quad
) {
50 DCHECK(quad
->material
== DrawQuad::STREAM_VIDEO_CONTENT
);
51 return static_cast<const StreamVideoDrawQuad
*>(quad
);