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