ozone: evdev: Sync caps lock LED state to evdev
[chromium-blink-merge.git] / cc / resources / tiling_set_raster_queue_all.h
blob5577c6c58aaf14b7936e30f9a13d6e7ca7595b49
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"
13 namespace cc {
15 // This queue returns all tiles required to be rasterized from HIGH_RESOLUTION
16 // and LOW_RESOLUTION tilings.
17 class CC_EXPORT TilingSetRasterQueueAll {
18 public:
19 TilingSetRasterQueueAll(PictureLayerTilingSet* tiling_set,
20 bool prioritize_low_res);
21 ~TilingSetRasterQueueAll();
23 Tile* Top();
24 const Tile* Top() const;
25 void Pop();
26 bool IsEmpty() const;
28 private:
29 class TilingIterator {
30 public:
31 TilingIterator();
32 explicit TilingIterator(PictureLayerTiling* tiling,
33 TilingData* tiling_data);
34 ~TilingIterator();
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 {
40 switch (phase_) {
41 case VISIBLE_RECT:
42 return TilePriority::NOW;
43 case SKEWPORT_RECT:
44 case SOON_BORDER_RECT:
45 return TilePriority::SOON;
46 case EVENTUALLY_RECT:
47 return TilePriority::EVENTUALLY;
49 NOTREACHED();
50 return TilePriority::EVENTUALLY;
53 TilingIterator& operator++();
55 private:
56 enum Phase {
57 VISIBLE_RECT,
58 SKEWPORT_RECT,
59 SOON_BORDER_RECT,
60 EVENTUALLY_RECT
63 void AdvancePhase();
64 bool TileNeedsRaster(Tile* tile) const {
65 return tile->NeedsRaster() && !tiling_->IsTileOccluded(tile);
68 PictureLayerTiling* tiling_;
69 TilingData* tiling_data_;
71 Phase phase_;
73 Tile* current_tile_;
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];
96 } // namespace cc
98 #endif // CC_RESOURCES_TILING_SET_RASTER_QUEUE_ALL_H_