Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(3)

Side by Side Diff: cc/paint/discardable_image_map.cc

Issue 2857923004: cc: Keep PaintImage in DrawImage. (Closed)
Patch Set: .. Created 3 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « cc/paint/discardable_image_map.h ('k') | cc/paint/discardable_image_map_unittest.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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
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
OLDNEW
« no previous file with comments | « cc/paint/discardable_image_map.h ('k') | cc/paint/discardable_image_map_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698