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