OLD | NEW |
1 // Copyright 2012 The Chromium Authors. All rights reserved. | 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 | 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/tile_draw_quad.h" | 5 #include "cc/quads/tile_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 #include "third_party/khronos/GLES2/gl2.h" | 9 #include "third_party/khronos/GLES2/gl2.h" |
10 | 10 |
11 namespace cc { | 11 namespace cc { |
12 | 12 |
13 TileDrawQuad::TileDrawQuad() | 13 TileDrawQuad::TileDrawQuad() |
14 : resource_id(0) { | 14 : resource_id(0) { |
15 } | 15 } |
16 | 16 |
17 TileDrawQuad::~TileDrawQuad() { | 17 TileDrawQuad::~TileDrawQuad() { |
18 } | 18 } |
19 | 19 |
20 scoped_ptr<TileDrawQuad> TileDrawQuad::Create() { | 20 scoped_ptr<TileDrawQuad> TileDrawQuad::Create() { |
21 return make_scoped_ptr(new TileDrawQuad); | 21 return make_scoped_ptr(new TileDrawQuad); |
22 } | 22 } |
23 | 23 |
24 void TileDrawQuad::SetNew(const SharedQuadState* shared_quad_state, | 24 void TileDrawQuad::SetNew(const SharedQuadState* shared_quad_state, |
25 gfx::Rect rect, | 25 const gfx::Rect& rect, |
26 gfx::Rect opaque_rect, | 26 const gfx::Rect& opaque_rect, |
27 unsigned resource_id, | 27 unsigned resource_id, |
28 const gfx::RectF& tex_coord_rect, | 28 const gfx::RectF& tex_coord_rect, |
29 gfx::Size texture_size, | 29 gfx::Size texture_size, |
30 bool swizzle_contents) { | 30 bool swizzle_contents) { |
31 ContentDrawQuadBase::SetNew(shared_quad_state, DrawQuad::TILED_CONTENT, rect, | 31 ContentDrawQuadBase::SetNew(shared_quad_state, DrawQuad::TILED_CONTENT, rect, |
32 opaque_rect, tex_coord_rect, texture_size, | 32 opaque_rect, tex_coord_rect, texture_size, |
33 swizzle_contents); | 33 swizzle_contents); |
34 this->resource_id = resource_id; | 34 this->resource_id = resource_id; |
35 } | 35 } |
36 | 36 |
37 void TileDrawQuad::SetAll(const SharedQuadState* shared_quad_state, | 37 void TileDrawQuad::SetAll(const SharedQuadState* shared_quad_state, |
38 gfx::Rect rect, | 38 const gfx::Rect& rect, |
39 gfx::Rect opaque_rect, | 39 const gfx::Rect& opaque_rect, |
40 gfx::Rect visible_rect, | 40 const gfx::Rect& visible_rect, |
41 bool needs_blending, | 41 bool needs_blending, |
42 unsigned resource_id, | 42 unsigned resource_id, |
43 const gfx::RectF& tex_coord_rect, | 43 const gfx::RectF& tex_coord_rect, |
44 gfx::Size texture_size, | 44 gfx::Size texture_size, |
45 bool swizzle_contents) { | 45 bool swizzle_contents) { |
46 ContentDrawQuadBase::SetAll(shared_quad_state, DrawQuad::TILED_CONTENT, rect, | 46 ContentDrawQuadBase::SetAll(shared_quad_state, DrawQuad::TILED_CONTENT, rect, |
47 opaque_rect, visible_rect, needs_blending, | 47 opaque_rect, visible_rect, needs_blending, |
48 tex_coord_rect, texture_size, swizzle_contents); | 48 tex_coord_rect, texture_size, swizzle_contents); |
49 this->resource_id = resource_id; | 49 this->resource_id = resource_id; |
50 } | 50 } |
51 | 51 |
52 void TileDrawQuad::IterateResources( | 52 void TileDrawQuad::IterateResources( |
53 const ResourceIteratorCallback& callback) { | 53 const ResourceIteratorCallback& callback) { |
54 resource_id = callback.Run(resource_id); | 54 resource_id = callback.Run(resource_id); |
55 } | 55 } |
56 | 56 |
57 const TileDrawQuad* TileDrawQuad::MaterialCast(const DrawQuad* quad) { | 57 const TileDrawQuad* TileDrawQuad::MaterialCast(const DrawQuad* quad) { |
58 DCHECK(quad->material == DrawQuad::TILED_CONTENT); | 58 DCHECK(quad->material == DrawQuad::TILED_CONTENT); |
59 return static_cast<const TileDrawQuad*>(quad); | 59 return static_cast<const TileDrawQuad*>(quad); |
60 } | 60 } |
61 | 61 |
62 void TileDrawQuad::ExtendValue(base::DictionaryValue* value) const { | 62 void TileDrawQuad::ExtendValue(base::DictionaryValue* value) const { |
63 ContentDrawQuadBase::ExtendValue(value); | 63 ContentDrawQuadBase::ExtendValue(value); |
64 value->SetInteger("resource_id", resource_id); | 64 value->SetInteger("resource_id", resource_id); |
65 } | 65 } |
66 | 66 |
67 } // namespace cc | 67 } // namespace cc |
OLD | NEW |