Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(105)

Side by Side Diff: cc/resources/tiling_set_raster_queue_required.cc

Issue 816453008: cc: Split tiling set raster queues into all and required. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: todos Created 5 years, 11 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
(Empty)
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.
4
5 #include "cc/resources/tiling_set_raster_queue_required.h"
6
7 #include <utility>
8
9 #include "cc/resources/picture_layer_tiling_set.h"
10 #include "cc/resources/tile.h"
11 #include "cc/resources/tile_priority.h"
12
13 namespace cc {
14
15 TilingSetRasterQueueRequired::TilingSetRasterQueueRequired(
16 PictureLayerTilingSet* tiling_set,
17 RasterTilePriorityQueue::Type type)
18 : type_(type) {
19 DCHECK(type != RasterTilePriorityQueue::Type::ALL);
danakj 2015/01/08 23:24:41 DCHECK_NE?
vmpstr 2015/01/09 20:21:40 Since it's an enum class it would require a non-ex
danakj 2015/01/09 20:28:22 Can you static cast them to ints? If that's terrib
vmpstr 2015/01/09 20:52:42 Done.
20 DCHECK(tiling_set);
danakj 2015/01/08 23:24:41 nit: not really doing anything, we'll crash when w
vmpstr 2015/01/09 20:21:40 Done.
21
22 PictureLayerTiling* tiling =
danakj 2015/01/08 23:24:41 can you leave a comment about why highres is enoug
vmpstr 2015/01/09 20:21:41 Done.
23 tiling_set->FindTilingWithResolution(HIGH_RESOLUTION);
24 DCHECK(tiling);
25 iterator_ = TilingIterator(tiling, &tiling->tiling_data_);
26 while (iterator_ && !IsTileRequired(*iterator_))
27 ++iterator_;
28 }
29
30 TilingSetRasterQueueRequired::~TilingSetRasterQueueRequired() {
31 }
32
33 bool TilingSetRasterQueueRequired::IsEmpty() const {
34 return !iterator_;
35 }
36
37 void TilingSetRasterQueueRequired::Pop() {
38 DCHECK(!IsEmpty());
39 ++iterator_;
40 while (iterator_ && !IsTileRequired(*iterator_))
41 ++iterator_;
42 }
43
44 Tile* TilingSetRasterQueueRequired::Top() {
45 DCHECK(!IsEmpty());
46 return *iterator_;
47 }
48
49 const Tile* TilingSetRasterQueueRequired::Top() const {
50 DCHECK(!IsEmpty());
51 return *iterator_;
52 }
53
54 bool TilingSetRasterQueueRequired::IsTileRequired(const Tile* tile) const {
55 return (type_ == RasterTilePriorityQueue::Type::REQUIRED_FOR_ACTIVATION &&
56 tile->required_for_activation()) ||
57 (type_ == RasterTilePriorityQueue::Type::REQUIRED_FOR_DRAW &&
58 tile->required_for_draw());
59 }
60
61 TilingSetRasterQueueRequired::TilingIterator::TilingIterator()
62 : tiling_(NULL), current_tile_(NULL) {
danakj 2015/01/08 23:24:41 nullptr
vmpstr 2015/01/09 20:21:40 Done.
63 }
64
65 TilingSetRasterQueueRequired::TilingIterator::TilingIterator(
66 PictureLayerTiling* tiling,
67 TilingData* tiling_data)
68 : tiling_(tiling), tiling_data_(tiling_data), current_tile_(NULL) {
danakj 2015/01/08 23:24:41 nullptr
vmpstr 2015/01/09 20:21:40 Done.
69 if (!tiling_->has_visible_rect_tiles())
danakj 2015/01/08 23:24:41 Should we have some kinda tests for this condition
vmpstr 2015/01/09 20:21:40 I added a DCHECK, let me know if that's what you m
70 return;
71
72 visible_iterator_ =
73 TilingData::Iterator(tiling_data_, tiling_->current_visible_rect(),
74 false /* include_borders */);
75 if (!visible_iterator_)
76 return;
77
78 current_tile_ =
79 tiling_->TileAt(visible_iterator_.index_x(), visible_iterator_.index_y());
80 if (current_tile_ && TileNeedsRaster(current_tile_)) {
81 tiling_->UpdateTileAndTwinPriority(current_tile_);
82 return;
83 }
84 ++(*this);
85 }
86
87 TilingSetRasterQueueRequired::TilingIterator::~TilingIterator() {
88 }
89
90 TilingSetRasterQueueRequired::TilingIterator&
91 TilingSetRasterQueueRequired::TilingIterator::
92 operator++() {
93 do {
94 ++visible_iterator_;
95 if (!visible_iterator_) {
96 current_tile_ = NULL;
97 return *this;
98 }
99 std::pair<int, int> next_index = visible_iterator_.index();
100 current_tile_ = tiling_->TileAt(next_index.first, next_index.second);
101 } while (!current_tile_ || !TileNeedsRaster(current_tile_));
danakj 2015/01/08 23:24:41 TileNeedsRaster uses occlusion to determine if it
vmpstr 2015/01/09 20:21:40 I understand. I've changed this code around a bit
danakj 2015/01/12 18:23:13 Ya this is great, thank you for nice comments.
102
103 if (current_tile_)
104 tiling_->UpdateTileAndTwinPriority(current_tile_);
105 return *this;
106 }
107
108 } // namespace cc
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698