OLD | NEW |
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/paint/display_item_list.h" | 5 #include "cc/paint/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 225 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
236 << "items.size() " << items_.size() << " visual_rects.size() " | 236 << "items.size() " << items_.size() << " visual_rects.size() " |
237 << visual_rects_.size(); | 237 << visual_rects_.size(); |
238 rtree_.Build(visual_rects_); | 238 rtree_.Build(visual_rects_); |
239 | 239 |
240 if (!retain_visual_rects_) | 240 if (!retain_visual_rects_) |
241 // This clears both the vector and the vector's capacity, since | 241 // This clears both the vector and the vector's capacity, since |
242 // visual_rects won't be used anymore. | 242 // visual_rects won't be used anymore. |
243 std::vector<gfx::Rect>().swap(visual_rects_); | 243 std::vector<gfx::Rect>().swap(visual_rects_); |
244 } | 244 } |
245 | 245 |
246 bool DisplayItemList::IsSuitableForGpuRasterization() const { | |
247 // TODO(wkorman): This is more permissive than Picture's implementation, since | |
248 // none of the items might individually trigger a veto even though they | |
249 // collectively have enough "bad" operations that a corresponding Picture | |
250 // would get vetoed. See crbug.com/513016. | |
251 return all_items_are_suitable_for_gpu_rasterization_; | |
252 } | |
253 | |
254 size_t DisplayItemList::OpCount() const { | 246 size_t DisplayItemList::OpCount() const { |
255 return op_count_; | 247 return op_count_; |
256 } | 248 } |
257 | 249 |
258 size_t DisplayItemList::ApproximateMemoryUsage() const { | 250 size_t DisplayItemList::ApproximateMemoryUsage() const { |
259 size_t memory_usage = sizeof(*this); | 251 size_t memory_usage = sizeof(*this); |
260 | 252 |
261 size_t external_memory_usage = 0; | 253 size_t external_memory_usage = 0; |
262 for (const auto& item : items_) { | 254 for (const auto& item : items_) { |
263 size_t bytes = 0; | 255 size_t bytes = 0; |
(...skipping 272 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
536 std::vector<DrawImage>* images) { | 528 std::vector<DrawImage>* images) { |
537 image_map_.GetDiscardableImagesInRect(rect, contents_scale, | 529 image_map_.GetDiscardableImagesInRect(rect, contents_scale, |
538 target_color_space, images); | 530 target_color_space, images); |
539 } | 531 } |
540 | 532 |
541 gfx::Rect DisplayItemList::GetRectForImage(PaintImage::Id image_id) const { | 533 gfx::Rect DisplayItemList::GetRectForImage(PaintImage::Id image_id) const { |
542 return image_map_.GetRectForImage(image_id); | 534 return image_map_.GetRectForImage(image_id); |
543 } | 535 } |
544 | 536 |
545 } // namespace cc | 537 } // namespace cc |
OLD | NEW |