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 #ifndef CC_TILE_DRAW_QUAD_H_ | 5 #ifndef CC_TILE_DRAW_QUAD_H_ |
6 #define CC_TILE_DRAW_QUAD_H_ | 6 #define CC_TILE_DRAW_QUAD_H_ |
7 | 7 |
8 #include "base/memory/scoped_ptr.h" | 8 #include "base/memory/scoped_ptr.h" |
9 #include "cc/cc_export.h" | 9 #include "cc/cc_export.h" |
10 #include "cc/draw_quad.h" | 10 #include "cc/draw_quad.h" |
11 #include "third_party/khronos/GLES2/gl2.h" | 11 #include "third_party/khronos/GLES2/gl2.h" |
12 #include "ui/gfx/point.h" | 12 #include "ui/gfx/point.h" |
13 #include "ui/gfx/size.h" | 13 #include "ui/gfx/size.h" |
14 | 14 |
15 namespace cc { | 15 namespace cc { |
16 | 16 |
17 class CC_EXPORT TileDrawQuad : public DrawQuad { | 17 class CC_EXPORT TileDrawQuad : public DrawQuad { |
18 public: | 18 public: |
19 static scoped_ptr<TileDrawQuad> Create(); | 19 static scoped_ptr<TileDrawQuad> Create(); |
20 | 20 |
21 void SetNew(const SharedQuadState* shared_quad_state, | 21 void SetNew(const SharedQuadState* shared_quad_state, |
22 gfx::Rect rect, | 22 gfx::Rect rect, |
23 gfx::Rect opaque_rect, | 23 gfx::Rect opaque_rect, |
24 unsigned resource_id, | 24 unsigned resource_id, |
25 const gfx::RectF& tex_coord_rect, | 25 const gfx::RectF& tex_coord_rect, |
26 gfx::Size texture_size, | 26 gfx::Size texture_size, |
27 bool swizzle_contents, | 27 bool swizzle_contents); |
28 bool left_edge_aa, | |
29 bool top_edge_aa, | |
30 bool right_edge_aa, | |
31 bool bottom_edge_aa); | |
32 | 28 |
33 void SetAll(const SharedQuadState* shared_quad_state, | 29 void SetAll(const SharedQuadState* shared_quad_state, |
34 gfx::Rect rect, | 30 gfx::Rect rect, |
35 gfx::Rect opaque_rect, | 31 gfx::Rect opaque_rect, |
36 gfx::Rect visible_rect, | 32 gfx::Rect visible_rect, |
37 bool needs_blending, | 33 bool needs_blending, |
38 unsigned resource_id, | 34 unsigned resource_id, |
39 const gfx::RectF& tex_coord_rect, | 35 const gfx::RectF& tex_coord_rect, |
40 gfx::Size texture_size, | 36 gfx::Size texture_size, |
41 bool swizzle_contents, | 37 bool swizzle_contents); |
42 bool left_edge_aa, | |
43 bool top_edge_aa, | |
44 bool right_edge_aa, | |
45 bool bottom_edge_aa); | |
46 | 38 |
47 unsigned resource_id; | 39 unsigned resource_id; |
48 gfx::RectF tex_coord_rect; | 40 gfx::RectF tex_coord_rect; |
49 gfx::Size texture_size; | 41 gfx::Size texture_size; |
50 bool swizzle_contents; | 42 bool swizzle_contents; |
51 | 43 |
52 // TODO(danakj): Stick the data used to compute these things in the quad | |
53 // instead so the parent compositor can decide to use AA on its own. | |
54 bool left_edge_aa; | |
55 bool top_edge_aa; | |
56 bool right_edge_aa; | |
57 bool bottom_edge_aa; | |
58 | |
59 bool IsAntialiased() const { | |
60 return left_edge_aa || top_edge_aa || right_edge_aa || bottom_edge_aa; | |
61 } | |
62 | |
63 virtual void IterateResources(const ResourceIteratorCallback& callback) | 44 virtual void IterateResources(const ResourceIteratorCallback& callback) |
64 OVERRIDE; | 45 OVERRIDE; |
65 | 46 |
66 static const TileDrawQuad* MaterialCast(const DrawQuad*); | 47 static const TileDrawQuad* MaterialCast(const DrawQuad*); |
67 private: | 48 private: |
68 TileDrawQuad(); | 49 TileDrawQuad(); |
69 }; | 50 }; |
70 | 51 |
71 } | 52 } |
72 | 53 |
73 #endif // CC_TILE_DRAW_QUAD_H_ | 54 #endif // CC_TILE_DRAW_QUAD_H_ |
OLD | NEW |