| 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 163 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 174 PicturePile::~PicturePile() { | 174 PicturePile::~PicturePile() { |
| 175 } | 175 } |
| 176 | 176 |
| 177 bool PicturePile::UpdateAndExpandInvalidation( | 177 bool PicturePile::UpdateAndExpandInvalidation( |
| 178 ContentLayerClient* painter, | 178 ContentLayerClient* painter, |
| 179 Region* invalidation, | 179 Region* invalidation, |
| 180 bool can_use_lcd_text, | 180 bool can_use_lcd_text, |
| 181 const gfx::Size& layer_size, | 181 const gfx::Size& layer_size, |
| 182 const gfx::Rect& visible_layer_rect, | 182 const gfx::Rect& visible_layer_rect, |
| 183 int frame_number, | 183 int frame_number, |
| 184 Picture::RecordingMode recording_mode) { | 184 RecordingSource::RecordingMode recording_mode) { |
| 185 bool can_use_lcd_text_changed = can_use_lcd_text_ != can_use_lcd_text; | 185 bool can_use_lcd_text_changed = can_use_lcd_text_ != can_use_lcd_text; |
| 186 can_use_lcd_text_ = can_use_lcd_text; | 186 can_use_lcd_text_ = can_use_lcd_text; |
| 187 | 187 |
| 188 gfx::Rect interest_rect = visible_layer_rect; | 188 gfx::Rect interest_rect = visible_layer_rect; |
| 189 interest_rect.Inset(-pixel_record_distance_, -pixel_record_distance_); | 189 interest_rect.Inset(-pixel_record_distance_, -pixel_record_distance_); |
| 190 recorded_viewport_ = interest_rect; | 190 recorded_viewport_ = interest_rect; |
| 191 recorded_viewport_.Intersect(gfx::Rect(layer_size)); | 191 recorded_viewport_.Intersect(gfx::Rect(layer_size)); |
| 192 | 192 |
| 193 bool updated = | 193 bool updated = |
| 194 ApplyInvalidationAndResize(interest_rect, invalidation, layer_size, | 194 ApplyInvalidationAndResize(interest_rect, invalidation, layer_size, |
| (...skipping 330 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 525 | 525 |
| 526 // If a tile in the interest rect is not recorded, the entire tile needs | 526 // If a tile in the interest rect is not recorded, the entire tile needs |
| 527 // to be considered invalid, so that we know not to keep around raster | 527 // to be considered invalid, so that we know not to keep around raster |
| 528 // tiles that intersect this recording tile. | 528 // tiles that intersect this recording tile. |
| 529 invalidation->Union(tiling_.TileBounds(it.index_x(), it.index_y())); | 529 invalidation->Union(tiling_.TileBounds(it.index_x(), it.index_y())); |
| 530 } | 530 } |
| 531 } | 531 } |
| 532 } | 532 } |
| 533 | 533 |
| 534 void PicturePile::CreatePictures(ContentLayerClient* painter, | 534 void PicturePile::CreatePictures(ContentLayerClient* painter, |
| 535 Picture::RecordingMode recording_mode, | 535 RecordingSource::RecordingMode recording_mode, |
| 536 const std::vector<gfx::Rect>& record_rects) { | 536 const std::vector<gfx::Rect>& record_rects) { |
| 537 for (const auto& record_rect : record_rects) { | 537 for (const auto& record_rect : record_rects) { |
| 538 gfx::Rect padded_record_rect = PadRect(record_rect); | 538 gfx::Rect padded_record_rect = PadRect(record_rect); |
| 539 | 539 |
| 540 int repeat_count = std::max(1, slow_down_raster_scale_factor_for_debug_); | 540 int repeat_count = std::max(1, slow_down_raster_scale_factor_for_debug_); |
| 541 scoped_refptr<Picture> picture; | 541 scoped_refptr<Picture> picture; |
| 542 | 542 |
| 543 // Note: Currently, gathering of pixel refs when using a single | 543 // Note: Currently, gathering of pixel refs when using a single |
| 544 // raster thread doesn't provide any benefit. This might change | 544 // raster thread doesn't provide any benefit. This might change |
| 545 // in the future but we avoid it for now to reduce the cost of | 545 // in the future but we avoid it for now to reduce the cost of |
| (...skipping 213 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 759 const Picture* PicturePile::PictureInfo::GetPicture() const { | 759 const Picture* PicturePile::PictureInfo::GetPicture() const { |
| 760 return picture_.get(); | 760 return picture_.get(); |
| 761 } | 761 } |
| 762 | 762 |
| 763 float PicturePile::PictureInfo::GetInvalidationFrequency() const { | 763 float PicturePile::PictureInfo::GetInvalidationFrequency() const { |
| 764 return invalidation_history_.count() / | 764 return invalidation_history_.count() / |
| 765 static_cast<float>(INVALIDATION_FRAMES_TRACKED); | 765 static_cast<float>(INVALIDATION_FRAMES_TRACKED); |
| 766 } | 766 } |
| 767 | 767 |
| 768 } // namespace cc | 768 } // namespace cc |
| OLD | NEW |