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 1550 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1561 | 1561 |
1562 stages_[2].iterator_type = HIGH_RES; | 1562 stages_[2].iterator_type = HIGH_RES; |
1563 stages_[2].tile_type = TilePriority::SOON; | 1563 stages_[2].tile_type = TilePriority::SOON; |
1564 | 1564 |
1565 stages_[3].iterator_type = HIGH_RES; | 1565 stages_[3].iterator_type = HIGH_RES; |
1566 stages_[3].tile_type = TilePriority::EVENTUALLY; | 1566 stages_[3].tile_type = TilePriority::EVENTUALLY; |
1567 | 1567 |
1568 IteratorType index = stages_[current_stage_].iterator_type; | 1568 IteratorType index = stages_[current_stage_].iterator_type; |
1569 TilePriority::PriorityBin tile_type = stages_[current_stage_].tile_type; | 1569 TilePriority::PriorityBin tile_type = stages_[current_stage_].tile_type; |
1570 if (!iterators_[index] || iterators_[index].get_type() != tile_type) | 1570 if (!iterators_[index] || iterators_[index].get_type() != tile_type) |
1571 ++(*this); | 1571 AdvanceToNextStage(); |
1572 } | 1572 } |
1573 | 1573 |
1574 PictureLayerImpl::LayerRasterTileIterator::~LayerRasterTileIterator() {} | 1574 PictureLayerImpl::LayerRasterTileIterator::~LayerRasterTileIterator() {} |
1575 | 1575 |
1576 PictureLayerImpl::LayerRasterTileIterator::operator bool() const { | 1576 PictureLayerImpl::LayerRasterTileIterator::operator bool() const { |
1577 return current_stage_ < arraysize(stages_); | 1577 return current_stage_ < arraysize(stages_); |
1578 } | 1578 } |
1579 | 1579 |
1580 PictureLayerImpl::LayerRasterTileIterator& | 1580 PictureLayerImpl::LayerRasterTileIterator& |
1581 PictureLayerImpl::LayerRasterTileIterator:: | 1581 PictureLayerImpl::LayerRasterTileIterator:: |
1582 operator++() { | 1582 operator++() { |
1583 IteratorType index = stages_[current_stage_].iterator_type; | 1583 IteratorType index = stages_[current_stage_].iterator_type; |
1584 TilePriority::PriorityBin tile_type = stages_[current_stage_].tile_type; | 1584 TilePriority::PriorityBin tile_type = stages_[current_stage_].tile_type; |
1585 | 1585 |
1586 // First advance the iterator. | 1586 // First advance the iterator. |
1587 if (iterators_[index]) | 1587 DCHECK(iterators_[index]); |
1588 ++iterators_[index]; | 1588 DCHECK(iterators_[index].get_type() == tile_type); |
| 1589 ++iterators_[index]; |
1589 | 1590 |
1590 if (iterators_[index] && iterators_[index].get_type() == tile_type) | 1591 if (!iterators_[index] || iterators_[index].get_type() != tile_type) |
1591 return *this; | 1592 AdvanceToNextStage(); |
1592 | 1593 |
1593 // Next, advance the stage. | |
1594 ++current_stage_; | |
1595 while (current_stage_ < arraysize(stages_)) { | |
1596 index = stages_[current_stage_].iterator_type; | |
1597 tile_type = stages_[current_stage_].tile_type; | |
1598 | |
1599 if (iterators_[index] && iterators_[index].get_type() == tile_type) | |
1600 break; | |
1601 ++current_stage_; | |
1602 } | |
1603 return *this; | 1594 return *this; |
1604 } | 1595 } |
1605 | 1596 |
1606 Tile* PictureLayerImpl::LayerRasterTileIterator::operator*() { | 1597 Tile* PictureLayerImpl::LayerRasterTileIterator::operator*() { |
1607 DCHECK(*this); | 1598 DCHECK(*this); |
1608 | 1599 |
1609 IteratorType index = stages_[current_stage_].iterator_type; | 1600 IteratorType index = stages_[current_stage_].iterator_type; |
1610 DCHECK(iterators_[index]); | 1601 DCHECK(iterators_[index]); |
1611 DCHECK(iterators_[index].get_type() == stages_[current_stage_].tile_type); | 1602 DCHECK(iterators_[index].get_type() == stages_[current_stage_].tile_type); |
1612 | 1603 |
1613 return *iterators_[index]; | 1604 return *iterators_[index]; |
1614 } | 1605 } |
1615 | 1606 |
1616 const Tile* PictureLayerImpl::LayerRasterTileIterator::operator*() const { | 1607 const Tile* PictureLayerImpl::LayerRasterTileIterator::operator*() const { |
1617 DCHECK(*this); | 1608 DCHECK(*this); |
1618 | 1609 |
1619 IteratorType index = stages_[current_stage_].iterator_type; | 1610 IteratorType index = stages_[current_stage_].iterator_type; |
1620 DCHECK(iterators_[index]); | 1611 DCHECK(iterators_[index]); |
1621 DCHECK(iterators_[index].get_type() == stages_[current_stage_].tile_type); | 1612 DCHECK(iterators_[index].get_type() == stages_[current_stage_].tile_type); |
1622 | 1613 |
1623 return *iterators_[index]; | 1614 return *iterators_[index]; |
1624 } | 1615 } |
1625 | 1616 |
| 1617 void PictureLayerImpl::LayerRasterTileIterator::AdvanceToNextStage() { |
| 1618 DCHECK_LT(current_stage_, arraysize(stages_)); |
| 1619 ++current_stage_; |
| 1620 while (current_stage_ < arraysize(stages_)) { |
| 1621 IteratorType index = stages_[current_stage_].iterator_type; |
| 1622 TilePriority::PriorityBin tile_type = stages_[current_stage_].tile_type; |
| 1623 |
| 1624 if (iterators_[index] && iterators_[index].get_type() == tile_type) |
| 1625 break; |
| 1626 ++current_stage_; |
| 1627 } |
| 1628 } |
| 1629 |
1626 PictureLayerImpl::LayerEvictionTileIterator::LayerEvictionTileIterator() | 1630 PictureLayerImpl::LayerEvictionTileIterator::LayerEvictionTileIterator() |
1627 : layer_(NULL), | 1631 : layer_(NULL), |
1628 tree_priority_(SAME_PRIORITY_FOR_BOTH_TREES), | 1632 tree_priority_(SAME_PRIORITY_FOR_BOTH_TREES), |
1629 current_category_(PictureLayerTiling::EVENTUALLY), | 1633 current_category_(PictureLayerTiling::EVENTUALLY), |
1630 current_tiling_range_type_(PictureLayerTilingSet::HIGHER_THAN_HIGH_RES), | 1634 current_tiling_range_type_(PictureLayerTilingSet::HIGHER_THAN_HIGH_RES), |
1631 current_tiling_(0u) { | 1635 current_tiling_(0u) { |
1632 } | 1636 } |
1633 | 1637 |
1634 PictureLayerImpl::LayerEvictionTileIterator::LayerEvictionTileIterator( | 1638 PictureLayerImpl::LayerEvictionTileIterator::LayerEvictionTileIterator( |
1635 PictureLayerImpl* layer, | 1639 PictureLayerImpl* layer, |
(...skipping 134 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1770 PictureLayerTilingSet::TilingRange tiling_range = CurrentTilingRange(); | 1774 PictureLayerTilingSet::TilingRange tiling_range = CurrentTilingRange(); |
1771 size_t current_tiling_range_offset = current_tiling_ - tiling_range.start; | 1775 size_t current_tiling_range_offset = current_tiling_ - tiling_range.start; |
1772 return tiling_range.end - 1 - current_tiling_range_offset; | 1776 return tiling_range.end - 1 - current_tiling_range_offset; |
1773 } | 1777 } |
1774 } | 1778 } |
1775 NOTREACHED(); | 1779 NOTREACHED(); |
1776 return 0; | 1780 return 0; |
1777 } | 1781 } |
1778 | 1782 |
1779 } // namespace cc | 1783 } // namespace cc |
OLD | NEW |