OLD | NEW |
1 // Copyright 2012 The Chromium Authors. All rights reserved. | 1 // Copyright 2012 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/layers/picture_layer_impl.h" | 5 #include "cc/layers/picture_layer_impl.h" |
6 | 6 |
7 #include <algorithm> | 7 #include <algorithm> |
8 #include <cmath> | 8 #include <cmath> |
9 #include <limits> | 9 #include <limits> |
10 #include <set> | 10 #include <set> |
(...skipping 1209 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1220 } | 1220 } |
1221 | 1221 |
1222 bool PictureLayerImpl::IsOnActiveOrPendingTree() const { | 1222 bool PictureLayerImpl::IsOnActiveOrPendingTree() const { |
1223 return !layer_tree_impl()->IsRecycleTree(); | 1223 return !layer_tree_impl()->IsRecycleTree(); |
1224 } | 1224 } |
1225 | 1225 |
1226 bool PictureLayerImpl::HasValidTilePriorities() const { | 1226 bool PictureLayerImpl::HasValidTilePriorities() const { |
1227 return IsOnActiveOrPendingTree() && IsDrawnRenderSurfaceLayerListMember(); | 1227 return IsOnActiveOrPendingTree() && IsDrawnRenderSurfaceLayerListMember(); |
1228 } | 1228 } |
1229 | 1229 |
1230 bool PictureLayerImpl::AllTilesRequiredAreReadyToDraw( | |
1231 TileRequirementCheck is_tile_required_callback) const { | |
1232 if (!HasValidTilePriorities()) | |
1233 return true; | |
1234 | |
1235 if (!tilings_) | |
1236 return true; | |
1237 | |
1238 if (visible_rect_for_tile_priority_.IsEmpty()) | |
1239 return true; | |
1240 | |
1241 gfx::Rect rect = viewport_rect_for_tile_priority_in_content_space_; | |
1242 rect.Intersect(visible_rect_for_tile_priority_); | |
1243 | |
1244 // The high resolution tiling is the only tiling that can mark tiles as | |
1245 // requiring either draw or activation. There is an explicit check in those | |
1246 // callbacks to return false if they are not high resolution tilings. This | |
1247 // check needs to remain since there are other callers of that function that | |
1248 // rely on it. However, for the purposes of this function, we don't have to | |
1249 // check other tilings. | |
1250 PictureLayerTiling* tiling = | |
1251 tilings_->FindTilingWithResolution(HIGH_RESOLUTION); | |
1252 if (!tiling) | |
1253 return true; | |
1254 | |
1255 for (PictureLayerTiling::CoverageIterator iter(tiling, 1.f, rect); iter; | |
1256 ++iter) { | |
1257 const Tile* tile = *iter; | |
1258 // A null tile (i.e. missing recording) can just be skipped. | |
1259 // TODO(vmpstr): Verify this is true if we create tiles in raster | |
1260 // iterators. | |
1261 if (!tile) | |
1262 continue; | |
1263 | |
1264 // We can't check tile->required_for_activation, because that value might | |
1265 // be out of date. It is updated in the raster/eviction iterators. | |
1266 // TODO(vmpstr): Remove the comment once you can't access this information | |
1267 // from the tile. | |
1268 if ((tiling->*is_tile_required_callback)(tile) && !tile->IsReadyToDraw()) { | |
1269 TRACE_EVENT_INSTANT0("cc", "Tile required, but not ready to draw.", | |
1270 TRACE_EVENT_SCOPE_THREAD); | |
1271 return false; | |
1272 } | |
1273 } | |
1274 | |
1275 return true; | |
1276 } | |
1277 | |
1278 bool PictureLayerImpl::AllTilesRequiredForActivationAreReadyToDraw() const { | |
1279 if (!layer_tree_impl()->IsPendingTree()) | |
1280 return true; | |
1281 | |
1282 return AllTilesRequiredAreReadyToDraw( | |
1283 &PictureLayerTiling::IsTileRequiredForActivationIfVisible); | |
1284 } | |
1285 | |
1286 bool PictureLayerImpl::AllTilesRequiredForDrawAreReadyToDraw() const { | |
1287 if (!layer_tree_impl()->IsActiveTree()) | |
1288 return true; | |
1289 | |
1290 return AllTilesRequiredAreReadyToDraw( | |
1291 &PictureLayerTiling::IsTileRequiredForDrawIfVisible); | |
1292 } | |
1293 | |
1294 } // namespace cc | 1230 } // namespace cc |
OLD | NEW |