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

Side by Side Diff: cc/resources/picture_layer_tiling_set.h

Issue 1057283003: Remove parts of //cc we aren't using (Closed) Base URL: git@github.com:domokit/mojo.git@master
Patch Set: Created 5 years, 8 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/resources/picture_layer_tiling_perftest.cc ('k') | cc/resources/picture_layer_tiling_set.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
(Empty)
1 // Copyright 2012 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
4
5 #ifndef CC_RESOURCES_PICTURE_LAYER_TILING_SET_H_
6 #define CC_RESOURCES_PICTURE_LAYER_TILING_SET_H_
7
8 #include <set>
9 #include <vector>
10
11 #include "cc/base/region.h"
12 #include "cc/base/scoped_ptr_vector.h"
13 #include "cc/resources/picture_layer_tiling.h"
14 #include "ui/gfx/geometry/size.h"
15
16 namespace base {
17 namespace trace_event {
18 class TracedValue;
19 }
20 }
21
22 namespace cc {
23
24 class CC_EXPORT PictureLayerTilingSet {
25 public:
26 enum TilingRangeType {
27 HIGHER_THAN_HIGH_RES,
28 HIGH_RES,
29 BETWEEN_HIGH_AND_LOW_RES,
30 LOW_RES,
31 LOWER_THAN_LOW_RES
32 };
33 struct TilingRange {
34 TilingRange(size_t start, size_t end) : start(start), end(end) {}
35
36 size_t start;
37 size_t end;
38 };
39
40 static scoped_ptr<PictureLayerTilingSet> Create(
41 PictureLayerTilingClient* client,
42 size_t max_tiles_for_interest_area,
43 float skewport_target_time_in_seconds,
44 int skewport_extrapolation_limit_in_content);
45
46 ~PictureLayerTilingSet();
47
48 const PictureLayerTilingClient* client() const { return client_; }
49
50 void CleanUpTilings(float min_acceptable_high_res_scale,
51 float max_acceptable_high_res_scale,
52 const std::vector<PictureLayerTiling*>& needed_tilings,
53 bool should_have_low_res,
54 PictureLayerTilingSet* twin_set,
55 PictureLayerTilingSet* recycled_twin_set);
56 void RemoveNonIdealTilings();
57
58 // This function can be called on both the active and pending tree.
59 // |pending_twin_set| represents the current pending twin. In situations where
60 // this is called on the active tree in two trees situations,
61 // |pending_twin_set| represents the tiling set from the pending twin layer.
62 // In situations where this is called on the sync tree (whether it's pending
63 // or active in cases of one tree), |pending_twin_set| should be nullptr.
64 void UpdateTilingsToCurrentRasterSource(
65 scoped_refptr<RasterSource> raster_source,
66 const PictureLayerTilingSet* pending_twin_set,
67 const Region& layer_invalidation,
68 float minimum_contents_scale,
69 float maximum_contents_scale);
70
71 PictureLayerTiling* AddTiling(float contents_scale,
72 scoped_refptr<RasterSource> raster_source);
73 size_t num_tilings() const { return tilings_.size(); }
74 int NumHighResTilings() const;
75 PictureLayerTiling* tiling_at(size_t idx) { return tilings_[idx]; }
76 const PictureLayerTiling* tiling_at(size_t idx) const {
77 return tilings_[idx];
78 }
79
80 PictureLayerTiling* FindTilingWithScale(float scale) const;
81 PictureLayerTiling* FindTilingWithResolution(TileResolution resolution) const;
82
83 void MarkAllTilingsNonIdeal();
84
85 // If a tiling exists whose scale is within |snap_to_existing_tiling_ratio|
86 // ratio of |start_scale|, then return that tiling's scale. Otherwise, return
87 // |start_scale|. If multiple tilings match the criteria, return the one with
88 // the least ratio to |start_scale|.
89 float GetSnappedContentsScale(float start_scale,
90 float snap_to_existing_tiling_ratio) const;
91
92 // Returns the maximum contents scale of all tilings, or 0 if no tilings
93 // exist.
94 float GetMaximumContentsScale() const;
95
96 // Removes all tilings with a contents scale < |minimum_scale|.
97 void RemoveTilingsBelowScale(float minimum_scale);
98
99 // Removes all tilings with a contents scale > |maximum_scale|.
100 void RemoveTilingsAboveScale(float maximum_scale);
101
102 // Remove all tilings.
103 void RemoveAllTilings();
104
105 // Remove all tiles; keep all tilings.
106 void RemoveAllTiles();
107
108 // Update the rects and priorities for tiles based on the given information.
109 bool UpdateTilePriorities(const gfx::Rect& required_rect_in_layer_space,
110 float ideal_contents_scale,
111 double current_frame_time_in_seconds,
112 const Occlusion& occlusion_in_layer_space,
113 bool can_require_tiles_for_activation);
114
115 void GetAllTilesAndPrioritiesForTracing(
116 std::map<const Tile*, TilePriority>* tile_map) const;
117
118 // For a given rect, iterates through tiles that can fill it. If no
119 // set of tiles with resources can fill the rect, then it will iterate
120 // through null tiles with valid geometry_rect() until the rect is full.
121 // If all tiles have resources, the union of all geometry_rects will
122 // exactly fill rect with no overlap.
123 class CC_EXPORT CoverageIterator {
124 public:
125 CoverageIterator(const PictureLayerTilingSet* set,
126 float contents_scale,
127 const gfx::Rect& content_rect,
128 float ideal_contents_scale);
129 ~CoverageIterator();
130
131 // Visible rect (no borders), always in the space of rect,
132 // regardless of the relative contents scale of the tiling.
133 gfx::Rect geometry_rect() const;
134 // Texture rect (in texels) for geometry_rect
135 gfx::RectF texture_rect() const;
136
137 Tile* operator->() const;
138 Tile* operator*() const;
139
140 CoverageIterator& operator++();
141 operator bool() const;
142
143 TileResolution resolution() const;
144 PictureLayerTiling* CurrentTiling() const;
145
146 private:
147 int NextTiling() const;
148
149 const PictureLayerTilingSet* set_;
150 float contents_scale_;
151 float ideal_contents_scale_;
152 PictureLayerTiling::CoverageIterator tiling_iter_;
153 int current_tiling_;
154 int ideal_tiling_;
155
156 Region current_region_;
157 Region missing_region_;
158 Region::Iterator region_iter_;
159 };
160
161 void AsValueInto(base::trace_event::TracedValue* array) const;
162 size_t GPUMemoryUsageInBytes() const;
163
164 TilingRange GetTilingRange(TilingRangeType type) const;
165
166 private:
167 explicit PictureLayerTilingSet(
168 PictureLayerTilingClient* client,
169 size_t max_tiles_for_interest_area,
170 float skewport_target_time_in_seconds,
171 int skewport_extrapolation_limit_in_content_pixels);
172
173 void CopyTilingsFromPendingTwin(
174 const PictureLayerTilingSet* pending_twin_set,
175 const scoped_refptr<RasterSource>& raster_source);
176
177 // Remove one tiling.
178 void Remove(PictureLayerTiling* tiling);
179
180 ScopedPtrVector<PictureLayerTiling> tilings_;
181
182 const size_t max_tiles_for_interest_area_;
183 const float skewport_target_time_in_seconds_;
184 const int skewport_extrapolation_limit_in_content_pixels_;
185 PictureLayerTilingClient* client_;
186
187 friend class Iterator;
188 DISALLOW_COPY_AND_ASSIGN(PictureLayerTilingSet);
189 };
190
191 } // namespace cc
192
193 #endif // CC_RESOURCES_PICTURE_LAYER_TILING_SET_H_
OLDNEW
« no previous file with comments | « cc/resources/picture_layer_tiling_perftest.cc ('k') | cc/resources/picture_layer_tiling_set.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698