| 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 #include "cc/resources/picture_pile.h" | 5 #include "cc/resources/picture_pile.h" |
| 6 | 6 |
| 7 #include <algorithm> | 7 #include <algorithm> |
| 8 #include <limits> | 8 #include <limits> |
| 9 #include <vector> | 9 #include <vector> |
| 10 | 10 |
| (...skipping 132 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 143 | 143 |
| 144 PicturePile::PicturePile() : is_suitable_for_gpu_rasterization_(true) {} | 144 PicturePile::PicturePile() : is_suitable_for_gpu_rasterization_(true) {} |
| 145 | 145 |
| 146 PicturePile::~PicturePile() { | 146 PicturePile::~PicturePile() { |
| 147 } | 147 } |
| 148 | 148 |
| 149 bool PicturePile::Update(ContentLayerClient* painter, | 149 bool PicturePile::Update(ContentLayerClient* painter, |
| 150 SkColor background_color, | 150 SkColor background_color, |
| 151 bool contents_opaque, | 151 bool contents_opaque, |
| 152 bool contents_fill_bounds_completely, | 152 bool contents_fill_bounds_completely, |
| 153 bool can_use_lcd_text, |
| 153 const Region& invalidation, | 154 const Region& invalidation, |
| 154 const gfx::Rect& visible_layer_rect, | 155 const gfx::Rect& visible_layer_rect, |
| 155 int frame_number, | 156 int frame_number, |
| 156 Picture::RecordingMode recording_mode, | 157 Picture::RecordingMode recording_mode, |
| 157 RenderingStatsInstrumentation* stats_instrumentation) { | 158 RenderingStatsInstrumentation* stats_instrumentation) { |
| 158 background_color_ = background_color; | 159 background_color_ = background_color; |
| 159 contents_opaque_ = contents_opaque; | 160 contents_opaque_ = contents_opaque; |
| 160 contents_fill_bounds_completely_ = contents_fill_bounds_completely; | 161 contents_fill_bounds_completely_ = contents_fill_bounds_completely; |
| 161 | 162 |
| 162 gfx::Rect interest_rect = visible_layer_rect; | 163 gfx::Rect interest_rect = visible_layer_rect; |
| (...skipping 73 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 236 bool gather_pixel_refs = num_raster_threads > 1; | 237 bool gather_pixel_refs = num_raster_threads > 1; |
| 237 | 238 |
| 238 { | 239 { |
| 239 base::TimeDelta best_duration = base::TimeDelta::Max(); | 240 base::TimeDelta best_duration = base::TimeDelta::Max(); |
| 240 for (int i = 0; i < repeat_count; i++) { | 241 for (int i = 0; i < repeat_count; i++) { |
| 241 base::TimeTicks start_time = stats_instrumentation->StartRecording(); | 242 base::TimeTicks start_time = stats_instrumentation->StartRecording(); |
| 242 picture = Picture::Create(record_rect, | 243 picture = Picture::Create(record_rect, |
| 243 painter, | 244 painter, |
| 244 tile_grid_info_, | 245 tile_grid_info_, |
| 245 gather_pixel_refs, | 246 gather_pixel_refs, |
| 247 can_use_lcd_text, |
| 246 num_raster_threads, | 248 num_raster_threads, |
| 247 recording_mode); | 249 recording_mode); |
| 248 // Note the '&&' with previous is-suitable state. | 250 // Note the '&&' with previous is-suitable state. |
| 249 // This means that once a picture-pile becomes unsuitable for gpu | 251 // This means that once a picture-pile becomes unsuitable for gpu |
| 250 // rasterization due to some content, it will continue to be unsuitable | 252 // rasterization due to some content, it will continue to be unsuitable |
| 251 // even if that content is replaced by gpu-friendly content. | 253 // even if that content is replaced by gpu-friendly content. |
| 252 // This is an optimization to avoid iterating though all pictures in | 254 // This is an optimization to avoid iterating though all pictures in |
| 253 // the pile after each invalidation. | 255 // the pile after each invalidation. |
| 254 is_suitable_for_gpu_rasterization_ &= | 256 is_suitable_for_gpu_rasterization_ &= |
| 255 picture->IsSuitableForGpuRasterization(); | 257 picture->IsSuitableForGpuRasterization(); |
| (...skipping 21 matching lines...) Expand all Loading... |
| 277 } | 279 } |
| 278 DCHECK(found_tile_for_recorded_picture); | 280 DCHECK(found_tile_for_recorded_picture); |
| 279 } | 281 } |
| 280 | 282 |
| 281 has_any_recordings_ = true; | 283 has_any_recordings_ = true; |
| 282 DCHECK(CanRasterSlowTileCheck(recorded_viewport_)); | 284 DCHECK(CanRasterSlowTileCheck(recorded_viewport_)); |
| 283 return true; | 285 return true; |
| 284 } | 286 } |
| 285 | 287 |
| 286 } // namespace cc | 288 } // namespace cc |
| OLD | NEW |