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

Side by Side Diff: cc/playback/display_item_list.cc

Issue 2743793002: cc: Optimize GenerateDiscardableImagesMetadata for display items. (Closed)
Patch Set: Created 3 years, 9 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 | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 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/display_item_list.h" 5 #include "cc/playback/display_item_list.h"
6 6
7 #include <stddef.h> 7 #include <stddef.h>
8 8
9 #include <string> 9 #include <string>
10 10
(...skipping 229 matching lines...) Expand 10 before | Expand all | Expand 10 after
240 DisplayItemsTracingEnabled())); 240 DisplayItemsTracingEnabled()));
241 } 241 }
242 242
243 void DisplayItemList::GenerateDiscardableImagesMetadata() { 243 void DisplayItemList::GenerateDiscardableImagesMetadata() {
244 // This should be only called once. 244 // This should be only called once.
245 DCHECK(image_map_.empty()); 245 DCHECK(image_map_.empty());
246 246
247 gfx::Rect bounds = rtree_.GetBounds(); 247 gfx::Rect bounds = rtree_.GetBounds();
248 DiscardableImageMap::ScopedMetadataGenerator generator( 248 DiscardableImageMap::ScopedMetadataGenerator generator(
249 &image_map_, gfx::Size(bounds.right(), bounds.bottom())); 249 &image_map_, gfx::Size(bounds.right(), bounds.bottom()));
250 Raster(generator.canvas(), nullptr, gfx::Rect(), 1.f); 250 auto* canvas = generator.canvas();
251 for (const auto& item : inputs_.items)
252 item.Raster(canvas, nullptr);
251 } 253 }
252 254
253 void DisplayItemList::GetDiscardableImagesInRect( 255 void DisplayItemList::GetDiscardableImagesInRect(
254 const gfx::Rect& rect, 256 const gfx::Rect& rect,
255 float contents_scale, 257 float contents_scale,
256 std::vector<DrawImage>* images) { 258 std::vector<DrawImage>* images) {
257 image_map_.GetDiscardableImagesInRect(rect, contents_scale, images); 259 image_map_.GetDiscardableImagesInRect(rect, contents_scale, images);
258 } 260 }
259 261
260 gfx::Rect DisplayItemList::GetRectForImage(ImageId image_id) const { 262 gfx::Rect DisplayItemList::GetRectForImage(ImageId image_id) const {
261 return image_map_.GetRectForImage(image_id); 263 return image_map_.GetRectForImage(image_id);
262 } 264 }
263 265
264 } // namespace cc 266 } // namespace cc
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698