Chromium Code Reviews| 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 "cc/layers/picture_layer_impl.h" | 5 #include "cc/layers/picture_layer_impl.h" |
| 6 | 6 |
| 7 #include <algorithm> | 7 #include <algorithm> |
| 8 #include <cmath> | 8 #include <cmath> |
| 9 #include <limits> | 9 #include <limits> |
| 10 #include <set> | 10 #include <set> |
| (...skipping 587 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 598 // To avoid an edge case after lost context where the tree is up to date but | 598 // To avoid an edge case after lost context where the tree is up to date but |
| 599 // the tilings have not been managed, request an update draw properties | 599 // the tilings have not been managed, request an update draw properties |
| 600 // to force tilings to get managed. | 600 // to force tilings to get managed. |
| 601 layer_tree_impl()->set_needs_update_draw_properties(); | 601 layer_tree_impl()->set_needs_update_draw_properties(); |
| 602 } | 602 } |
| 603 | 603 |
| 604 skia::RefPtr<SkPicture> PictureLayerImpl::GetPicture() { | 604 skia::RefPtr<SkPicture> PictureLayerImpl::GetPicture() { |
| 605 return raster_source_->GetFlattenedPicture(); | 605 return raster_source_->GetFlattenedPicture(); |
| 606 } | 606 } |
| 607 | 607 |
| 608 Region PictureLayerImpl::GetInvalidationRegion() { | |
| 609 // PictureLayerImpl::invalidation_ is not cleared in the same was as | |
|
danakj
2015/03/02 20:10:53
I think I'd reword this a bit.. "truth" is subject
| |
| 610 // LayerImpl::update_rect_ is and thus might not give the true state of the | |
| 611 // current invalidations at all time. | |
| 612 // Ideally, update_rect_ of LayerImpl would be replaced completely by | |
| 613 // invalidation_ region as it give thighter bounds but this might be | |
| 614 // to much overhead based on where update_rect_ is used today. | |
| 615 // That's why we intersect invalidation_ with the update_rect to get the | |
| 616 // true invalidations of the present frame. | |
| 617 Region current_invalidation(invalidation_); | |
|
danakj
2015/03/02 20:10:53
you can do this whole thing as
return IntersectRe
daplatz
2015/03/02 20:28:02
Acknowledged.
| |
| 618 current_invalidation.Intersect(update_rect()); | |
| 619 return current_invalidation; | |
| 620 } | |
| 621 | |
| 608 scoped_refptr<Tile> PictureLayerImpl::CreateTile( | 622 scoped_refptr<Tile> PictureLayerImpl::CreateTile( |
| 609 float contents_scale, | 623 float contents_scale, |
| 610 const gfx::Rect& content_rect) { | 624 const gfx::Rect& content_rect) { |
| 611 int flags = 0; | 625 int flags = 0; |
| 612 | 626 |
| 613 // We don't handle solid color masks, so we shouldn't bother analyzing those. | 627 // We don't handle solid color masks, so we shouldn't bother analyzing those. |
| 614 // Otherwise, always analyze to maximize memory savings. | 628 // Otherwise, always analyze to maximize memory savings. |
| 615 if (!is_mask_) | 629 if (!is_mask_) |
| 616 flags = Tile::USE_PICTURE_ANALYSIS; | 630 flags = Tile::USE_PICTURE_ANALYSIS; |
| 617 | 631 |
| (...skipping 601 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1219 | 1233 |
| 1220 bool PictureLayerImpl::IsOnActiveOrPendingTree() const { | 1234 bool PictureLayerImpl::IsOnActiveOrPendingTree() const { |
| 1221 return !layer_tree_impl()->IsRecycleTree(); | 1235 return !layer_tree_impl()->IsRecycleTree(); |
| 1222 } | 1236 } |
| 1223 | 1237 |
| 1224 bool PictureLayerImpl::HasValidTilePriorities() const { | 1238 bool PictureLayerImpl::HasValidTilePriorities() const { |
| 1225 return IsOnActiveOrPendingTree() && IsDrawnRenderSurfaceLayerListMember(); | 1239 return IsOnActiveOrPendingTree() && IsDrawnRenderSurfaceLayerListMember(); |
| 1226 } | 1240 } |
| 1227 | 1241 |
| 1228 } // namespace cc | 1242 } // namespace cc |
| OLD | NEW |