[email protected] | 0fb2500 | 2012-10-12 07:20:02 | [diff] [blame] | 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 |
| 3 | // found in the LICENSE file. |
[email protected] | cd57cc5a | 2012-10-12 22:43:41 | [diff] [blame] | 4 | |
[email protected] | 8fcbaa37 | 2012-11-05 04:12:41 | [diff] [blame] | 5 | #ifndef CC_TILE_DRAW_QUAD_H_ |
| 6 | #define CC_TILE_DRAW_QUAD_H_ |
[email protected] | cd57cc5a | 2012-10-12 22:43:41 | [diff] [blame] | 7 | |
[email protected] | cd57cc5a | 2012-10-12 22:43:41 | [diff] [blame] | 8 | #include "base/memory/scoped_ptr.h" |
[email protected] | 52347c84 | 2012-11-02 21:06:20 | [diff] [blame] | 9 | #include "cc/cc_export.h" |
[email protected] | aa0a9d3 | 2012-10-24 01:58:10 | [diff] [blame] | 10 | #include "cc/draw_quad.h" |
| 11 | #include "third_party/khronos/GLES2/gl2.h" |
[email protected] | 1fea814 | 2012-10-20 04:12:41 | [diff] [blame] | 12 | #include "ui/gfx/point.h" |
| 13 | #include "ui/gfx/size.h" |
[email protected] | cd57cc5a | 2012-10-12 22:43:41 | [diff] [blame] | 14 | |
| 15 | namespace cc { |
| 16 | |
[email protected] | 52347c84 | 2012-11-02 21:06:20 | [diff] [blame] | 17 | class CC_EXPORT TileDrawQuad : public DrawQuad { |
[email protected] | c22418b | 2012-11-20 23:06:26 | [diff] [blame] | 18 | public: |
| 19 | static scoped_ptr<TileDrawQuad> Create(); |
[email protected] | cd57cc5a | 2012-10-12 22:43:41 | [diff] [blame] | 20 | |
[email protected] | c22418b | 2012-11-20 23:06:26 | [diff] [blame] | 21 | void SetNew(const SharedQuadState* shared_quad_state, |
| 22 | gfx::Rect rect, |
| 23 | gfx::Rect opaque_rect, |
| 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); |
[email protected] | cd57cc5a | 2012-10-12 22:43:41 | [diff] [blame] | 32 | |
[email protected] | c22418b | 2012-11-20 23:06:26 | [diff] [blame] | 33 | void SetAll(const SharedQuadState* shared_quad_state, |
| 34 | gfx::Rect rect, |
| 35 | gfx::Rect opaque_rect, |
| 36 | gfx::Rect visible_rect, |
| 37 | bool needs_blending, |
| 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); |
[email protected] | cd57cc5a | 2012-10-12 22:43:41 | [diff] [blame] | 46 | |
[email protected] | c22418b | 2012-11-20 23:06:26 | [diff] [blame] | 47 | unsigned resource_id; |
| 48 | gfx::RectF tex_coord_rect; |
| 49 | gfx::Size texture_size; |
| 50 | bool swizzle_contents; |
[email protected] | cd57cc5a | 2012-10-12 22:43:41 | [diff] [blame] | 51 | |
[email protected] | c22418b | 2012-11-20 23:06:26 | [diff] [blame] | 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; |
[email protected] | cd57cc5a | 2012-10-12 22:43:41 | [diff] [blame] | 58 | |
[email protected] | c22418b | 2012-11-20 23:06:26 | [diff] [blame] | 59 | bool IsAntialiased() const { |
| 60 | return left_edge_aa || top_edge_aa || right_edge_aa || bottom_edge_aa; |
| 61 | } |
| 62 | |
| 63 | static const TileDrawQuad* MaterialCast(const DrawQuad*); |
| 64 | private: |
| 65 | TileDrawQuad(); |
[email protected] | cd57cc5a | 2012-10-12 22:43:41 | [diff] [blame] | 66 | }; |
| 67 | |
[email protected] | cd57cc5a | 2012-10-12 22:43:41 | [diff] [blame] | 68 | } |
| 69 | |
[email protected] | 8fcbaa37 | 2012-11-05 04:12:41 | [diff] [blame] | 70 | #endif // CC_TILE_DRAW_QUAD_H_ |