1 // Copyright 2014 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/surface_draw_quad.h"
7 #include "base/logging.h"
8 #include "base/values.h"
12 SurfaceDrawQuad::SurfaceDrawQuad() {
15 scoped_ptr
<SurfaceDrawQuad
> SurfaceDrawQuad::Create() {
16 return make_scoped_ptr(new SurfaceDrawQuad
);
19 void SurfaceDrawQuad::SetNew(const SharedQuadState
* shared_quad_state
,
20 const gfx::Rect
& rect
,
21 const gfx::Rect
& visible_rect
,
22 SurfaceId surface_id
) {
23 gfx::Rect opaque_rect
;
24 bool needs_blending
= false;
25 DrawQuad::SetAll(shared_quad_state
, DrawQuad::SURFACE_CONTENT
, rect
,
26 opaque_rect
, visible_rect
, needs_blending
);
27 this->surface_id
= surface_id
;
30 void SurfaceDrawQuad::SetAll(const SharedQuadState
* shared_quad_state
,
31 const gfx::Rect
& rect
,
32 const gfx::Rect
& opaque_rect
,
33 const gfx::Rect
& visible_rect
,
35 SurfaceId surface_id
) {
36 DrawQuad::SetAll(shared_quad_state
, DrawQuad::SURFACE_CONTENT
, rect
,
37 opaque_rect
, visible_rect
, needs_blending
);
38 this->surface_id
= surface_id
;
41 void SurfaceDrawQuad::IterateResources(
42 const ResourceIteratorCallback
& callback
) {}
44 const SurfaceDrawQuad
* SurfaceDrawQuad::MaterialCast(const DrawQuad
* quad
) {
45 DCHECK_EQ(quad
->material
, DrawQuad::SURFACE_CONTENT
);
46 return static_cast<const SurfaceDrawQuad
*>(quad
);
49 void SurfaceDrawQuad::ExtendValue(base::DictionaryValue
* value
) const {
50 value
->SetInteger("surface_id", surface_id
.id
);