| 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 865 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 876 contents_scale, | 876 contents_scale, |
| 877 rect); | 877 rect); |
| 878 iter; | 878 iter; |
| 879 ++iter) { | 879 ++iter) { |
| 880 Tile* tile = *iter; | 880 Tile* tile = *iter; |
| 881 // A null tile (i.e. missing recording) can just be skipped. | 881 // A null tile (i.e. missing recording) can just be skipped. |
| 882 if (!tile) | 882 if (!tile) |
| 883 continue; | 883 continue; |
| 884 | 884 |
| 885 // If the tile is occluded, don't mark it as required for activation. | 885 // If the tile is occluded, don't mark it as required for activation. |
| 886 if (tile->is_occluded()) | 886 if (tile->is_occluded(PENDING_TREE)) |
| 887 continue; | 887 continue; |
| 888 | 888 |
| 889 // If the missing region doesn't cover it, this tile is fully | 889 // If the missing region doesn't cover it, this tile is fully |
| 890 // covered by acceptable tiles at other scales. | 890 // covered by acceptable tiles at other scales. |
| 891 if (!missing_region.Intersects(iter.geometry_rect())) | 891 if (!missing_region.Intersects(iter.geometry_rect())) |
| 892 continue; | 892 continue; |
| 893 | 893 |
| 894 // If the twin tile doesn't exist (i.e. missing recording or so far away | 894 // If the twin tile doesn't exist (i.e. missing recording or so far away |
| 895 // that it is outside the visible tile rect) or this tile is shared between | 895 // that it is outside the visible tile rect) or this tile is shared between |
| 896 // with the twin, then this tile isn't required to prevent flashing. | 896 // with the twin, then this tile isn't required to prevent flashing. |
| (...skipping 557 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1454 | 1454 |
| 1455 stages_[2].iterator_type = HIGH_RES; | 1455 stages_[2].iterator_type = HIGH_RES; |
| 1456 stages_[2].tile_type = TilePriority::SOON; | 1456 stages_[2].tile_type = TilePriority::SOON; |
| 1457 | 1457 |
| 1458 stages_[3].iterator_type = HIGH_RES; | 1458 stages_[3].iterator_type = HIGH_RES; |
| 1459 stages_[3].tile_type = TilePriority::EVENTUALLY; | 1459 stages_[3].tile_type = TilePriority::EVENTUALLY; |
| 1460 | 1460 |
| 1461 IteratorType index = stages_[current_stage_].iterator_type; | 1461 IteratorType index = stages_[current_stage_].iterator_type; |
| 1462 TilePriority::PriorityBin tile_type = stages_[current_stage_].tile_type; | 1462 TilePriority::PriorityBin tile_type = stages_[current_stage_].tile_type; |
| 1463 if (!iterators_[index] || iterators_[index].get_type() != tile_type || | 1463 if (!iterators_[index] || iterators_[index].get_type() != tile_type || |
| 1464 (*iterators_[index])->is_occluded()) | 1464 (*iterators_[index])->is_occluded(tree)) |
| 1465 ++(*this); | 1465 ++(*this); |
| 1466 } | 1466 } |
| 1467 | 1467 |
| 1468 PictureLayerImpl::LayerRasterTileIterator::~LayerRasterTileIterator() {} | 1468 PictureLayerImpl::LayerRasterTileIterator::~LayerRasterTileIterator() {} |
| 1469 | 1469 |
| 1470 PictureLayerImpl::LayerRasterTileIterator::operator bool() const { | 1470 PictureLayerImpl::LayerRasterTileIterator::operator bool() const { |
| 1471 return layer_ && static_cast<size_t>(current_stage_) < arraysize(stages_); | 1471 return layer_ && static_cast<size_t>(current_stage_) < arraysize(stages_); |
| 1472 } | 1472 } |
| 1473 | 1473 |
| 1474 PictureLayerImpl::LayerRasterTileIterator& | 1474 PictureLayerImpl::LayerRasterTileIterator& |
| 1475 PictureLayerImpl::LayerRasterTileIterator:: | 1475 PictureLayerImpl::LayerRasterTileIterator:: |
| 1476 operator++() { | 1476 operator++() { |
| 1477 WhichTree tree = |
| 1478 layer_->layer_tree_impl()->IsActiveTree() ? ACTIVE_TREE : PENDING_TREE; |
| 1479 |
| 1477 IteratorType index = stages_[current_stage_].iterator_type; | 1480 IteratorType index = stages_[current_stage_].iterator_type; |
| 1478 TilePriority::PriorityBin tile_type = stages_[current_stage_].tile_type; | 1481 TilePriority::PriorityBin tile_type = stages_[current_stage_].tile_type; |
| 1479 | 1482 |
| 1480 // First advance the iterator. | 1483 // First advance the iterator. |
| 1481 if (iterators_[index]) | 1484 if (iterators_[index]) |
| 1482 ++iterators_[index]; | 1485 ++iterators_[index]; |
| 1483 | 1486 |
| 1484 while (iterators_[index] && iterators_[index].get_type() == tile_type && | 1487 while (iterators_[index] && iterators_[index].get_type() == tile_type && |
| 1485 (*iterators_[index])->is_occluded()) | 1488 (*iterators_[index])->is_occluded(tree)) |
| 1486 ++iterators_[index]; | 1489 ++iterators_[index]; |
| 1487 | 1490 |
| 1488 if (iterators_[index] && iterators_[index].get_type() == tile_type) | 1491 if (iterators_[index] && iterators_[index].get_type() == tile_type) |
| 1489 return *this; | 1492 return *this; |
| 1490 | 1493 |
| 1491 // Next, advance the stage. | 1494 // Next, advance the stage. |
| 1492 int stage_count = arraysize(stages_); | 1495 int stage_count = arraysize(stages_); |
| 1493 ++current_stage_; | 1496 ++current_stage_; |
| 1494 while (current_stage_ < stage_count) { | 1497 while (current_stage_ < stage_count) { |
| 1495 index = stages_[current_stage_].iterator_type; | 1498 index = stages_[current_stage_].iterator_type; |
| 1496 tile_type = stages_[current_stage_].tile_type; | 1499 tile_type = stages_[current_stage_].tile_type; |
| 1497 | 1500 |
| 1498 if (iterators_[index] && iterators_[index].get_type() == tile_type && | 1501 if (iterators_[index] && iterators_[index].get_type() == tile_type && |
| 1499 !(*iterators_[index])->is_occluded()) | 1502 !(*iterators_[index])->is_occluded(tree)) |
| 1500 break; | 1503 break; |
| 1501 ++current_stage_; | 1504 ++current_stage_; |
| 1502 } | 1505 } |
| 1503 return *this; | 1506 return *this; |
| 1504 } | 1507 } |
| 1505 | 1508 |
| 1506 Tile* PictureLayerImpl::LayerRasterTileIterator::operator*() { | 1509 Tile* PictureLayerImpl::LayerRasterTileIterator::operator*() { |
| 1507 DCHECK(*this); | 1510 DCHECK(*this); |
| 1508 | 1511 |
| 1509 IteratorType index = stages_[current_stage_].iterator_type; | 1512 IteratorType index = stages_[current_stage_].iterator_type; |
| (...skipping 124 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1634 return iterator_index_ < iterators_.size(); | 1637 return iterator_index_ < iterators_.size(); |
| 1635 } | 1638 } |
| 1636 | 1639 |
| 1637 bool PictureLayerImpl::LayerEvictionTileIterator::IsCorrectType( | 1640 bool PictureLayerImpl::LayerEvictionTileIterator::IsCorrectType( |
| 1638 PictureLayerTiling::TilingEvictionTileIterator* it) const { | 1641 PictureLayerTiling::TilingEvictionTileIterator* it) const { |
| 1639 return it->get_type() == iteration_stage_ && | 1642 return it->get_type() == iteration_stage_ && |
| 1640 (**it)->required_for_activation() == required_for_activation_; | 1643 (**it)->required_for_activation() == required_for_activation_; |
| 1641 } | 1644 } |
| 1642 | 1645 |
| 1643 } // namespace cc | 1646 } // namespace cc |
| OLD | NEW |