Chromium Code Reviews| 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_); |
|
vmpstr
2013/04/04 22:30:00
Should we change PlatformColor functions to be hac
enne (OOO)
2013/04/04 22:37:28
I'm pretty indifferent on this. hacker style is o
| |
| 56 } | |
| 57 | |
| 58 void set_resource_format(GLenum format) { | |
| 59 resource_format_ = format; | |
| 55 } | 60 } |
| 56 | 61 |
| 57 bool requires_resource() const { | 62 bool requires_resource() const { |
| 58 return mode_ == RESOURCE_MODE || | 63 return mode_ == RESOURCE_MODE || |
| 59 mode_ == PICTURE_PILE_MODE; | 64 mode_ == PICTURE_PILE_MODE; |
| 60 } | 65 } |
| 61 | 66 |
| 62 scoped_ptr<ResourcePool::Resource>& GetResourceForTesting() { | 67 scoped_ptr<ResourcePool::Resource>& GetResourceForTesting() { |
| 63 return resource_; | 68 return resource_; |
| 64 } | 69 } |
| (...skipping 12 matching lines...) Expand all Loading... | |
| 77 | 82 |
| 78 void set_solid_color(const SkColor& color) { | 83 void set_solid_color(const SkColor& color) { |
| 79 mode_ = SOLID_COLOR_MODE; | 84 mode_ = SOLID_COLOR_MODE; |
| 80 solid_color_ = color; | 85 solid_color_ = color; |
| 81 } | 86 } |
| 82 | 87 |
| 83 void set_rasterize_on_demand() { | 88 void set_rasterize_on_demand() { |
| 84 mode_ = PICTURE_PILE_MODE; | 89 mode_ = PICTURE_PILE_MODE; |
| 85 } | 90 } |
| 86 | 91 |
| 87 void set_contents_swizzled(bool contents_swizzled) { | |
| 88 contents_swizzled_ = contents_swizzled; | |
| 89 } | |
| 90 | |
| 91 Mode mode_; | 92 Mode mode_; |
| 92 SkColor solid_color_; | 93 SkColor solid_color_; |
| 93 | 94 |
| 94 scoped_ptr<ResourcePool::Resource> resource_; | 95 scoped_ptr<ResourcePool::Resource> resource_; |
| 95 bool resource_is_being_initialized_; | 96 bool resource_is_being_initialized_; |
| 96 bool can_be_freed_; | 97 bool can_be_freed_; |
| 97 bool contents_swizzled_; | 98 GLenum resource_format_; |
|
enne (OOO)
2013/04/04 22:37:28
Is this different than resource_->format()?
| |
| 98 }; | 99 }; |
| 99 | 100 |
| 100 | 101 |
| 101 ManagedTileState(); | 102 ManagedTileState(); |
| 102 ~ManagedTileState(); | 103 ~ManagedTileState(); |
| 103 scoped_ptr<base::Value> AsValue() const; | 104 scoped_ptr<base::Value> AsValue() const; |
| 104 | 105 |
| 105 // Persisted state: valid all the time. | 106 // Persisted state: valid all the time. |
| 106 bool can_use_gpu_memory; | 107 bool can_use_gpu_memory; |
| 107 bool need_to_gather_pixel_refs; | 108 bool need_to_gather_pixel_refs; |
| (...skipping 11 matching lines...) Expand all Loading... | |
| 119 // to determine policy. | 120 // to determine policy. |
| 120 TileManagerBin gpu_memmgr_stats_bin; | 121 TileManagerBin gpu_memmgr_stats_bin; |
| 121 TileResolution resolution; | 122 TileResolution resolution; |
| 122 float time_to_needed_in_seconds; | 123 float time_to_needed_in_seconds; |
| 123 float distance_to_visible_in_pixels; | 124 float distance_to_visible_in_pixels; |
| 124 }; | 125 }; |
| 125 | 126 |
| 126 } // namespace cc | 127 } // namespace cc |
| 127 | 128 |
| 128 #endif // CC_RESOURCES_MANAGED_TILE_STATE_H_ | 129 #endif // CC_RESOURCES_MANAGED_TILE_STATE_H_ |
| OLD | NEW |