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

Side by Side Diff: cc/picture_pile_impl.cc

Issue 12194015: cc: Rasterize cheap tiles immediately (Closed) Base URL: http://git.chromium.org/git/chromium.git@trunk
Patch Set: Created 7 years, 10 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
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 "base/debug/trace_event.h" 5 #include "base/debug/trace_event.h"
6 #include "cc/picture_pile_impl.h" 6 #include "cc/picture_pile_impl.h"
7 #include "cc/region.h" 7 #include "cc/region.h"
8 #include "cc/rendering_stats.h" 8 #include "cc/rendering_stats.h"
9 #include "third_party/skia/include/core/SkCanvas.h" 9 #include "third_party/skia/include/core/SkCanvas.h"
10 #include "third_party/skia/include/core/SkSize.h" 10 #include "third_party/skia/include/core/SkSize.h"
(...skipping 157 matching lines...) Expand 10 before | Expand all | Expand 10 after
168 layer_rect.height(), 168 layer_rect.height(),
169 SkPicture::kUsePathBoundsForClip_RecordingFlag); 169 SkPicture::kUsePathBoundsForClip_RecordingFlag);
170 170
171 RenderingStats stats; 171 RenderingStats stats;
172 Raster(canvas, layer_rect, 1.0, &stats); 172 Raster(canvas, layer_rect, 1.0, &stats);
173 picture->endRecording(); 173 picture->endRecording();
174 174
175 return picture; 175 return picture;
176 } 176 }
177 177
178 bool PicturePileImpl::IsCheapInRect(
179 gfx::Rect content_rect, float contents_scale) const {
180 gfx::Rect layer_rect = gfx::ToEnclosingRect(
181 gfx::ScaleRect(content_rect, 1.f / contents_scale));
182
183 for (TilingData::Iterator tile_iter(&tiling_, layer_rect);
184 tile_iter; ++tile_iter) {
185 PictureListMap::const_iterator map_iter =
186 picture_list_map_.find(tile_iter.index());
187 if (map_iter == picture_list_map_.end())
188 continue;
189
190 const PictureList& pic_list = map_iter->second;
191 for (PictureList::const_iterator i = pic_list.begin();
192 i != pic_list.end(); ++i) {
193 if (!(*i)->LayerRect().Intersects(layer_rect) || !(*i)->HasRecording())
194 continue;
195 if (!(*i)->IsCheapInRect(layer_rect))
196 return false;
197 }
198 }
199 return true;
200 }
201
178 } // namespace cc 202 } // namespace cc
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698