OLD | NEW |
---|---|
(Empty) | |
1 // Copyright 2013 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. | |
4 | |
5 #ifndef CC_TILE_DRAWING_INFO_H_ | |
6 #define CC_TILE_DRAWING_INFO_H_ | |
7 | |
8 #include "cc/resource_provider.h" | |
9 #include "cc/tile_manager.h" | |
10 | |
11 namespace cc { | |
12 | |
13 class CC_EXPORT TileDrawingInfo { | |
14 public: | |
15 enum Mode { | |
16 TEXTURE_MODE, | |
17 SOLID_COLOR_MODE, | |
18 TRANSPARENT_MODE, | |
19 PICTURE_PILE_MODE, | |
20 NUM_MODES | |
21 }; | |
22 | |
23 TileDrawingInfo() | |
24 : mode_(TEXTURE_MODE), | |
25 initializing_resource_(false), | |
26 can_be_freed_(true), | |
27 contents_swizzled_(false) {} | |
28 | |
29 Mode mode() const { | |
30 return mode_; | |
31 } | |
32 | |
33 bool IsReadyToDraw() const; | |
34 | |
35 ResourceProvider::ResourceId get_resource_id() const { | |
36 DCHECK(mode_ == TEXTURE_MODE); | |
37 DCHECK(resource_); | |
38 DCHECK(!initializing_resource_); | |
39 return resource_->id(); | |
40 } | |
41 | |
42 SkColor get_solid_color() const { | |
43 DCHECK(mode_ == SOLID_COLOR_MODE); | |
44 | |
45 return solid_color_; | |
46 } | |
47 | |
48 bool contents_swizzled() const { | |
49 return contents_swizzled_; | |
50 } | |
51 | |
52 private: | |
53 friend class TileManager; | |
54 | |
55 void set_transparent() { | |
56 mode_ = TRANSPARENT_MODE; | |
57 } | |
58 | |
59 void set_solid_color(const SkColor& color) { | |
60 mode_ = SOLID_COLOR_MODE; | |
61 solid_color_ = color; | |
62 } | |
63 | |
64 Mode mode_; | |
65 SkColor solid_color_; | |
66 | |
67 scoped_ptr<ResourcePool::Resource> resource_; | |
68 bool initializing_resource_; | |
reveman
2013/03/07 22:02:14
is there a good reason for not calling this resour
| |
69 bool can_be_freed_; | |
70 bool contents_swizzled_; | |
71 }; | |
72 | |
73 } // namespace cc | |
74 | |
75 #endif // CC_TILE_DRAWING_INFO_H_ | |
OLD | NEW |