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

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

Issue 2239913002: Allow filters to specify their initial visual rect. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 4 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/blink/web_display_item_list_impl.cc ('k') | cc/playback/display_item_list_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 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 #ifndef CC_PLAYBACK_DISPLAY_ITEM_LIST_H_ 5 #ifndef CC_PLAYBACK_DISPLAY_ITEM_LIST_H_
6 #define CC_PLAYBACK_DISPLAY_ITEM_LIST_H_ 6 #define CC_PLAYBACK_DISPLAY_ITEM_LIST_H_
7 7
8 #include <stddef.h> 8 #include <stddef.h>
9 9
10 #include <memory> 10 #include <memory>
(...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after
66 void Raster(SkCanvas* canvas, SkPicture::AbortCallback* callback) const; 66 void Raster(SkCanvas* canvas, SkPicture::AbortCallback* callback) const;
67 67
68 // This is a fast path for use only if canvas_ is set and 68 // This is a fast path for use only if canvas_ is set and
69 // retain_individual_display_items_ is false. This method also updates 69 // retain_individual_display_items_ is false. This method also updates
70 // approximate_op_count_. 70 // approximate_op_count_.
71 void RasterIntoCanvas(const DisplayItem& display_item); 71 void RasterIntoCanvas(const DisplayItem& display_item);
72 72
73 // Because processing happens in these CreateAndAppend functions, all the set 73 // Because processing happens in these CreateAndAppend functions, all the set
74 // up for the item should be done via the args, which is why the return type 74 // up for the item should be done via the args, which is why the return type
75 // needs to be const, to prevent set-after-processing mistakes. 75 // needs to be const, to prevent set-after-processing mistakes.
76
77 // Most paired begin item types default to an empty visual rect, which will
78 // subsequently be grown as needed to encompass any contained items that draw
79 // content, such as drawing or filter items.
76 template <typename DisplayItemType, typename... Args> 80 template <typename DisplayItemType, typename... Args>
77 const DisplayItemType& CreateAndAppendPairedBeginItem(Args&&... args) { 81 const DisplayItemType& CreateAndAppendPairedBeginItem(Args&&... args) {
82 return CreateAndAppendPairedBeginItemWithVisualRect<DisplayItemType>(
83 gfx::Rect(), std::forward<Args>(args)...);
84 }
85
86 // This method variant is exposed to allow filters to specify their visual
87 // rect since they may draw content despite containing no drawing items.
88 template <typename DisplayItemType, typename... Args>
89 const DisplayItemType& CreateAndAppendPairedBeginItemWithVisualRect(
vmpstr 2016/08/11 23:39:37 It seems like we could just have CreateAndAppendPa
wkorman 2016/08/12 00:17:08 Yeah, I thought about that. There are ~41 callsite
90 const gfx::Rect& visual_rect,
91 Args&&... args) {
78 size_t item_index = inputs_.visual_rects.size(); 92 size_t item_index = inputs_.visual_rects.size();
79 inputs_.visual_rects.push_back(gfx::Rect()); 93 inputs_.visual_rects.push_back(visual_rect);
80 inputs_.begin_item_indices.push_back(item_index); 94 inputs_.begin_item_indices.push_back(item_index);
81 95
82 return AllocateAndConstruct<DisplayItemType>(std::forward<Args>(args)...); 96 return AllocateAndConstruct<DisplayItemType>(std::forward<Args>(args)...);
83 } 97 }
84 98
85 template <typename DisplayItemType, typename... Args> 99 template <typename DisplayItemType, typename... Args>
86 const DisplayItemType& CreateAndAppendPairedEndItem(Args&&... args) { 100 const DisplayItemType& CreateAndAppendPairedEndItem(Args&&... args) {
87 DCHECK(!inputs_.begin_item_indices.empty()); 101 DCHECK(!inputs_.begin_item_indices.empty());
88 size_t last_begin_index = inputs_.begin_item_indices.back(); 102 size_t last_begin_index = inputs_.begin_item_indices.back();
89 inputs_.begin_item_indices.pop_back(); 103 inputs_.begin_item_indices.pop_back();
(...skipping 129 matching lines...) Expand 10 before | Expand all | Expand 10 after
219 Inputs inputs_; 233 Inputs inputs_;
220 234
221 friend class base::RefCountedThreadSafe<DisplayItemList>; 235 friend class base::RefCountedThreadSafe<DisplayItemList>;
222 FRIEND_TEST_ALL_PREFIXES(DisplayItemListTest, ApproximateMemoryUsage); 236 FRIEND_TEST_ALL_PREFIXES(DisplayItemListTest, ApproximateMemoryUsage);
223 DISALLOW_COPY_AND_ASSIGN(DisplayItemList); 237 DISALLOW_COPY_AND_ASSIGN(DisplayItemList);
224 }; 238 };
225 239
226 } // namespace cc 240 } // namespace cc
227 241
228 #endif // CC_PLAYBACK_DISPLAY_ITEM_LIST_H_ 242 #endif // CC_PLAYBACK_DISPLAY_ITEM_LIST_H_
OLDNEW
« no previous file with comments | « cc/blink/web_display_item_list_impl.cc ('k') | cc/playback/display_item_list_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698