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 242 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
253 // unused can be considered for removal. | 253 // unused can be considered for removal. |
254 last_append_quads_tilings_.clear(); | 254 last_append_quads_tilings_.clear(); |
255 | 255 |
256 // Ignore missing tiles outside of viewport for tile priority. This is | 256 // Ignore missing tiles outside of viewport for tile priority. This is |
257 // normally the same as draw viewport but can be independently overridden by | 257 // normally the same as draw viewport but can be independently overridden by |
258 // embedders like Android WebView with SetExternalDrawConstraints. | 258 // embedders like Android WebView with SetExternalDrawConstraints. |
259 gfx::Rect scaled_viewport_for_tile_priority = gfx::ScaleToEnclosingRect( | 259 gfx::Rect scaled_viewport_for_tile_priority = gfx::ScaleToEnclosingRect( |
260 viewport_rect_for_tile_priority_in_content_space_, max_contents_scale); | 260 viewport_rect_for_tile_priority_in_content_space_, max_contents_scale); |
261 | 261 |
262 size_t missing_tile_count = 0u; | 262 size_t missing_tile_count = 0u; |
263 size_t on_demand_missing_tile_count = 0u; | |
264 only_used_low_res_last_append_quads_ = true; | 263 only_used_low_res_last_append_quads_ = true; |
265 for (PictureLayerTilingSet::CoverageIterator iter( | 264 for (PictureLayerTilingSet::CoverageIterator iter( |
266 tilings_.get(), max_contents_scale, | 265 tilings_.get(), max_contents_scale, |
267 shared_quad_state->visible_content_rect, ideal_contents_scale_); | 266 shared_quad_state->visible_content_rect, ideal_contents_scale_); |
268 iter; ++iter) { | 267 iter; ++iter) { |
269 gfx::Rect geometry_rect = iter.geometry_rect(); | 268 gfx::Rect geometry_rect = iter.geometry_rect(); |
270 gfx::Rect opaque_rect = contents_opaque() ? geometry_rect : gfx::Rect(); | 269 gfx::Rect opaque_rect = contents_opaque() ? geometry_rect : gfx::Rect(); |
271 gfx::Rect visible_geometry_rect = | 270 gfx::Rect visible_geometry_rect = |
272 scaled_occlusion.GetUnoccludedContentRect(geometry_rect); | 271 scaled_occlusion.GetUnoccludedContentRect(geometry_rect); |
273 if (visible_geometry_rect.IsEmpty()) | 272 if (visible_geometry_rect.IsEmpty()) |
274 continue; | 273 continue; |
275 | 274 |
276 append_quads_data->visible_content_area += | 275 append_quads_data->visible_content_area += |
277 visible_geometry_rect.width() * visible_geometry_rect.height(); | 276 visible_geometry_rect.width() * visible_geometry_rect.height(); |
278 | 277 |
278 bool raster_source_covers_tile = *iter; | |
brianderson
2015/05/16 02:39:57
Enne, Vlad: Is this correct?
vmpstr
2015/05/18 17:20:48
Not quite. We've talked about this offline a littl
enne (OOO)
2015/05/18 21:40:50
Yeah, false here means that the coverage iterator
| |
279 bool has_draw_quad = false; | 279 bool has_draw_quad = false; |
280 if (*iter && iter->IsReadyToDraw()) { | 280 if (!raster_source_covers_tile) { |
281 // If there's no raster source, we will definitely checkerboard. | |
282 append_quads_data->num_tiles_missing_raster_source++; | |
283 } else if (iter->IsReadyToDraw()) { | |
281 const TileDrawInfo& draw_info = iter->draw_info(); | 284 const TileDrawInfo& draw_info = iter->draw_info(); |
282 switch (draw_info.mode()) { | 285 switch (draw_info.mode()) { |
283 case TileDrawInfo::RESOURCE_MODE: { | 286 case TileDrawInfo::RESOURCE_MODE: { |
284 gfx::RectF texture_rect = iter.texture_rect(); | 287 gfx::RectF texture_rect = iter.texture_rect(); |
285 | 288 |
286 // The raster_contents_scale_ is the best scale that the layer is | 289 // The raster_contents_scale_ is the best scale that the layer is |
287 // trying to produce, even though it may not be ideal. Since that's | 290 // trying to produce, even though it may not be ideal. Since that's |
288 // the best the layer can promise in the future, consider those as | 291 // the best the layer can promise in the future, consider those as |
289 // complete. But if a tile is ideal scale, we don't want to consider | 292 // complete. But if a tile is ideal scale, we don't want to consider |
290 // it incomplete and trying to replace it with a tile at a worse | 293 // it incomplete and trying to replace it with a tile at a worse |
(...skipping 68 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
359 if (iter.resolution() != LOW_RESOLUTION) | 362 if (iter.resolution() != LOW_RESOLUTION) |
360 only_used_low_res_last_append_quads_ = false; | 363 only_used_low_res_last_append_quads_ = false; |
361 | 364 |
362 if (last_append_quads_tilings_.empty() || | 365 if (last_append_quads_tilings_.empty() || |
363 last_append_quads_tilings_.back() != iter.CurrentTiling()) { | 366 last_append_quads_tilings_.back() != iter.CurrentTiling()) { |
364 last_append_quads_tilings_.push_back(iter.CurrentTiling()); | 367 last_append_quads_tilings_.push_back(iter.CurrentTiling()); |
365 } | 368 } |
366 } | 369 } |
367 | 370 |
368 if (missing_tile_count) { | 371 if (missing_tile_count) { |
369 TRACE_EVENT_INSTANT2("cc", | 372 TRACE_EVENT_INSTANT1("cc", "PictureLayerImpl::AppendQuads checkerboard", |
370 "PictureLayerImpl::AppendQuads checkerboard", | 373 TRACE_EVENT_SCOPE_THREAD, "missing_tile_count", |
371 TRACE_EVENT_SCOPE_THREAD, | 374 missing_tile_count); |
372 "missing_tile_count", | |
373 missing_tile_count, | |
374 "on_demand_missing_tile_count", | |
375 on_demand_missing_tile_count); | |
376 } | 375 } |
377 | 376 |
378 // Aggressively remove any tilings that are not seen to save memory. Note | 377 // Aggressively remove any tilings that are not seen to save memory. Note |
379 // that this is at the expense of doing cause more frequent re-painting. A | 378 // that this is at the expense of doing cause more frequent re-painting. A |
380 // better scheme would be to maintain a tighter visible_content_rect for the | 379 // better scheme would be to maintain a tighter visible_content_rect for the |
381 // finer tilings. | 380 // finer tilings. |
382 CleanUpTilingsOnActiveLayer(last_append_quads_tilings_); | 381 CleanUpTilingsOnActiveLayer(last_append_quads_tilings_); |
383 } | 382 } |
384 | 383 |
385 bool PictureLayerImpl::UpdateTiles(bool resourceless_software_draw) { | 384 bool PictureLayerImpl::UpdateTiles(bool resourceless_software_draw) { |
(...skipping 857 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1243 | 1242 |
1244 bool PictureLayerImpl::IsOnActiveOrPendingTree() const { | 1243 bool PictureLayerImpl::IsOnActiveOrPendingTree() const { |
1245 return !layer_tree_impl()->IsRecycleTree(); | 1244 return !layer_tree_impl()->IsRecycleTree(); |
1246 } | 1245 } |
1247 | 1246 |
1248 bool PictureLayerImpl::HasValidTilePriorities() const { | 1247 bool PictureLayerImpl::HasValidTilePriorities() const { |
1249 return IsOnActiveOrPendingTree() && IsDrawnRenderSurfaceLayerListMember(); | 1248 return IsOnActiveOrPendingTree() && IsDrawnRenderSurfaceLayerListMember(); |
1250 } | 1249 } |
1251 | 1250 |
1252 } // namespace cc | 1251 } // namespace cc |
OLD | NEW |