1 // Copyright 2014 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
5 #ifndef CC_RESOURCES_TILING_SET_RASTER_QUEUE_ALL_H_
6 #define CC_RESOURCES_TILING_SET_RASTER_QUEUE_ALL_H_
8 #include "cc/base/cc_export.h"
9 #include "cc/resources/picture_layer_tiling_set.h"
10 #include "cc/resources/tile.h"
11 #include "cc/resources/tile_priority.h"
15 // This queue returns all tiles required to be rasterized from HIGH_RESOLUTION
16 // and LOW_RESOLUTION tilings.
17 class CC_EXPORT TilingSetRasterQueueAll
{
19 TilingSetRasterQueueAll(PictureLayerTilingSet
* tiling_set
,
20 bool prioritize_low_res
);
21 ~TilingSetRasterQueueAll();
24 const Tile
* Top() const;
29 class TilingIterator
{
32 explicit TilingIterator(PictureLayerTiling
* tiling
,
33 TilingData
* tiling_data
);
36 bool done() const { return current_tile_
== nullptr; }
37 const Tile
* operator*() const { return current_tile_
; }
38 Tile
* operator*() { return current_tile_
; }
39 TilePriority::PriorityBin
type() const {
42 return TilePriority::NOW
;
44 case SOON_BORDER_RECT
:
45 return TilePriority::SOON
;
47 return TilePriority::EVENTUALLY
;
50 return TilePriority::EVENTUALLY
;
53 TilingIterator
& operator++();
64 bool TileNeedsRaster(Tile
* tile
) const {
65 return tile
->NeedsRaster() && !tiling_
->IsTileOccluded(tile
);
68 PictureLayerTiling
* tiling_
;
69 TilingData
* tiling_data_
;
74 TilingData::Iterator visible_iterator_
;
75 TilingData::SpiralDifferenceIterator spiral_iterator_
;
78 enum IteratorType
{ LOW_RES
, HIGH_RES
, NUM_ITERATORS
};
80 void AdvanceToNextStage();
82 PictureLayerTilingSet
* tiling_set_
;
84 struct IterationStage
{
85 IteratorType iterator_type
;
86 TilePriority::PriorityBin tile_type
;
89 size_t current_stage_
;
91 // One low res stage, and three high res stages.
92 IterationStage stages_
[4];
93 TilingIterator iterators_
[NUM_ITERATORS
];
98 #endif // CC_RESOURCES_TILING_SET_RASTER_QUEUE_ALL_H_