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

Side by Side Diff: cc/resources/picture_pile.cc

Issue 294163009: cc: Expand invalidation to full tile when recording is missing for the tile. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: pictureslow: doitinpicturepile Created 6 years, 6 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 | Annotate | Revision Log
« no previous file with comments | « cc/resources/picture_pile.h ('k') | cc/resources/picture_pile_base.h » ('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 2012 The Chromium Authors. All rights reserved. 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 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/resources/picture_pile.h" 5 #include "cc/resources/picture_pile.h"
6 6
7 #include <algorithm> 7 #include <algorithm>
8 #include <limits> 8 #include <limits>
9 #include <vector> 9 #include <vector>
10 10
(...skipping 128 matching lines...) Expand 10 before | Expand all | Expand 10 after
139 139
140 } // namespace 140 } // namespace
141 141
142 namespace cc { 142 namespace cc {
143 143
144 PicturePile::PicturePile() : is_suitable_for_gpu_rasterization_(true) {} 144 PicturePile::PicturePile() : is_suitable_for_gpu_rasterization_(true) {}
145 145
146 PicturePile::~PicturePile() { 146 PicturePile::~PicturePile() {
147 } 147 }
148 148
149 bool PicturePile::Update(ContentLayerClient* painter, 149 bool PicturePile::UpdateAndExpandInvalidation(
150 SkColor background_color, 150 ContentLayerClient* painter,
151 bool contents_opaque, 151 Region* invalidation,
152 bool contents_fill_bounds_completely, 152 SkColor background_color,
153 const Region& invalidation, 153 bool contents_opaque,
154 const gfx::Rect& visible_layer_rect, 154 bool contents_fill_bounds_completely,
155 int frame_number, 155 const gfx::Rect& visible_layer_rect,
156 Picture::RecordingMode recording_mode, 156 int frame_number,
157 RenderingStatsInstrumentation* stats_instrumentation) { 157 Picture::RecordingMode recording_mode,
158 RenderingStatsInstrumentation* stats_instrumentation) {
158 background_color_ = background_color; 159 background_color_ = background_color;
159 contents_opaque_ = contents_opaque; 160 contents_opaque_ = contents_opaque;
160 contents_fill_bounds_completely_ = contents_fill_bounds_completely; 161 contents_fill_bounds_completely_ = contents_fill_bounds_completely;
161 162
162 gfx::Rect interest_rect = visible_layer_rect; 163 gfx::Rect interest_rect = visible_layer_rect;
163 interest_rect.Inset( 164 interest_rect.Inset(
164 -kPixelDistanceToRecord, 165 -kPixelDistanceToRecord,
165 -kPixelDistanceToRecord, 166 -kPixelDistanceToRecord,
166 -kPixelDistanceToRecord, 167 -kPixelDistanceToRecord,
167 -kPixelDistanceToRecord); 168 -kPixelDistanceToRecord);
168 recorded_viewport_ = interest_rect; 169 recorded_viewport_ = interest_rect;
169 recorded_viewport_.Intersect(tiling_rect()); 170 recorded_viewport_.Intersect(tiling_rect());
170 171
172 // Anything outside the interest rect may no longer be valid, we don't care to
173 // know so consider it invalid.
174 Region invalidation_across_frames = tiling_.tiling_rect();
175 invalidation_across_frames.Subtract(interest_rect);
enne (OOO) 2014/06/13 21:16:44 The one bad part about this is that if you have a
danakj 2014/06/13 21:19:18 our goal is to invalidate all tiles on the pending
enne (OOO) 2014/06/13 21:23:20 The only recordings that are dropped are ones that
176
171 bool invalidated = false; 177 bool invalidated = false;
172 for (Region::Iterator i(invalidation); i.has_rect(); i.next()) { 178 for (Region::Iterator i(*invalidation); i.has_rect(); i.next()) {
173 gfx::Rect invalidation = i.rect(); 179 gfx::Rect invalid_rect = i.rect();
174 // Split this inflated invalidation across tile boundaries and apply it 180 // Split this inflated invalidation across tile boundaries and apply it
175 // to all tiles that it touches. 181 // to all tiles that it touches.
176 bool include_borders = true; 182 bool include_borders = true;
177 for (TilingData::Iterator iter(&tiling_, invalidation, include_borders); 183 for (TilingData::Iterator iter(&tiling_, invalid_rect, include_borders);
178 iter; 184 iter;
179 ++iter) { 185 ++iter) {
180 const PictureMapKey& key = iter.index(); 186 const PictureMapKey& key = iter.index();
181 187
182 PictureMap::iterator picture_it = picture_map_.find(key); 188 PictureMap::iterator picture_it = picture_map_.find(key);
183 if (picture_it == picture_map_.end()) 189 if (picture_it == picture_map_.end())
184 continue; 190 continue;
185 191
186 // Inform the grid cell that it has been invalidated in this frame. 192 // Inform the grid cell that it has been invalidated in this frame.
187 invalidated = picture_it->second.Invalidate(frame_number) || invalidated; 193 invalidated = picture_it->second.Invalidate(frame_number) || invalidated;
188 } 194 }
195
196 int left_tile = tiling_.FirstBorderTileXIndexFromSrcCoord(invalid_rect.x());
197 int top_tile = tiling_.FirstBorderTileYIndexFromSrcCoord(invalid_rect.y());
198 int right_tile =
199 tiling_.LastBorderTileXIndexFromSrcCoord(invalid_rect.right() - 1);
200 int bottom_tile =
201 tiling_.LastBorderTileYIndexFromSrcCoord(invalid_rect.bottom() - 1);
202 gfx::Rect invalid_rect_filling_tiles =
203 gfx::UnionRects(tiling_.TileBoundsWithBorder(left_tile, top_tile),
204 tiling_.TileBoundsWithBorder(right_tile, bottom_tile));
205 invalidation_across_frames.Union(invalid_rect_filling_tiles);
189 } 206 }
190 207
208 // Return the expanded invalidation from this frame and previous frames.
209 invalidation_across_frames.Swap(invalidation);
210
191 // Make a list of all invalid tiles; we will attempt to 211 // Make a list of all invalid tiles; we will attempt to
192 // cluster these into multiple invalidation regions. 212 // cluster these into multiple invalidation regions.
193 std::vector<gfx::Rect> invalid_tiles; 213 std::vector<gfx::Rect> invalid_tiles;
194 bool include_borders = true; 214 bool include_borders = true;
195 for (TilingData::Iterator it(&tiling_, interest_rect, include_borders); it; 215 for (TilingData::Iterator it(&tiling_, interest_rect, include_borders); it;
196 ++it) { 216 ++it) {
197 const PictureMapKey& key = it.index(); 217 const PictureMapKey& key = it.index();
198 PictureInfo& info = picture_map_[key]; 218 PictureInfo& info = picture_map_[key];
199 219
200 gfx::Rect rect = PaddedRect(key); 220 gfx::Rect rect = PaddedRect(key);
(...skipping 76 matching lines...) Expand 10 before | Expand all | Expand 10 after
277 } 297 }
278 DCHECK(found_tile_for_recorded_picture); 298 DCHECK(found_tile_for_recorded_picture);
279 } 299 }
280 300
281 has_any_recordings_ = true; 301 has_any_recordings_ = true;
282 DCHECK(CanRasterSlowTileCheck(recorded_viewport_)); 302 DCHECK(CanRasterSlowTileCheck(recorded_viewport_));
283 return true; 303 return true;
284 } 304 }
285 305
286 } // namespace cc 306 } // namespace cc
OLDNEW
« no previous file with comments | « cc/resources/picture_pile.h ('k') | cc/resources/picture_pile_base.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698