OLD | NEW |
1 // Copyright 2013 The Chromium Authors. All rights reserved. | 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 | 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_RESOURCES_MANAGED_TILE_STATE_H_ | 5 #ifndef CC_RESOURCES_MANAGED_TILE_STATE_H_ |
6 #define CC_RESOURCES_MANAGED_TILE_STATE_H_ | 6 #define CC_RESOURCES_MANAGED_TILE_STATE_H_ |
7 | 7 |
8 #include <list> | 8 #include <list> |
9 | 9 |
10 #include "base/memory/scoped_ptr.h" | 10 #include "base/memory/scoped_ptr.h" |
| 11 #include "cc/resources/platform_color.h" |
11 #include "cc/resources/resource_pool.h" | 12 #include "cc/resources/resource_pool.h" |
12 #include "cc/resources/resource_provider.h" | 13 #include "cc/resources/resource_provider.h" |
13 #include "cc/resources/tile_manager.h" | 14 #include "cc/resources/tile_manager.h" |
14 | 15 |
15 namespace cc { | 16 namespace cc { |
16 | 17 |
17 // This is state that is specific to a tile that is | 18 // This is state that is specific to a tile that is |
18 // managed by the TileManager. | 19 // managed by the TileManager. |
19 class CC_EXPORT ManagedTileState { | 20 class CC_EXPORT ManagedTileState { |
20 public: | 21 public: |
(...skipping 23 matching lines...) Expand all Loading... |
44 return resource_->id(); | 45 return resource_->id(); |
45 } | 46 } |
46 | 47 |
47 SkColor get_solid_color() const { | 48 SkColor get_solid_color() const { |
48 DCHECK(mode_ == SOLID_COLOR_MODE); | 49 DCHECK(mode_ == SOLID_COLOR_MODE); |
49 | 50 |
50 return solid_color_; | 51 return solid_color_; |
51 } | 52 } |
52 | 53 |
53 bool contents_swizzled() const { | 54 bool contents_swizzled() const { |
54 return contents_swizzled_; | 55 return !PlatformColor::SameComponentOrder(resource_format_); |
55 } | 56 } |
56 | 57 |
57 bool requires_resource() const { | 58 bool requires_resource() const { |
58 return mode_ == RESOURCE_MODE || | 59 return mode_ == RESOURCE_MODE || |
59 mode_ == PICTURE_PILE_MODE; | 60 mode_ == PICTURE_PILE_MODE; |
60 } | 61 } |
61 | 62 |
62 scoped_ptr<ResourcePool::Resource>& GetResourceForTesting() { | 63 scoped_ptr<ResourcePool::Resource>& GetResourceForTesting() { |
63 return resource_; | 64 return resource_; |
64 } | 65 } |
(...skipping 12 matching lines...) Expand all Loading... |
77 | 78 |
78 void set_solid_color(const SkColor& color) { | 79 void set_solid_color(const SkColor& color) { |
79 mode_ = SOLID_COLOR_MODE; | 80 mode_ = SOLID_COLOR_MODE; |
80 solid_color_ = color; | 81 solid_color_ = color; |
81 } | 82 } |
82 | 83 |
83 void set_rasterize_on_demand() { | 84 void set_rasterize_on_demand() { |
84 mode_ = PICTURE_PILE_MODE; | 85 mode_ = PICTURE_PILE_MODE; |
85 } | 86 } |
86 | 87 |
87 void set_contents_swizzled(bool contents_swizzled) { | |
88 contents_swizzled_ = contents_swizzled; | |
89 } | |
90 | |
91 Mode mode_; | 88 Mode mode_; |
92 SkColor solid_color_; | 89 SkColor solid_color_; |
93 | 90 |
94 scoped_ptr<ResourcePool::Resource> resource_; | 91 scoped_ptr<ResourcePool::Resource> resource_; |
95 bool resource_is_being_initialized_; | 92 bool resource_is_being_initialized_; |
96 bool can_be_freed_; | 93 bool can_be_freed_; |
97 bool contents_swizzled_; | 94 GLenum resource_format_; |
98 }; | 95 }; |
99 | 96 |
100 | 97 |
101 ManagedTileState(); | 98 ManagedTileState(); |
102 ~ManagedTileState(); | 99 ~ManagedTileState(); |
103 scoped_ptr<base::Value> AsValue() const; | 100 scoped_ptr<base::Value> AsValue() const; |
104 | 101 |
105 // Persisted state: valid all the time. | 102 // Persisted state: valid all the time. |
106 bool can_use_gpu_memory; | 103 bool can_use_gpu_memory; |
107 bool need_to_gather_pixel_refs; | 104 bool need_to_gather_pixel_refs; |
(...skipping 11 matching lines...) Expand all Loading... |
119 // to determine policy. | 116 // to determine policy. |
120 TileManagerBin gpu_memmgr_stats_bin; | 117 TileManagerBin gpu_memmgr_stats_bin; |
121 TileResolution resolution; | 118 TileResolution resolution; |
122 float time_to_needed_in_seconds; | 119 float time_to_needed_in_seconds; |
123 float distance_to_visible_in_pixels; | 120 float distance_to_visible_in_pixels; |
124 }; | 121 }; |
125 | 122 |
126 } // namespace cc | 123 } // namespace cc |
127 | 124 |
128 #endif // CC_RESOURCES_MANAGED_TILE_STATE_H_ | 125 #endif // CC_RESOURCES_MANAGED_TILE_STATE_H_ |
OLD | NEW |