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(const SharedQuadState*, const gfx::Re
ct& quadRect, const gfx::Rect& opaqueRect, unsigned resourceId, const gfx::RectF
& texCoordRect, const gfx::Size& textureSize, bool swizzleContents, bool leftEdg
eAA, bool topEdgeAA, bool rightEdgeAA, bool bottomEdgeAA); | 19 static scoped_ptr<TileDrawQuad> Create(); |
20 | 20 |
21 unsigned resourceId() const { return m_resourceId; } | 21 void SetNew(const SharedQuadState* shared_quad_state, |
22 gfx::RectF texCoordRect() const { return m_texCoordRect; } | 22 gfx::Rect rect, |
23 gfx::Size textureSize() const { return m_textureSize; } | 23 gfx::Rect opaque_rect, |
24 bool swizzleContents() const { return m_swizzleContents; } | 24 unsigned resource_id, |
| 25 const gfx::RectF& tex_coord_rect, |
| 26 gfx::Size texture_size, |
| 27 bool swizzle_contents, |
| 28 bool left_edge_aa, |
| 29 bool top_edge_aa, |
| 30 bool right_edge_aa, |
| 31 bool bottom_edge_aa); |
25 | 32 |
26 // TODO(danakj): Stick the data used to compute these things in the quad | 33 void SetAll(const SharedQuadState* shared_quad_state, |
27 // instead so the parent compositor can decide to use AA on its own. | 34 gfx::Rect rect, |
28 bool leftEdgeAA() const { return m_leftEdgeAA; } | 35 gfx::Rect opaque_rect, |
29 bool topEdgeAA() const { return m_topEdgeAA; } | 36 gfx::Rect visible_rect, |
30 bool rightEdgeAA() const { return m_rightEdgeAA; } | 37 bool needs_blending, |
31 bool bottomEdgeAA() const { return m_bottomEdgeAA; } | 38 unsigned resource_id, |
| 39 const gfx::RectF& tex_coord_rect, |
| 40 gfx::Size texture_size, |
| 41 bool swizzle_contents, |
| 42 bool left_edge_aa, |
| 43 bool top_edge_aa, |
| 44 bool right_edge_aa, |
| 45 bool bottom_edge_aa); |
32 | 46 |
33 bool isAntialiased() const { return leftEdgeAA() || topEdgeAA() || rightEdge
AA() || bottomEdgeAA(); } | 47 unsigned resource_id; |
| 48 gfx::RectF tex_coord_rect; |
| 49 gfx::Size texture_size; |
| 50 bool swizzle_contents; |
34 | 51 |
35 static const TileDrawQuad* materialCast(const DrawQuad*); | 52 // TODO(danakj): Stick the data used to compute these things in the quad |
36 private: | 53 // instead so the parent compositor can decide to use AA on its own. |
37 TileDrawQuad(const SharedQuadState*, const gfx::Rect& quadRect, const gfx::R
ect& opaqueRect, unsigned resourceId, const gfx::RectF& texCoordRect, const gfx:
:Size& textureSize, bool swizzleContents, bool leftEdgeAA, bool topEdgeAA, bool
rightEdgeAA, bool bottomEdgeAA); | 54 bool left_edge_aa; |
| 55 bool top_edge_aa; |
| 56 bool right_edge_aa; |
| 57 bool bottom_edge_aa; |
38 | 58 |
39 unsigned m_resourceId; | 59 bool IsAntialiased() const { |
40 gfx::RectF m_texCoordRect; | 60 return left_edge_aa || top_edge_aa || right_edge_aa || bottom_edge_aa; |
41 gfx::Size m_textureSize; | 61 } |
42 bool m_swizzleContents; | 62 |
43 bool m_leftEdgeAA; | 63 static const TileDrawQuad* MaterialCast(const DrawQuad*); |
44 bool m_topEdgeAA; | 64 private: |
45 bool m_rightEdgeAA; | 65 TileDrawQuad(); |
46 bool m_bottomEdgeAA; | |
47 }; | 66 }; |
48 | 67 |
49 } | 68 } |
50 | 69 |
51 #endif // CC_TILE_DRAW_QUAD_H_ | 70 #endif // CC_TILE_DRAW_QUAD_H_ |
OLD | NEW |