| OLD | NEW |
| 1 // Copyright 2014 The Chromium Authors. All rights reserved. | 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 | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #include "cc/quads/surface_draw_quad.h" | 5 #include "cc/quads/surface_draw_quad.h" |
| 6 | 6 |
| 7 #include "base/logging.h" | 7 #include "base/logging.h" |
| 8 #include "base/values.h" | 8 #include "base/values.h" |
| 9 | 9 |
| 10 namespace cc { | 10 namespace cc { |
| 11 | 11 |
| 12 SurfaceDrawQuad::SurfaceDrawQuad() : surface_id(0) {} | 12 SurfaceDrawQuad::SurfaceDrawQuad() { |
| 13 } |
| 13 | 14 |
| 14 scoped_ptr<SurfaceDrawQuad> SurfaceDrawQuad::Create() { | 15 scoped_ptr<SurfaceDrawQuad> SurfaceDrawQuad::Create() { |
| 15 return make_scoped_ptr(new SurfaceDrawQuad); | 16 return make_scoped_ptr(new SurfaceDrawQuad); |
| 16 } | 17 } |
| 17 | 18 |
| 18 void SurfaceDrawQuad::SetNew(const SharedQuadState* shared_quad_state, | 19 void SurfaceDrawQuad::SetNew(const SharedQuadState* shared_quad_state, |
| 19 const gfx::Rect& rect, | 20 const gfx::Rect& rect, |
| 20 const gfx::Rect& visible_rect, | 21 const gfx::Rect& visible_rect, |
| 21 int surface_id) { | 22 SurfaceId surface_id) { |
| 22 gfx::Rect opaque_rect; | 23 gfx::Rect opaque_rect; |
| 23 bool needs_blending = false; | 24 bool needs_blending = false; |
| 24 DrawQuad::SetAll(shared_quad_state, DrawQuad::SURFACE_CONTENT, rect, | 25 DrawQuad::SetAll(shared_quad_state, DrawQuad::SURFACE_CONTENT, rect, |
| 25 opaque_rect, visible_rect, needs_blending); | 26 opaque_rect, visible_rect, needs_blending); |
| 26 this->surface_id = surface_id; | 27 this->surface_id = surface_id; |
| 27 } | 28 } |
| 28 | 29 |
| 29 void SurfaceDrawQuad::SetAll(const SharedQuadState* shared_quad_state, | 30 void SurfaceDrawQuad::SetAll(const SharedQuadState* shared_quad_state, |
| 30 const gfx::Rect& rect, | 31 const gfx::Rect& rect, |
| 31 const gfx::Rect& opaque_rect, | 32 const gfx::Rect& opaque_rect, |
| 32 const gfx::Rect& visible_rect, | 33 const gfx::Rect& visible_rect, |
| 33 bool needs_blending, | 34 bool needs_blending, |
| 34 int surface_id) { | 35 SurfaceId surface_id) { |
| 35 DrawQuad::SetAll(shared_quad_state, DrawQuad::SURFACE_CONTENT, rect, | 36 DrawQuad::SetAll(shared_quad_state, DrawQuad::SURFACE_CONTENT, rect, |
| 36 opaque_rect, visible_rect, needs_blending); | 37 opaque_rect, visible_rect, needs_blending); |
| 37 this->surface_id = surface_id; | 38 this->surface_id = surface_id; |
| 38 } | 39 } |
| 39 | 40 |
| 40 void SurfaceDrawQuad::IterateResources( | 41 void SurfaceDrawQuad::IterateResources( |
| 41 const ResourceIteratorCallback& callback) {} | 42 const ResourceIteratorCallback& callback) {} |
| 42 | 43 |
| 43 const SurfaceDrawQuad* SurfaceDrawQuad::MaterialCast(const DrawQuad* quad) { | 44 const SurfaceDrawQuad* SurfaceDrawQuad::MaterialCast(const DrawQuad* quad) { |
| 44 DCHECK_EQ(quad->material, DrawQuad::SURFACE_CONTENT); | 45 DCHECK_EQ(quad->material, DrawQuad::SURFACE_CONTENT); |
| 45 return static_cast<const SurfaceDrawQuad*>(quad); | 46 return static_cast<const SurfaceDrawQuad*>(quad); |
| 46 } | 47 } |
| 47 | 48 |
| 48 void SurfaceDrawQuad::ExtendValue(base::DictionaryValue* value) const { | 49 void SurfaceDrawQuad::ExtendValue(base::DictionaryValue* value) const { |
| 49 value->SetInteger("surface_id", surface_id); | 50 value->SetInteger("surface_id", surface_id.id); |
| 50 } | 51 } |
| 51 | 52 |
| 52 | 53 |
| 53 } // namespace cc | 54 } // namespace cc |
| OLD | NEW |