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_H_ | 5 #ifndef CC_TILE_H_ |
6 #define CC_TILE_H_ | 6 #define CC_TILE_H_ |
7 | 7 |
8 #include "base/memory/ref_counted.h" | 8 #include "base/memory/ref_counted.h" |
9 #include "base/memory/scoped_ptr.h" | 9 #include "base/memory/scoped_ptr.h" |
10 #include "base/memory/scoped_vector.h" | 10 #include "base/memory/scoped_vector.h" |
(...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
53 // Returns 0 if not drawable. | 53 // Returns 0 if not drawable. |
54 ResourceProvider::ResourceId GetResourceId() const { | 54 ResourceProvider::ResourceId GetResourceId() const { |
55 if (!managed_state_.resource) | 55 if (!managed_state_.resource) |
56 return 0; | 56 return 0; |
57 if (managed_state_.resource_is_being_initialized) | 57 if (managed_state_.resource_is_being_initialized) |
58 return 0; | 58 return 0; |
59 | 59 |
60 return managed_state_.resource->id(); | 60 return managed_state_.resource->id(); |
61 } | 61 } |
62 | 62 |
| 63 bool is_ready_to_draw() const { |
| 64 return GetResourceId() != 0 || |
| 65 is_solid_color_ || |
| 66 is_transparent_; |
| 67 } |
| 68 |
| 69 bool is_solid_color() const { |
| 70 return is_solid_color_; |
| 71 } |
| 72 |
| 73 void set_solid_color(const SkColor& color) { |
| 74 is_solid_color_ = true; |
| 75 solid_color_ = color; |
| 76 } |
| 77 |
| 78 bool is_transparent() const { |
| 79 return is_transparent_; |
| 80 } |
| 81 |
| 82 void set_transparent(bool flag) { |
| 83 is_transparent_ = flag; |
| 84 } |
| 85 |
| 86 SkColor get_solid_color() const { |
| 87 return solid_color_; |
| 88 } |
| 89 |
| 90 void set_cheap(bool flag) { |
| 91 is_cheap_ = flag; |
| 92 } |
| 93 |
| 94 bool is_cheap() const { |
| 95 return is_cheap_; |
| 96 } |
| 97 |
63 const gfx::Rect& opaque_rect() const { return opaque_rect_; } | 98 const gfx::Rect& opaque_rect() const { return opaque_rect_; } |
64 | 99 |
65 bool contents_swizzled() const { return managed_state_.contents_swizzled; } | 100 bool contents_swizzled() const { return managed_state_.contents_swizzled; } |
66 | 101 |
67 float contents_scale() const { return contents_scale_; } | 102 float contents_scale() const { return contents_scale_; } |
68 gfx::Rect content_rect() const { return content_rect_; } | 103 gfx::Rect content_rect() const { return content_rect_; } |
69 | 104 |
70 void set_picture_pile(scoped_refptr<PicturePileImpl> pile) { | 105 void set_picture_pile(scoped_refptr<PicturePileImpl> pile) { |
71 picture_pile_ = pile; | 106 picture_pile_ = pile; |
72 } | 107 } |
(...skipping 20 matching lines...) Expand all Loading... |
93 TileManager* tile_manager_; | 128 TileManager* tile_manager_; |
94 scoped_refptr<PicturePileImpl> picture_pile_; | 129 scoped_refptr<PicturePileImpl> picture_pile_; |
95 gfx::Rect tile_size_; | 130 gfx::Rect tile_size_; |
96 GLenum format_; | 131 GLenum format_; |
97 gfx::Rect content_rect_; | 132 gfx::Rect content_rect_; |
98 float contents_scale_; | 133 float contents_scale_; |
99 gfx::Rect opaque_rect_; | 134 gfx::Rect opaque_rect_; |
100 | 135 |
101 TilePriority priority_[NUM_BIN_PRIORITIES]; | 136 TilePriority priority_[NUM_BIN_PRIORITIES]; |
102 ManagedTileState managed_state_; | 137 ManagedTileState managed_state_; |
| 138 |
| 139 SkColor solid_color_; |
| 140 bool is_solid_color_; |
| 141 bool is_transparent_; |
| 142 bool is_cheap_; |
103 }; | 143 }; |
104 | 144 |
105 } // namespace cc | 145 } // namespace cc |
106 | 146 |
107 #endif // CC_TILE_H_ | 147 #endif // CC_TILE_H_ |
OLD | NEW |