| OLD | NEW |
| 1 // Copyright 2012 The Chromium Authors. All rights reserved. | 1 // Copyright 2012 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_TILE_H_ | 5 #ifndef CC_RESOURCES_TILE_H_ |
| 6 #define CC_RESOURCES_TILE_H_ | 6 #define CC_RESOURCES_TILE_H_ |
| 7 | 7 |
| 8 #include "base/memory/ref_counted.h" | 8 #include "base/memory/ref_counted.h" |
| 9 #include "cc/base/ref_counted_managed.h" | 9 #include "cc/base/ref_counted_managed.h" |
| 10 #include "cc/resources/managed_tile_state.h" | 10 #include "cc/resources/managed_tile_state.h" |
| 11 #include "cc/resources/raster_source.h" | 11 #include "cc/resources/raster_source.h" |
| 12 #include "cc/resources/tile_priority.h" | 12 #include "cc/resources/tile_priority.h" |
| 13 #include "ui/gfx/geometry/rect.h" | 13 #include "ui/gfx/geometry/rect.h" |
| 14 #include "ui/gfx/geometry/size.h" | 14 #include "ui/gfx/geometry/size.h" |
| 15 | 15 |
| 16 namespace cc { | 16 namespace cc { |
| 17 | 17 |
| 18 class TileManager; | 18 class TileManager; |
| 19 | 19 |
| 20 class CC_EXPORT Tile : public RefCountedManaged<Tile> { | 20 class CC_EXPORT Tile : public RefCountedManaged<Tile> { |
| 21 public: | 21 public: |
| 22 enum TileRasterFlags { USE_PICTURE_ANALYSIS = 1 << 0 }; | 22 enum TileRasterFlags { |
| 23 USE_PICTURE_ANALYSIS = 1 << 0, |
| 24 IS_OPAQUE = 1 << 1, |
| 25 FREQUENTLY_INVALIDATED = 1 << 2 |
| 26 }; |
| 23 | 27 |
| 24 typedef uint64 Id; | 28 typedef uint64 Id; |
| 25 | 29 |
| 26 Id id() const { | 30 Id id() const { |
| 27 return id_; | 31 return id_; |
| 28 } | 32 } |
| 29 | 33 |
| 30 RasterSource* raster_source() { return raster_source_.get(); } | 34 RasterSource* raster_source() { return raster_source_.get(); } |
| 31 | 35 |
| 32 const RasterSource* raster_source() const { return raster_source_.get(); } | 36 const RasterSource* raster_source() const { return raster_source_.get(); } |
| (...skipping 56 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 89 } | 93 } |
| 90 bool required_for_draw() const { return required_for_draw_; } | 94 bool required_for_draw() const { return required_for_draw_; } |
| 91 void set_required_for_draw(bool is_required) { | 95 void set_required_for_draw(bool is_required) { |
| 92 required_for_draw_ = is_required; | 96 required_for_draw_ = is_required; |
| 93 } | 97 } |
| 94 | 98 |
| 95 bool use_picture_analysis() const { | 99 bool use_picture_analysis() const { |
| 96 return !!(flags_ & USE_PICTURE_ANALYSIS); | 100 return !!(flags_ & USE_PICTURE_ANALYSIS); |
| 97 } | 101 } |
| 98 | 102 |
| 103 bool frequently_invalidated() const { |
| 104 return !!(flags_ & FREQUENTLY_INVALIDATED); |
| 105 } |
| 106 |
| 99 bool HasResources() const { return managed_state_.draw_info.has_resource(); } | 107 bool HasResources() const { return managed_state_.draw_info.has_resource(); } |
| 100 bool NeedsRaster() const { | 108 bool NeedsRaster() const { |
| 101 return managed_state_.draw_info.mode() == | 109 return managed_state_.draw_info.mode() == |
| 102 ManagedTileState::DrawInfo::PICTURE_PILE_MODE || | 110 ManagedTileState::DrawInfo::PICTURE_PILE_MODE || |
| 103 !managed_state_.draw_info.IsReadyToDraw(); | 111 !managed_state_.draw_info.IsReadyToDraw(); |
| 104 } | 112 } |
| 105 | 113 |
| 106 void AsValueInto(base::debug::TracedValue* dict) const; | 114 void AsValueInto(base::debug::TracedValue* dict) const; |
| 107 | 115 |
| 108 inline bool IsReadyToDraw() const { | 116 inline bool IsReadyToDraw() const { |
| 109 return managed_state_.draw_info.IsReadyToDraw(); | 117 return managed_state_.draw_info.IsReadyToDraw(); |
| 110 } | 118 } |
| 111 | 119 |
| 112 const ManagedTileState::DrawInfo& draw_info() const { | 120 const ManagedTileState::DrawInfo& draw_info() const { |
| 113 return managed_state_.draw_info; | 121 return managed_state_.draw_info; |
| 114 } | 122 } |
| 115 | 123 |
| 116 ManagedTileState::DrawInfo& draw_info() { return managed_state_.draw_info; } | 124 ManagedTileState::DrawInfo& draw_info() { return managed_state_.draw_info; } |
| 117 | 125 |
| 126 bool IsOpaque() const { return !!(flags_ & IS_OPAQUE); } |
| 127 |
| 118 float contents_scale() const { return contents_scale_; } | 128 float contents_scale() const { return contents_scale_; } |
| 119 gfx::Rect content_rect() const { return content_rect_; } | 129 gfx::Rect content_rect() const { return content_rect_; } |
| 120 | 130 |
| 121 int layer_id() const { return layer_id_; } | 131 int layer_id() const { return layer_id_; } |
| 122 | 132 |
| 123 int source_frame_number() const { return source_frame_number_; } | 133 int source_frame_number() const { return source_frame_number_; } |
| 124 | 134 |
| 125 void set_raster_source(scoped_refptr<RasterSource> raster_source) { | 135 void set_raster_source(scoped_refptr<RasterSource> raster_source) { |
| 126 DCHECK(raster_source->CoversRect(content_rect_, contents_scale_)) | 136 DCHECK(raster_source->CoversRect(content_rect_, contents_scale_)) |
| 127 << "Recording rect: " | 137 << "Recording rect: " |
| (...skipping 56 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 184 | 194 |
| 185 Id id_; | 195 Id id_; |
| 186 static Id s_next_id_; | 196 static Id s_next_id_; |
| 187 | 197 |
| 188 DISALLOW_COPY_AND_ASSIGN(Tile); | 198 DISALLOW_COPY_AND_ASSIGN(Tile); |
| 189 }; | 199 }; |
| 190 | 200 |
| 191 } // namespace cc | 201 } // namespace cc |
| 192 | 202 |
| 193 #endif // CC_RESOURCES_TILE_H_ | 203 #endif // CC_RESOURCES_TILE_H_ |
| OLD | NEW |