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 157 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
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 |
OLD | NEW |