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

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

Issue 78883002: Cluster invalidation rectangles into coherent regions to lessen SkPicture re-recording (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Final round of nits Created 7 years, 1 month 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_pile_base.h ('k') | 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 2013 The Chromium Authors. All rights reserved. 1 // Copyright 2013 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_base.h" 5 #include "cc/resources/picture_pile_base.h"
6 6
7 #include <algorithm> 7 #include <algorithm>
8 #include <set> 8 #include <set>
9 #include <vector> 9 #include <vector>
10 10
(...skipping 172 matching lines...) Expand 10 before | Expand all | Expand 10 after
183 if (tiling_.total_size().IsEmpty()) 183 if (tiling_.total_size().IsEmpty())
184 return false; 184 return false;
185 gfx::Rect layer_rect = gfx::ScaleToEnclosingRect( 185 gfx::Rect layer_rect = gfx::ScaleToEnclosingRect(
186 content_rect, 1.f / contents_scale); 186 content_rect, 1.f / contents_scale);
187 layer_rect.Intersect(gfx::Rect(tiling_.total_size())); 187 layer_rect.Intersect(gfx::Rect(tiling_.total_size()));
188 return recorded_region_.Contains(layer_rect); 188 return recorded_region_.Contains(layer_rect);
189 } 189 }
190 190
191 gfx::Rect PicturePileBase::PaddedRect(const PictureMapKey& key) { 191 gfx::Rect PicturePileBase::PaddedRect(const PictureMapKey& key) {
192 gfx::Rect tile = tiling_.TileBounds(key.first, key.second); 192 gfx::Rect tile = tiling_.TileBounds(key.first, key.second);
193 tile.Inset( 193 return PadRect(tile);
194 }
195
196 gfx::Rect PicturePileBase::PadRect(gfx::Rect rect) {
197 gfx::Rect padded_rect = rect;
198 padded_rect.Inset(
194 -buffer_pixels(), -buffer_pixels(), -buffer_pixels(), -buffer_pixels()); 199 -buffer_pixels(), -buffer_pixels(), -buffer_pixels(), -buffer_pixels());
195 return tile; 200 return padded_rect;
196 } 201 }
197 202
198 scoped_ptr<base::Value> PicturePileBase::AsValue() const { 203 scoped_ptr<base::Value> PicturePileBase::AsValue() const {
199 scoped_ptr<base::ListValue> pictures(new base::ListValue()); 204 scoped_ptr<base::ListValue> pictures(new base::ListValue());
200 gfx::Rect layer_rect(tiling_.total_size()); 205 gfx::Rect layer_rect(tiling_.total_size());
201 std::set<void*> appended_pictures; 206 std::set<void*> appended_pictures;
202 for (TilingData::Iterator tile_iter(&tiling_, layer_rect); 207 for (TilingData::Iterator tile_iter(&tiling_, layer_rect);
203 tile_iter; ++tile_iter) { 208 tile_iter; ++tile_iter) {
204 PictureMap::const_iterator map_iter = picture_map_.find(tile_iter.index()); 209 PictureMap::const_iterator map_iter = picture_map_.find(tile_iter.index());
205 if (map_iter == picture_map_.end()) 210 if (map_iter == picture_map_.end())
(...skipping 21 matching lines...) Expand all
227 232
228 PicturePileBase::PictureInfo PicturePileBase::PictureInfo::CloneForThread( 233 PicturePileBase::PictureInfo PicturePileBase::PictureInfo::CloneForThread(
229 int thread_index) const { 234 int thread_index) const {
230 PictureInfo info = *this; 235 PictureInfo info = *this;
231 if (picture.get()) 236 if (picture.get())
232 info.picture = picture->GetCloneForDrawingOnThread(thread_index); 237 info.picture = picture->GetCloneForDrawingOnThread(thread_index);
233 return info; 238 return info;
234 } 239 }
235 240
236 } // namespace cc 241 } // namespace cc
OLDNEW
« no previous file with comments | « cc/resources/picture_pile_base.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698