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 "base/memory/scoped_ptr.h" | 9 #include "base/memory/scoped_ptr.h" |
10 #include "base/memory/scoped_vector.h" | 10 #include "base/memory/scoped_vector.h" |
11 #include "cc/base/ref_counted_managed.h" | 11 #include "cc/base/ref_counted_managed.h" |
12 #include "cc/resources/managed_tile_state.h" | 12 #include "cc/resources/managed_tile_state.h" |
13 #include "cc/resources/picture_pile_impl.h" | 13 #include "cc/resources/picture_pile_impl.h" |
14 #include "cc/resources/raster_mode.h" | 14 #include "cc/resources/raster_mode.h" |
15 #include "cc/resources/tile_priority.h" | 15 #include "cc/resources/tile_priority.h" |
16 #include "ui/gfx/rect.h" | 16 #include "ui/gfx/rect.h" |
17 #include "ui/gfx/size.h" | 17 #include "ui/gfx/size.h" |
18 | 18 |
19 namespace cc { | 19 namespace cc { |
20 | 20 |
21 class CC_EXPORT Tile : public RefCountedManaged<Tile> { | 21 class CC_EXPORT Tile : public RefCountedManaged<Tile> { |
22 public: | 22 public: |
23 enum TileRasterFlags { USE_LCD_TEXT = 1 << 0, USE_PICTURE_ANALYSIS = 1 << 1 }; | 23 enum TileRasterFlags { USE_PICTURE_ANALYSIS = 1 << 0 }; |
24 | 24 |
25 typedef uint64 Id; | 25 typedef uint64 Id; |
26 | 26 |
27 Id id() const { | 27 Id id() const { |
28 return id_; | 28 return id_; |
29 } | 29 } |
30 | 30 |
31 PicturePileImpl* picture_pile() { | 31 PicturePileImpl* picture_pile() { |
32 return picture_pile_.get(); | 32 return picture_pile_.get(); |
33 } | 33 } |
(...skipping 25 matching lines...) Expand all Loading... | |
59 } | 59 } |
60 | 60 |
61 void SetPriority(WhichTree tree, const TilePriority& priority); | 61 void SetPriority(WhichTree tree, const TilePriority& priority); |
62 | 62 |
63 void MarkRequiredForActivation(); | 63 void MarkRequiredForActivation(); |
64 | 64 |
65 bool required_for_activation() const { | 65 bool required_for_activation() const { |
66 return priority_[PENDING_TREE].required_for_activation; | 66 return priority_[PENDING_TREE].required_for_activation; |
67 } | 67 } |
68 | 68 |
69 void set_can_use_lcd_text(bool can_use_lcd_text) { | |
70 if (can_use_lcd_text) | |
71 flags_ |= USE_LCD_TEXT; | |
72 else | |
73 flags_ &= ~USE_LCD_TEXT; | |
74 } | |
75 | |
76 bool can_use_lcd_text() const { | |
77 return !!(flags_ & USE_LCD_TEXT); | |
78 } | |
79 | |
80 bool use_picture_analysis() const { | 69 bool use_picture_analysis() const { |
81 return !!(flags_ & USE_PICTURE_ANALYSIS); | 70 return !!(flags_ & USE_PICTURE_ANALYSIS); |
82 } | 71 } |
83 | 72 |
84 bool NeedsRasterForMode(RasterMode mode) const { | 73 bool NeedsRasterForMode(RasterMode mode) const { |
85 return !managed_state_.tile_versions[mode].IsReadyToDraw(); | 74 return !managed_state_.tile_versions[mode].IsReadyToDraw(); |
86 } | 75 } |
87 | 76 |
88 bool HasResources() const { | 77 bool HasResources() const { |
89 for (int mode = 0; mode < NUM_RASTER_MODES; ++mode) { | 78 for (int mode = 0; mode < NUM_RASTER_MODES; ++mode) { |
(...skipping 62 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
152 | 141 |
153 // Methods called by by tile manager. | 142 // Methods called by by tile manager. |
154 Tile(TileManager* tile_manager, | 143 Tile(TileManager* tile_manager, |
155 PicturePileImpl* picture_pile, | 144 PicturePileImpl* picture_pile, |
156 const gfx::Size& tile_size, | 145 const gfx::Size& tile_size, |
157 const gfx::Rect& content_rect, | 146 const gfx::Rect& content_rect, |
158 const gfx::Rect& opaque_rect, | 147 const gfx::Rect& opaque_rect, |
159 float contents_scale, | 148 float contents_scale, |
160 int layer_id, | 149 int layer_id, |
161 int source_frame_number, | 150 int source_frame_number, |
162 int flags); | 151 int flags); |
vmpstr
2014/06/11 18:36:26
Is this ever not 0 nowadays? It might be worth it
alokp
2014/06/11 20:02:05
We recently added a flag for picture analysis - US
| |
163 ~Tile(); | 152 ~Tile(); |
164 | 153 |
165 ManagedTileState& managed_state() { return managed_state_; } | 154 ManagedTileState& managed_state() { return managed_state_; } |
166 const ManagedTileState& managed_state() const { return managed_state_; } | 155 const ManagedTileState& managed_state() const { return managed_state_; } |
167 RasterMode DetermineRasterModeForResolution(TileResolution resolution) const; | 156 RasterMode DetermineRasterModeForResolution(TileResolution resolution) const; |
168 | 157 |
169 TileManager* tile_manager_; | 158 TileManager* tile_manager_; |
170 scoped_refptr<PicturePileImpl> picture_pile_; | 159 scoped_refptr<PicturePileImpl> picture_pile_; |
171 gfx::Rect tile_size_; | 160 gfx::Rect tile_size_; |
172 gfx::Rect content_rect_; | 161 gfx::Rect content_rect_; |
173 float contents_scale_; | 162 float contents_scale_; |
174 gfx::Rect opaque_rect_; | 163 gfx::Rect opaque_rect_; |
175 | 164 |
176 TilePriority priority_[NUM_TREES]; | 165 TilePriority priority_[NUM_TREES]; |
177 ManagedTileState managed_state_; | 166 ManagedTileState managed_state_; |
178 int layer_id_; | 167 int layer_id_; |
179 int source_frame_number_; | 168 int source_frame_number_; |
180 int flags_; | 169 int flags_; |
181 | 170 |
182 Id id_; | 171 Id id_; |
183 static Id s_next_id_; | 172 static Id s_next_id_; |
184 | 173 |
185 DISALLOW_COPY_AND_ASSIGN(Tile); | 174 DISALLOW_COPY_AND_ASSIGN(Tile); |
186 }; | 175 }; |
187 | 176 |
188 } // namespace cc | 177 } // namespace cc |
189 | 178 |
190 #endif // CC_RESOURCES_TILE_H_ | 179 #endif // CC_RESOURCES_TILE_H_ |
OLD | NEW |