| 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 | 9 |
| 10 #include "base/time/time.h" | 10 #include "base/time/time.h" |
| (...skipping 669 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 680 gfx::Rect layer_rect = pile_->tile_bounds(x, y); | 680 gfx::Rect layer_rect = pile_->tile_bounds(x, y); |
| 681 invalidation_.Union(layer_rect); | 681 invalidation_.Union(layer_rect); |
| 682 } | 682 } |
| 683 } | 683 } |
| 684 | 684 |
| 685 // Union in the other newly exposed regions as invalid. | 685 // Union in the other newly exposed regions as invalid. |
| 686 Region difference_region = Region(gfx::Rect(bounds())); | 686 Region difference_region = Region(gfx::Rect(bounds())); |
| 687 difference_region.Subtract(gfx::Rect(other->bounds())); | 687 difference_region.Subtract(gfx::Rect(other->bounds())); |
| 688 invalidation_.Union(difference_region); | 688 invalidation_.Union(difference_region); |
| 689 | 689 |
| 690 bool synced_high_res_tiling = false; |
| 690 if (CanHaveTilings()) { | 691 if (CanHaveTilings()) { |
| 691 tilings_->SyncTilings( | 692 synced_high_res_tiling = tilings_->SyncTilings( |
| 692 *other->tilings_, bounds(), invalidation_, MinimumContentsScale()); | 693 *other->tilings_, bounds(), invalidation_, MinimumContentsScale()); |
| 693 } else { | 694 } else { |
| 694 RemoveAllTilings(); | 695 RemoveAllTilings(); |
| 695 } | 696 } |
| 696 | 697 |
| 697 SanityCheckTilingState(); | 698 // If our MinimumContentsScale has changed to prevent the twin's high res |
| 699 // tiling from being synced, we should reset the raster scale and let it be |
| 700 // recalculated (1) again. This can happen if our bounds shrink to the point |
| 701 // where min contents scale grows. |
| 702 // (1) - TODO(vmpstr) Instead of hoping that this will be recalculated, we |
| 703 // should refactor this code a little bit and actually recalculate this. |
| 704 // However, this is a larger undertaking, so this will work for now. |
| 705 if (!synced_high_res_tiling) |
| 706 ResetRasterScale(); |
| 707 else |
| 708 SanityCheckTilingState(); |
| 698 } | 709 } |
| 699 | 710 |
| 700 void PictureLayerImpl::SyncTiling( | 711 void PictureLayerImpl::SyncTiling( |
| 701 const PictureLayerTiling* tiling) { | 712 const PictureLayerTiling* tiling) { |
| 702 if (!CanHaveTilingWithScale(tiling->contents_scale())) | 713 if (!CanHaveTilingWithScale(tiling->contents_scale())) |
| 703 return; | 714 return; |
| 704 tilings_->AddTiling(tiling->contents_scale()); | 715 tilings_->AddTiling(tiling->contents_scale()); |
| 705 | 716 |
| 706 // If this tree needs update draw properties, then the tiling will | 717 // If this tree needs update draw properties, then the tiling will |
| 707 // get updated prior to drawing or activation. If this tree does not | 718 // get updated prior to drawing or activation. If this tree does not |
| (...skipping 849 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1557 return iterator_index_ < iterators_.size(); | 1568 return iterator_index_ < iterators_.size(); |
| 1558 } | 1569 } |
| 1559 | 1570 |
| 1560 bool PictureLayerImpl::LayerEvictionTileIterator::IsCorrectType( | 1571 bool PictureLayerImpl::LayerEvictionTileIterator::IsCorrectType( |
| 1561 PictureLayerTiling::TilingEvictionTileIterator* it) const { | 1572 PictureLayerTiling::TilingEvictionTileIterator* it) const { |
| 1562 return it->get_type() == iteration_stage_ && | 1573 return it->get_type() == iteration_stage_ && |
| 1563 (**it)->required_for_activation() == required_for_activation_; | 1574 (**it)->required_for_activation() == required_for_activation_; |
| 1564 } | 1575 } |
| 1565 | 1576 |
| 1566 } // namespace cc | 1577 } // namespace cc |
| OLD | NEW |