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/paint/discardable_image_map.h" | 5 #include "cc/paint/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 28 matching lines...) Expand all Loading... |
39 std::vector<DrawImage>* images) const { | 39 std::vector<DrawImage>* images) const { |
40 std::vector<size_t> indices; | 40 std::vector<size_t> indices; |
41 images_rtree_.Search(rect, &indices); | 41 images_rtree_.Search(rect, &indices); |
42 for (size_t index : indices) { | 42 for (size_t index : indices) { |
43 images->push_back(all_images_[index] | 43 images->push_back(all_images_[index] |
44 .first.ApplyScale(contents_scale) | 44 .first.ApplyScale(contents_scale) |
45 .ApplyTargetColorSpace(target_color_space)); | 45 .ApplyTargetColorSpace(target_color_space)); |
46 } | 46 } |
47 } | 47 } |
48 | 48 |
49 gfx::Rect DiscardableImageMap::GetRectForImage(ImageId image_id) const { | 49 gfx::Rect DiscardableImageMap::GetRectForImage(PaintImage::Id image_id) const { |
50 const auto& it = image_id_to_rect_.find(image_id); | 50 const auto& it = image_id_to_rect_.find(image_id); |
51 return it == image_id_to_rect_.end() ? gfx::Rect() : it->second; | 51 return it == image_id_to_rect_.end() ? gfx::Rect() : it->second; |
52 } | 52 } |
53 | 53 |
54 DiscardableImageMap::ScopedMetadataGenerator::ScopedMetadataGenerator( | 54 DiscardableImageMap::ScopedMetadataGenerator::ScopedMetadataGenerator( |
55 DiscardableImageMap* image_map, | 55 DiscardableImageMap* image_map, |
56 const gfx::Size& bounds) | 56 const gfx::Size& bounds) |
57 : image_map_(image_map), | 57 : image_map_(image_map), |
58 image_store_(image_map->BeginGeneratingMetadata(bounds)) {} | 58 image_store_(image_map->BeginGeneratingMetadata(bounds)) {} |
59 | 59 |
60 DiscardableImageMap::ScopedMetadataGenerator::~ScopedMetadataGenerator() { | 60 DiscardableImageMap::ScopedMetadataGenerator::~ScopedMetadataGenerator() { |
61 image_map_->EndGeneratingMetadata(); | 61 image_map_->EndGeneratingMetadata(); |
62 } | 62 } |
63 | 63 |
64 } // namespace cc | 64 } // namespace cc |
OLD | NEW |