Chromium Code Reviews| OLD | NEW |
|---|---|
| (Empty) | |
| 1 // found in the LICENSE file. | |
| 2 | |
| 3 #ifndef CC_TILE_DRAWING_INFO_H_ | |
| 4 #define CC_TILE_DRAWING_INFO_H_ | |
| 5 | |
| 6 #include "base/memory/scoped_ptr.h" | |
| 7 #include "cc/resource_pool.h" | |
| 8 #include "cc/resource_provider.h" | |
| 9 | |
| 10 namespace cc { | |
| 11 | |
| 12 class TileManager; | |
| 13 class ManagedTileState; | |
| 14 | |
| 15 class CC_EXPORT TileDrawingInfo { | |
|
nduca
2013/03/12 19:44:34
Maybe you should instead pull ManagedTileState out
reveman
2013/03/12 21:54:41
I like this idea. tile.h wouldn't have to include
| |
| 16 public: | |
| 17 enum Mode { | |
| 18 TEXTURE_MODE, | |
| 19 SOLID_COLOR_MODE, | |
| 20 TRANSPARENT_MODE, | |
|
nduca
2013/03/12 19:44:34
Yeah, basically I see this as a inner struct on Ma
| |
| 21 PICTURE_PILE_MODE, | |
| 22 NUM_MODES | |
| 23 }; | |
| 24 | |
| 25 TileDrawingInfo() | |
| 26 : mode_(TEXTURE_MODE), | |
| 27 resource_is_being_initialized_(false), | |
| 28 can_be_freed_(true), | |
| 29 contents_swizzled_(false) {} | |
| 30 | |
| 31 Mode mode() const { | |
| 32 return mode_; | |
| 33 } | |
| 34 | |
| 35 bool IsReadyToDraw() const; | |
| 36 | |
| 37 ResourceProvider::ResourceId get_resource_id() const { | |
| 38 DCHECK(mode_ == TEXTURE_MODE); | |
| 39 DCHECK(resource_); | |
| 40 DCHECK(!resource_is_being_initialized_); | |
| 41 return resource_->id(); | |
| 42 } | |
| 43 | |
| 44 SkColor get_solid_color() const { | |
| 45 DCHECK(mode_ == SOLID_COLOR_MODE); | |
| 46 | |
| 47 return solid_color_; | |
| 48 } | |
| 49 | |
| 50 bool contents_swizzled() const { | |
| 51 return contents_swizzled_; | |
| 52 } | |
| 53 | |
| 54 private: | |
| 55 friend class TileManager; | |
| 56 friend class ManagedTileState; | |
| 57 | |
| 58 void set_transparent() { | |
| 59 mode_ = TRANSPARENT_MODE; | |
| 60 } | |
| 61 | |
| 62 void set_solid_color(const SkColor& color) { | |
| 63 mode_ = SOLID_COLOR_MODE; | |
| 64 solid_color_ = color; | |
| 65 } | |
| 66 | |
| 67 Mode mode_; | |
| 68 SkColor solid_color_; | |
| 69 | |
| 70 scoped_ptr<ResourcePool::Resource> resource_; | |
| 71 bool resource_is_being_initialized_; | |
| 72 bool can_be_freed_; | |
| 73 bool contents_swizzled_; | |
| 74 }; | |
| 75 | |
| 76 } // namespace cc | |
| 77 | |
| 78 #endif // CC_TILE_DRAWING_INFO_H_ | |
| OLD | NEW |