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