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

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

Issue 1108773003: Revert of cc: Remove tile sharing from tilings. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years, 7 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
« no previous file with comments | « cc/resources/tiling_set_raster_queue_required.h ('k') | cc/test/fake_picture_layer_impl.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2014 The Chromium Authors. All rights reserved. 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 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/resources/tiling_set_raster_queue_required.h" 5 #include "cc/resources/tiling_set_raster_queue_required.h"
6 6
7 #include <utility> 7 #include <utility>
8 8
9 #include "cc/resources/picture_layer_tiling_set.h" 9 #include "cc/resources/picture_layer_tiling_set.h"
10 #include "cc/resources/tile.h" 10 #include "cc/resources/tile.h"
11 #include "cc/resources/tile_priority.h" 11 #include "cc/resources/tile_priority.h"
12 12
13 namespace cc { 13 namespace cc {
14 14
15 TilingSetRasterQueueRequired::TilingSetRasterQueueRequired( 15 TilingSetRasterQueueRequired::TilingSetRasterQueueRequired(
16 PictureLayerTilingSet* tiling_set, 16 PictureLayerTilingSet* tiling_set,
17 RasterTilePriorityQueue::Type type) 17 RasterTilePriorityQueue::Type type)
18 : type_(type) { 18 : type_(type) {
19 DCHECK_NE(static_cast<int>(type), 19 DCHECK_NE(static_cast<int>(type),
20 static_cast<int>(RasterTilePriorityQueue::Type::ALL)); 20 static_cast<int>(RasterTilePriorityQueue::Type::ALL));
21 21
22 // Required tiles should only come from HIGH_RESOLUTION tilings. However, if 22 // Any type of required tile would only come from a high resolution tiling.
23 // we want required for activation tiles on the active tree, then it will come 23 // The functions that determine this value is
24 // from tilings whose pending twin is high resolution. 24 // PictureLayerTiling::IsTileRequiredFor*, which all return false if the
25 PictureLayerTiling* tiling = nullptr; 25 // resolution is not HIGH_RESOLUTION.
26 if (type == RasterTilePriorityQueue::Type::REQUIRED_FOR_ACTIVATION && 26 PictureLayerTiling* tiling =
27 tiling_set->client()->GetTree() == ACTIVE_TREE) { 27 tiling_set->FindTilingWithResolution(HIGH_RESOLUTION);
28 for (size_t i = 0; i < tiling_set->num_tilings(); ++i) { 28 // If we don't have a high res tiling, then this queue will yield no tiles.
29 PictureLayerTiling* active_tiling = tiling_set->tiling_at(i); 29 // See PictureLayerImpl::CanHaveTilings for examples of when a HIGH_RESOLUTION
30 const PictureLayerTiling* pending_twin =
31 tiling_set->client()->GetPendingOrActiveTwinTiling(active_tiling);
32 if (pending_twin && pending_twin->resolution() == HIGH_RESOLUTION) {
33 tiling = active_tiling;
34 break;
35 }
36 }
37 } else {
38 tiling = tiling_set->FindTilingWithResolution(HIGH_RESOLUTION);
39 }
40
41 // If we don't have a tiling, then this queue will yield no tiles. See
42 // PictureLayerImpl::CanHaveTilings for examples of when a HIGH_RESOLUTION
43 // tiling would not be generated. 30 // tiling would not be generated.
44 if (!tiling) 31 if (!tiling)
45 return; 32 return;
46 33
47 if (type == RasterTilePriorityQueue::Type::REQUIRED_FOR_ACTIVATION) { 34 iterator_ = TilingIterator(tiling, &tiling->tiling_data_);
48 iterator_ = TilingIterator(tiling, &tiling->tiling_data_,
49 tiling->pending_visible_rect());
50 } else {
51 iterator_ = TilingIterator(tiling, &tiling->tiling_data_,
52 tiling->current_visible_rect());
53 }
54
55 while (!iterator_.done() && !IsTileRequired(*iterator_)) 35 while (!iterator_.done() && !IsTileRequired(*iterator_))
56 ++iterator_; 36 ++iterator_;
57 } 37 }
58 38
59 TilingSetRasterQueueRequired::~TilingSetRasterQueueRequired() { 39 TilingSetRasterQueueRequired::~TilingSetRasterQueueRequired() {
60 } 40 }
61 41
62 bool TilingSetRasterQueueRequired::IsEmpty() const { 42 bool TilingSetRasterQueueRequired::IsEmpty() const {
63 return iterator_.done(); 43 return iterator_.done();
64 } 44 }
(...skipping 21 matching lines...) Expand all
86 (type_ == RasterTilePriorityQueue::Type::REQUIRED_FOR_DRAW && 66 (type_ == RasterTilePriorityQueue::Type::REQUIRED_FOR_DRAW &&
87 tile->required_for_draw()); 67 tile->required_for_draw());
88 } 68 }
89 69
90 TilingSetRasterQueueRequired::TilingIterator::TilingIterator() 70 TilingSetRasterQueueRequired::TilingIterator::TilingIterator()
91 : tiling_(nullptr), current_tile_(nullptr) { 71 : tiling_(nullptr), current_tile_(nullptr) {
92 } 72 }
93 73
94 TilingSetRasterQueueRequired::TilingIterator::TilingIterator( 74 TilingSetRasterQueueRequired::TilingIterator::TilingIterator(
95 PictureLayerTiling* tiling, 75 PictureLayerTiling* tiling,
96 TilingData* tiling_data, 76 TilingData* tiling_data)
97 const gfx::Rect& rect)
98 : tiling_(tiling), tiling_data_(tiling_data), current_tile_(nullptr) { 77 : tiling_(tiling), tiling_data_(tiling_data), current_tile_(nullptr) {
78 if (!tiling_->has_visible_rect_tiles()) {
79 // Verify that if we would create the iterator, then it would be empty (ie
80 // it would return false when evaluated as a bool).
81 DCHECK(!TilingData::Iterator(tiling_data_, tiling->current_visible_rect(),
82 false));
83 return;
84 }
85
99 visible_iterator_ = 86 visible_iterator_ =
100 TilingData::Iterator(tiling_data_, rect, false /* include_borders */); 87 TilingData::Iterator(tiling_data_, tiling_->current_visible_rect(),
88 false /* include_borders */);
101 if (!visible_iterator_) 89 if (!visible_iterator_)
102 return; 90 return;
103 91
104 current_tile_ = 92 current_tile_ =
105 tiling_->TileAt(visible_iterator_.index_x(), visible_iterator_.index_y()); 93 tiling_->TileAt(visible_iterator_.index_x(), visible_iterator_.index_y());
106 94
107 // If this is a valid tile, return it. Note that we have to use a tiling check 95 // If this is a valid tile, return it. Note that we have to use a tiling check
108 // for occlusion, since the tile's internal state has not yet been updated. 96 // for occlusion, since the tile's internal state has not yet been updated.
109 if (current_tile_ && current_tile_->NeedsRaster() && 97 if (current_tile_ && current_tile_->NeedsRaster() &&
110 !tiling_->IsTileOccluded(current_tile_)) { 98 !tiling_->IsTileOccluded(current_tile_)) {
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after
144 // in the NOW bin, which means that it can be required. 132 // in the NOW bin, which means that it can be required.
145 break; 133 break;
146 } 134 }
147 135
148 if (current_tile_) 136 if (current_tile_)
149 tiling_->UpdateTileAndTwinPriority(current_tile_); 137 tiling_->UpdateTileAndTwinPriority(current_tile_);
150 return *this; 138 return *this;
151 } 139 }
152 140
153 } // namespace cc 141 } // namespace cc
OLDNEW
« no previous file with comments | « cc/resources/tiling_set_raster_queue_required.h ('k') | cc/test/fake_picture_layer_impl.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698