| OLD | NEW |
| 1 // Copyright 2015 The Chromium Authors. All rights reserved. | 1 // Copyright 2015 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/playback/discardable_image_map.h" | 5 #include "cc/playback/discardable_image_map.h" |
| 6 | 6 |
| 7 #include <stddef.h> | 7 #include <stddef.h> |
| 8 | 8 |
| 9 #include <algorithm> | 9 #include <algorithm> |
| 10 #include <limits> | 10 #include <limits> |
| (...skipping 233 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 244 | 244 |
| 245 void DiscardableImageMap::EndGeneratingMetadata() { | 245 void DiscardableImageMap::EndGeneratingMetadata() { |
| 246 images_rtree_.Build(all_images_, | 246 images_rtree_.Build(all_images_, |
| 247 [](const std::pair<DrawImage, gfx::Rect>& image) { | 247 [](const std::pair<DrawImage, gfx::Rect>& image) { |
| 248 return image.second; | 248 return image.second; |
| 249 }); | 249 }); |
| 250 } | 250 } |
| 251 | 251 |
| 252 void DiscardableImageMap::GetDiscardableImagesInRect( | 252 void DiscardableImageMap::GetDiscardableImagesInRect( |
| 253 const gfx::Rect& rect, | 253 const gfx::Rect& rect, |
| 254 const gfx::SizeF& raster_scales, | 254 float contents_scale, |
| 255 std::vector<DrawImage>* images) const { | 255 std::vector<DrawImage>* images) const { |
| 256 std::vector<size_t> indices; | 256 std::vector<size_t> indices; |
| 257 images_rtree_.Search(rect, &indices); | 257 images_rtree_.Search(rect, &indices); |
| 258 for (size_t index : indices) | 258 for (size_t index : indices) |
| 259 images->push_back(all_images_[index].first.ApplyScale(raster_scales)); | 259 images->push_back(all_images_[index].first.ApplyScale(contents_scale)); |
| 260 } | 260 } |
| 261 | 261 |
| 262 DiscardableImageMap::ScopedMetadataGenerator::ScopedMetadataGenerator( | 262 DiscardableImageMap::ScopedMetadataGenerator::ScopedMetadataGenerator( |
| 263 DiscardableImageMap* image_map, | 263 DiscardableImageMap* image_map, |
| 264 const gfx::Size& bounds) | 264 const gfx::Size& bounds) |
| 265 : image_map_(image_map), | 265 : image_map_(image_map), |
| 266 metadata_canvas_(image_map->BeginGeneratingMetadata(bounds)) {} | 266 metadata_canvas_(image_map->BeginGeneratingMetadata(bounds)) {} |
| 267 | 267 |
| 268 DiscardableImageMap::ScopedMetadataGenerator::~ScopedMetadataGenerator() { | 268 DiscardableImageMap::ScopedMetadataGenerator::~ScopedMetadataGenerator() { |
| 269 image_map_->EndGeneratingMetadata(); | 269 image_map_->EndGeneratingMetadata(); |
| 270 } | 270 } |
| 271 | 271 |
| 272 } // namespace cc | 272 } // namespace cc |
| OLD | NEW |