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 <limits> | 8 #include <limits> |
9 #include <set> | 9 #include <set> |
10 | 10 |
(...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
62 | 62 |
63 PictureLayerImpl::Pair::~Pair() { | 63 PictureLayerImpl::Pair::~Pair() { |
64 } | 64 } |
65 | 65 |
66 PictureLayerImpl::PictureLayerImpl(LayerTreeImpl* tree_impl, | 66 PictureLayerImpl::PictureLayerImpl(LayerTreeImpl* tree_impl, |
67 int id, | 67 int id, |
68 bool is_mask) | 68 bool is_mask) |
69 : LayerImpl(tree_impl, id), | 69 : LayerImpl(tree_impl, id), |
70 twin_layer_(nullptr), | 70 twin_layer_(nullptr), |
71 tilings_(CreatePictureLayerTilingSet()), | 71 tilings_(CreatePictureLayerTilingSet()), |
72 // TODO(danakj): Can this be null to start? | |
73 raster_source_(PicturePileImpl::Create()), | |
74 ideal_page_scale_(0.f), | 72 ideal_page_scale_(0.f), |
75 ideal_device_scale_(0.f), | 73 ideal_device_scale_(0.f), |
76 ideal_source_scale_(0.f), | 74 ideal_source_scale_(0.f), |
77 ideal_contents_scale_(0.f), | 75 ideal_contents_scale_(0.f), |
78 raster_page_scale_(0.f), | 76 raster_page_scale_(0.f), |
79 raster_device_scale_(0.f), | 77 raster_device_scale_(0.f), |
80 raster_source_scale_(0.f), | 78 raster_source_scale_(0.f), |
81 raster_contents_scale_(0.f), | 79 raster_contents_scale_(0.f), |
82 low_res_raster_contents_scale_(0.f), | 80 low_res_raster_contents_scale_(0.f), |
83 raster_source_scale_is_fixed_(false), | 81 raster_source_scale_is_fixed_(false), |
(...skipping 489 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
573 scoped_refptr<RasterSource> raster_source, | 571 scoped_refptr<RasterSource> raster_source, |
574 Region* new_invalidation, | 572 Region* new_invalidation, |
575 const PictureLayerTilingSet* pending_set) { | 573 const PictureLayerTilingSet* pending_set) { |
576 // The bounds and the pile size may differ if the pile wasn't updated (ie. | 574 // The bounds and the pile size may differ if the pile wasn't updated (ie. |
577 // PictureLayer::Update didn't happen). In that case the pile will be empty. | 575 // PictureLayer::Update didn't happen). In that case the pile will be empty. |
578 DCHECK_IMPLIES(!raster_source->GetSize().IsEmpty(), | 576 DCHECK_IMPLIES(!raster_source->GetSize().IsEmpty(), |
579 bounds() == raster_source->GetSize()) | 577 bounds() == raster_source->GetSize()) |
580 << " bounds " << bounds().ToString() << " pile " | 578 << " bounds " << bounds().ToString() << " pile " |
581 << raster_source->GetSize().ToString(); | 579 << raster_source->GetSize().ToString(); |
582 | 580 |
583 bool could_have_tilings = CanHaveTilings(); | 581 // The |raster_source_| is initially null, so have to check for that for the |
582 // first frame. | |
583 bool could_have_tilings = raster_source_.get() && CanHaveTilings(); | |
vmpstr
2014/12/15 22:16:25
nit: It would be cleaner, albeit slower, if this c
danakj
2014/12/15 22:22:31
I think I prefer it here, I want to be clear that
| |
584 raster_source_.swap(raster_source); | 584 raster_source_.swap(raster_source); |
585 | 585 |
586 // The |new_invalidation| must be cleared before updating tilings since they | 586 // The |new_invalidation| must be cleared before updating tilings since they |
587 // access the invalidation through the PictureLayerTilingClient interface. | 587 // access the invalidation through the PictureLayerTilingClient interface. |
588 invalidation_.Clear(); | 588 invalidation_.Clear(); |
589 invalidation_.Swap(new_invalidation); | 589 invalidation_.Swap(new_invalidation); |
590 | 590 |
591 bool can_have_tilings = CanHaveTilings(); | 591 bool can_have_tilings = CanHaveTilings(); |
592 | 592 |
593 // Need to call UpdateTiles again if CanHaveTilings changed. | 593 // Need to call UpdateTiles again if CanHaveTilings changed. |
(...skipping 717 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1311 | 1311 |
1312 bool PictureLayerImpl::AllTilesRequiredForDrawAreReadyToDraw() const { | 1312 bool PictureLayerImpl::AllTilesRequiredForDrawAreReadyToDraw() const { |
1313 if (!layer_tree_impl()->IsActiveTree()) | 1313 if (!layer_tree_impl()->IsActiveTree()) |
1314 return true; | 1314 return true; |
1315 | 1315 |
1316 return AllTilesRequiredAreReadyToDraw( | 1316 return AllTilesRequiredAreReadyToDraw( |
1317 &PictureLayerTiling::IsTileRequiredForDrawIfVisible); | 1317 &PictureLayerTiling::IsTileRequiredForDrawIfVisible); |
1318 } | 1318 } |
1319 | 1319 |
1320 } // namespace cc | 1320 } // namespace cc |
OLD | NEW |