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/tile_draw_quad.h" | 5 #include "cc/tile_draw_quad.h" |
6 | 6 |
7 #include "base/logging.h" | 7 #include "base/logging.h" |
8 #include "third_party/khronos/GLES2/gl2.h" | 8 #include "third_party/khronos/GLES2/gl2.h" |
9 | 9 |
10 namespace cc { | 10 namespace cc { |
11 | 11 |
12 TileDrawQuad::TileDrawQuad() | 12 TileDrawQuad::TileDrawQuad() |
13 : resource_id(0), | 13 : resource_id(0), |
14 swizzle_contents(false), | 14 swizzle_contents(false) { |
15 left_edge_aa(false), | |
16 top_edge_aa(false), | |
17 right_edge_aa(false), | |
18 bottom_edge_aa(false) { | |
19 } | 15 } |
20 | 16 |
21 scoped_ptr<TileDrawQuad> TileDrawQuad::Create() { | 17 scoped_ptr<TileDrawQuad> TileDrawQuad::Create() { |
22 return make_scoped_ptr(new TileDrawQuad); | 18 return make_scoped_ptr(new TileDrawQuad); |
23 } | 19 } |
24 | 20 |
25 void TileDrawQuad::SetNew(const SharedQuadState* shared_quad_state, | 21 void TileDrawQuad::SetNew(const SharedQuadState* shared_quad_state, |
26 gfx::Rect rect, | 22 gfx::Rect rect, |
27 gfx::Rect opaque_rect, | 23 gfx::Rect opaque_rect, |
| 24 AntiAliasing anti_aliasing, |
28 unsigned resource_id, | 25 unsigned resource_id, |
29 const gfx::RectF& tex_coord_rect, | 26 const gfx::RectF& tex_coord_rect, |
30 gfx::Size texture_size, | 27 gfx::Size texture_size, |
31 bool swizzle_contents, | 28 bool swizzle_contents) { |
32 bool left_edge_aa, | |
33 bool top_edge_aa, | |
34 bool right_edge_aa, | |
35 bool bottom_edge_aa) { | |
36 gfx::Rect visible_rect = rect; | 29 gfx::Rect visible_rect = rect; |
37 bool needs_blending = false; | 30 bool needs_blending = false; |
38 DrawQuad::SetAll(shared_quad_state, DrawQuad::TILED_CONTENT, rect, | 31 DrawQuad::SetAll(shared_quad_state, DrawQuad::TILED_CONTENT, rect, |
39 opaque_rect, visible_rect, needs_blending); | 32 opaque_rect, visible_rect, needs_blending, anti_aliasing); |
40 this->resource_id = resource_id; | 33 this->resource_id = resource_id; |
41 this->tex_coord_rect = tex_coord_rect; | 34 this->tex_coord_rect = tex_coord_rect; |
42 this->texture_size = texture_size; | 35 this->texture_size = texture_size; |
43 this->swizzle_contents = swizzle_contents; | 36 this->swizzle_contents = swizzle_contents; |
44 this->left_edge_aa = left_edge_aa; | |
45 this->top_edge_aa = top_edge_aa; | |
46 this->right_edge_aa = right_edge_aa; | |
47 this->bottom_edge_aa = bottom_edge_aa; | |
48 | 37 |
49 // Override needs_blending after initializing the quad. | 38 // Override needs_blending after initializing the quad. |
50 this->needs_blending = IsAntialiased(); | 39 this->needs_blending = IsAntialiased(); |
51 } | 40 } |
52 | 41 |
53 void TileDrawQuad::SetAll(const SharedQuadState* shared_quad_state, | 42 void TileDrawQuad::SetAll(const SharedQuadState* shared_quad_state, |
54 gfx::Rect rect, | 43 gfx::Rect rect, |
55 gfx::Rect opaque_rect, | 44 gfx::Rect opaque_rect, |
56 gfx::Rect visible_rect, | 45 gfx::Rect visible_rect, |
57 bool needs_blending, | 46 bool needs_blending, |
| 47 AntiAliasing anti_aliasing, |
58 unsigned resource_id, | 48 unsigned resource_id, |
59 const gfx::RectF& tex_coord_rect, | 49 const gfx::RectF& tex_coord_rect, |
60 gfx::Size texture_size, | 50 gfx::Size texture_size, |
61 bool swizzle_contents, | 51 bool swizzle_contents) { |
62 bool left_edge_aa, | |
63 bool top_edge_aa, | |
64 bool right_edge_aa, | |
65 bool bottom_edge_aa) { | |
66 DrawQuad::SetAll(shared_quad_state, DrawQuad::TILED_CONTENT, rect, | 52 DrawQuad::SetAll(shared_quad_state, DrawQuad::TILED_CONTENT, rect, |
67 opaque_rect, visible_rect, needs_blending); | 53 opaque_rect, visible_rect, needs_blending, anti_aliasing); |
68 this->resource_id = resource_id; | 54 this->resource_id = resource_id; |
69 this->tex_coord_rect = tex_coord_rect; | 55 this->tex_coord_rect = tex_coord_rect; |
70 this->texture_size = texture_size; | 56 this->texture_size = texture_size; |
71 this->swizzle_contents = swizzle_contents; | 57 this->swizzle_contents = swizzle_contents; |
72 this->left_edge_aa = left_edge_aa; | |
73 this->top_edge_aa = top_edge_aa; | |
74 this->right_edge_aa = right_edge_aa; | |
75 this->bottom_edge_aa = bottom_edge_aa; | |
76 } | 58 } |
77 | 59 |
78 const TileDrawQuad* TileDrawQuad::MaterialCast( | 60 const TileDrawQuad* TileDrawQuad::MaterialCast( |
79 const DrawQuad* quad) { | 61 const DrawQuad* quad) { |
80 DCHECK(quad->material == DrawQuad::TILED_CONTENT); | 62 DCHECK(quad->material == DrawQuad::TILED_CONTENT); |
81 return static_cast<const TileDrawQuad*>(quad); | 63 return static_cast<const TileDrawQuad*>(quad); |
82 } | 64 } |
83 | 65 |
84 } // namespace cc | 66 } // namespace cc |
OLD | NEW |