OLD | NEW |
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 150 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
161 layer_rect.height(), | 161 layer_rect.height(), |
162 SkPicture::kUsePathBoundsForClip_RecordingFlag); | 162 SkPicture::kUsePathBoundsForClip_RecordingFlag); |
163 | 163 |
164 RenderingStats stats; | 164 RenderingStats stats; |
165 Raster(canvas, layer_rect, 1.0, &stats); | 165 Raster(canvas, layer_rect, 1.0, &stats); |
166 picture->endRecording(); | 166 picture->endRecording(); |
167 | 167 |
168 return picture; | 168 return picture; |
169 } | 169 } |
170 | 170 |
| 171 bool PicturePileImpl::IsCheapInRect( |
| 172 gfx::Rect content_rect, float contents_scale) const { |
| 173 gfx::Rect layer_rect = gfx::ToEnclosingRect( |
| 174 gfx::ScaleRect(content_rect, 1.f / contents_scale)); |
| 175 |
| 176 for (TilingData::Iterator tile_iter(&tiling_, layer_rect); |
| 177 tile_iter; ++tile_iter) { |
| 178 PictureListMap::const_iterator map_iter = |
| 179 picture_list_map_.find(tile_iter.index()); |
| 180 if (map_iter == picture_list_map_.end()) |
| 181 continue; |
| 182 |
| 183 const PictureList& pic_list = map_iter->second; |
| 184 for (PictureList::const_iterator i = pic_list.begin(); |
| 185 i != pic_list.end(); ++i) { |
| 186 if (!(*i)->LayerRect().Intersects(layer_rect) || !(*i)->HasRecording()) |
| 187 continue; |
| 188 if (!(*i)->IsCheapInRect(layer_rect)) |
| 189 return false; |
| 190 } |
| 191 } |
| 192 return true; |
| 193 } |
| 194 |
171 } // namespace cc | 195 } // namespace cc |
OLD | NEW |