| 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 "base/memory/scoped_ptr.h" | 8 #include "base/memory/scoped_ptr.h" |
| 9 #include "cc/resources/platform_color.h" | 9 #include "cc/resources/platform_color.h" |
| 10 #include "cc/resources/raster_worker_pool.h" | 10 #include "cc/resources/raster_worker_pool.h" |
| (...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 62 | 62 |
| 63 bool contents_swizzled() const { | 63 bool contents_swizzled() const { |
| 64 DCHECK(resource_); | 64 DCHECK(resource_); |
| 65 return !PlatformColor::SameComponentOrder(resource_->format()); | 65 return !PlatformColor::SameComponentOrder(resource_->format()); |
| 66 } | 66 } |
| 67 | 67 |
| 68 bool requires_resource() const { | 68 bool requires_resource() const { |
| 69 return mode_ == RESOURCE_MODE || mode_ == PICTURE_PILE_MODE; | 69 return mode_ == RESOURCE_MODE || mode_ == PICTURE_PILE_MODE; |
| 70 } | 70 } |
| 71 | 71 |
| 72 inline bool has_resource() const { return !!resource_; } |
| 73 |
| 72 size_t GPUMemoryUsageInBytes() const; | 74 size_t GPUMemoryUsageInBytes() const; |
| 73 | 75 |
| 74 void SetSolidColorForTesting(SkColor color) { set_solid_color(color); } | 76 void SetSolidColorForTesting(SkColor color) { set_solid_color(color); } |
| 75 void SetHasTextForTesting(bool has_text) { has_text_ = has_text; } | 77 void SetHasTextForTesting(bool has_text) { has_text_ = has_text; } |
| 78 void SetResourceForTesting(scoped_ptr<ScopedResource> resource) { |
| 79 resource_ = resource.Pass(); |
| 80 } |
| 76 | 81 |
| 77 private: | 82 private: |
| 78 friend class TileManager; | 83 friend class TileManager; |
| 79 friend class PrioritizedTileSet; | 84 friend class PrioritizedTileSet; |
| 80 friend class Tile; | 85 friend class Tile; |
| 81 friend class ManagedTileState; | 86 friend class ManagedTileState; |
| 82 | 87 |
| 83 void set_use_resource() { mode_ = RESOURCE_MODE; } | 88 void set_use_resource() { mode_ = RESOURCE_MODE; } |
| 84 | 89 |
| 85 void set_solid_color(const SkColor& color) { | 90 void set_solid_color(const SkColor& color) { |
| (...skipping 29 matching lines...) Expand all Loading... |
| 115 float distance_to_visible; | 120 float distance_to_visible; |
| 116 bool visible_and_ready_to_draw; | 121 bool visible_and_ready_to_draw; |
| 117 | 122 |
| 118 // Priority for this state from the last time we assigned memory. | 123 // Priority for this state from the last time we assigned memory. |
| 119 unsigned scheduled_priority; | 124 unsigned scheduled_priority; |
| 120 }; | 125 }; |
| 121 | 126 |
| 122 } // namespace cc | 127 } // namespace cc |
| 123 | 128 |
| 124 #endif // CC_RESOURCES_MANAGED_TILE_STATE_H_ | 129 #endif // CC_RESOURCES_MANAGED_TILE_STATE_H_ |
| OLD | NEW |