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_H_
6 #define CC_RESOURCES_TILING_SET_RASTER_QUEUE_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 class CC_EXPORT TilingSetRasterQueue
{
17 TilingSetRasterQueue();
18 TilingSetRasterQueue(PictureLayerTilingSet
* tiling_set
,
19 bool prioritize_low_res
);
20 ~TilingSetRasterQueue();
23 const Tile
* Top() const;
28 class TilingIterator
{
31 explicit TilingIterator(PictureLayerTiling
* tiling
,
32 TilingData
* tiling_data
);
35 operator bool() const { return !!current_tile_
; }
36 const Tile
* operator*() const { return current_tile_
; }
37 Tile
* operator*() { return current_tile_
; }
38 TilePriority::PriorityBin
type() const {
41 return TilePriority::NOW
;
43 case SOON_BORDER_RECT
:
44 return TilePriority::SOON
;
46 return TilePriority::EVENTUALLY
;
49 return TilePriority::EVENTUALLY
;
52 TilingIterator
& operator++();
63 bool TileNeedsRaster(Tile
* tile
) const {
64 return tile
->NeedsRaster() && !tiling_
->IsTileOccluded(tile
);
67 PictureLayerTiling
* tiling_
;
68 TilingData
* tiling_data_
;
73 TilingData::Iterator visible_iterator_
;
74 TilingData::SpiralDifferenceIterator spiral_iterator_
;
77 enum IteratorType
{ LOW_RES
, HIGH_RES
, NUM_ITERATORS
};
79 void AdvanceToNextStage();
81 PictureLayerTilingSet
* tiling_set_
;
83 struct IterationStage
{
84 IteratorType iterator_type
;
85 TilePriority::PriorityBin tile_type
;
88 size_t current_stage_
;
90 // One low res stage, and three high res stages.
91 IterationStage stages_
[4];
92 TilingIterator iterators_
[NUM_ITERATORS
];
97 #endif // CC_RESOURCES_TILING_SET_RASTER_QUEUE_H_