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 <algorithm> | 5 #include <algorithm> |
6 #include <limits> | 6 #include <limits> |
7 | 7 |
8 #include "base/debug/trace_event.h" | 8 #include "base/debug/trace_event.h" |
9 #include "cc/base/region.h" | 9 #include "cc/base/region.h" |
10 #include "cc/debug/debug_colors.h" | 10 #include "cc/debug/debug_colors.h" |
(...skipping 152 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
163 // rects from the canvas. | 163 // rects from the canvas. |
164 // Note that in essence, we're trying to mimic clipRegion with intersect op | 164 // Note that in essence, we're trying to mimic clipRegion with intersect op |
165 // that also respects the current canvas transform and clip. In order to use | 165 // that also respects the current canvas transform and clip. In order to use |
166 // the canvas transform, we must stick to clipRect operations (clipRegion | 166 // the canvas transform, we must stick to clipRect operations (clipRegion |
167 // ignores the transform). Intersect then can be written as subtracting the | 167 // ignores the transform). Intersect then can be written as subtracting the |
168 // negation of the region we're trying to intersect. Luckily, we know that all | 168 // negation of the region we're trying to intersect. Luckily, we know that all |
169 // of the rects will have to fit into |content_rect|, so we can start with | 169 // of the rects will have to fit into |content_rect|, so we can start with |
170 // that and subtract chunk rects to get the region that we need to subtract | 170 // that and subtract chunk rects to get the region that we need to subtract |
171 // from the canvas. Then, we can use clipRect with difference op to subtract | 171 // from the canvas. Then, we can use clipRect with difference op to subtract |
172 // each rect in the region. | 172 // each rect in the region. |
173 for (TilingData::Iterator tile_iter(&tiling_, layer_rect); | 173 bool include_borders = true; |
174 tile_iter; ++tile_iter) { | 174 for (TilingData::Iterator tile_iter(&tiling_, layer_rect, include_borders); |
| 175 tile_iter; |
| 176 ++tile_iter) { |
175 PictureMap::iterator map_iter = picture_map_.find(tile_iter.index()); | 177 PictureMap::iterator map_iter = picture_map_.find(tile_iter.index()); |
176 if (map_iter == picture_map_.end()) | 178 if (map_iter == picture_map_.end()) |
177 continue; | 179 continue; |
178 PictureInfo& info = map_iter->second; | 180 PictureInfo& info = map_iter->second; |
179 Picture* picture = info.GetPicture(); | 181 Picture* picture = info.GetPicture(); |
180 if (!picture) | 182 if (!picture) |
181 continue; | 183 continue; |
182 | 184 |
183 // This is intentionally *enclosed* rect, so that the clip is aligned on | 185 // This is intentionally *enclosed* rect, so that the clip is aligned on |
184 // integral post-scale content pixels and does not extend past the edges | 186 // integral post-scale content pixels and does not extend past the edges |
(...skipping 158 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
343 } | 345 } |
344 | 346 |
345 PicturePileImpl::Analysis::~Analysis() { | 347 PicturePileImpl::Analysis::~Analysis() { |
346 } | 348 } |
347 | 349 |
348 PicturePileImpl::PixelRefIterator::PixelRefIterator( | 350 PicturePileImpl::PixelRefIterator::PixelRefIterator( |
349 const gfx::Rect& content_rect, | 351 const gfx::Rect& content_rect, |
350 float contents_scale, | 352 float contents_scale, |
351 const PicturePileImpl* picture_pile) | 353 const PicturePileImpl* picture_pile) |
352 : picture_pile_(picture_pile), | 354 : picture_pile_(picture_pile), |
353 layer_rect_(gfx::ScaleToEnclosingRect( | 355 layer_rect_( |
354 content_rect, 1.f / contents_scale)), | 356 gfx::ScaleToEnclosingRect(content_rect, 1.f / contents_scale)), |
355 tile_iterator_(&picture_pile_->tiling_, layer_rect_) { | 357 tile_iterator_(&picture_pile_->tiling_, layer_rect_, true) { |
| 358 // TODO(enne): tile iterator should not include borders |
| 359 |
356 // Early out if there isn't a single tile. | 360 // Early out if there isn't a single tile. |
357 if (!tile_iterator_) | 361 if (!tile_iterator_) |
358 return; | 362 return; |
359 | 363 |
360 AdvanceToTilePictureWithPixelRefs(); | 364 AdvanceToTilePictureWithPixelRefs(); |
361 } | 365 } |
362 | 366 |
363 PicturePileImpl::PixelRefIterator::~PixelRefIterator() { | 367 PicturePileImpl::PixelRefIterator::~PixelRefIterator() { |
364 } | 368 } |
365 | 369 |
(...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
401 ++it) { | 405 ++it) { |
402 Picture* picture = it->second.GetPicture(); | 406 Picture* picture = it->second.GetPicture(); |
403 if (picture && (processed_pictures.count(picture) == 0)) { | 407 if (picture && (processed_pictures.count(picture) == 0)) { |
404 picture->EmitTraceSnapshot(); | 408 picture->EmitTraceSnapshot(); |
405 processed_pictures.insert(picture); | 409 processed_pictures.insert(picture); |
406 } | 410 } |
407 } | 411 } |
408 } | 412 } |
409 | 413 |
410 } // namespace cc | 414 } // namespace cc |
OLD | NEW |