Chromium Code Reviews| Index: cc/layers/picture_layer_impl.cc |
| diff --git a/cc/layers/picture_layer_impl.cc b/cc/layers/picture_layer_impl.cc |
| index 8dbfeddcb3678952a21b3b7d7df368b5c9c3ca45..83218dd60ef9361e681a791c0a62f7382efe7a48 100644 |
| --- a/cc/layers/picture_layer_impl.cc |
| +++ b/cc/layers/picture_layer_impl.cc |
| @@ -264,6 +264,9 @@ void PictureLayerImpl::AppendQuads( |
| // unused can be considered for removal. |
| std::vector<PictureLayerTiling*> seen_tilings; |
| + gfx::Rect tile_rect = GetVisibleRectForTilePriorityInContentSpace(); |
|
danakj
2014/08/15 22:09:08
scaled_tile_priority_rect?
enne (OOO)
2014/08/15 22:33:50
"ForTilePriority" also seems not true anymore. Is
boliu
2014/08/15 23:07:26
How about something with activation, external_acti
|
| + tile_rect = gfx::ScaleToEnclosingRect(tile_rect, max_contents_scale); |
| + |
| size_t missing_tile_count = 0u; |
| size_t on_demand_missing_tile_count = 0u; |
| for (PictureLayerTilingSet::CoverageIterator iter(tilings_.get(), |
| @@ -290,8 +293,10 @@ void PictureLayerImpl::AppendQuads( |
| gfx::Rect opaque_rect = iter->opaque_rect(); |
| opaque_rect.Intersect(geometry_rect); |
| - if (iter->contents_scale() != ideal_contents_scale_) |
| + if (iter->contents_scale() != ideal_contents_scale_ && |
| + geometry_rect.Intersects(tile_rect)) { |
|
danakj
2014/08/15 21:43:44
We only iterate over the visible_content_rect in t
boliu
2014/08/15 21:56:26
Yes in chrome. No in webview.
In chrome, draw vie
danakj
2014/08/15 22:09:08
Maybe we need separate counts (or a bool) in Appen
hush (inactive)
2014/08/15 22:12:37
I'm not exactly sure about the scales of the rects
danakj
2014/08/15 22:20:45
geometry_rect is in the "geometry space" of the it
boliu
2014/08/15 22:33:42
I think we'll need a count then. One counts missin
hush (inactive)
2014/08/15 22:35:36
Thanks Dana!
So I suppose the dest_scale_ in Pictu
danakj
2014/08/15 22:36:06
Yeh
|
| append_quads_data->num_incomplete_tiles++; |
| + } |
| TileDrawQuad* quad = |
| render_pass->CreateAndAppendDrawQuad<TileDrawQuad>(); |
| @@ -364,10 +369,12 @@ void PictureLayerImpl::AppendQuads( |
| false); |
| } |
| - append_quads_data->num_missing_tiles++; |
| + if (geometry_rect.Intersects(tile_rect)) { |
| + append_quads_data->num_missing_tiles++; |
|
danakj
2014/08/15 21:43:44
num missing tiles is used for UMA metrics to tell
boliu
2014/08/15 21:56:26
In chrome, they will always intersect, so no chang
danakj
2014/08/15 22:09:08
This makes it hard to reason about when we're coun
|
| + ++missing_tile_count; |
| + } |
| append_quads_data->approximated_visible_content_area += |
| visible_geometry_rect.width() * visible_geometry_rect.height(); |
| - ++missing_tile_count; |
| continue; |
| } |
| @@ -472,6 +479,26 @@ void PictureLayerImpl::UpdateTilePriorities( |
| if (!tiling_needs_update) |
| return; |
| + gfx::Rect visible_layer_rect = gfx::ScaleToEnclosingRect( |
| + GetVisibleRectForTilePriorityInContentSpace(), 1.f / contents_scale_x()); |
| + WhichTree tree = |
| + layer_tree_impl()->IsActiveTree() ? ACTIVE_TREE : PENDING_TREE; |
| + for (size_t i = 0; i < tilings_->num_tilings(); ++i) { |
| + tilings_->tiling_at(i)->UpdateTilePriorities(tree, |
| + visible_layer_rect, |
| + ideal_contents_scale_, |
| + current_frame_time_in_seconds, |
| + occlusion_tracker, |
| + render_target(), |
| + draw_transform()); |
| + } |
| + |
| + // Tile priorities were modified. |
| + layer_tree_impl()->DidModifyTilePriorities(); |
| +} |
| + |
| +gfx::Rect PictureLayerImpl::GetVisibleRectForTilePriorityInContentSpace() |
| + const { |
| // If visible_rect_for_tile_priority_ is empty or |
| // viewport_rect_for_tile_priority_ is set to be different from the device |
| // viewport, try to inverse project the viewport into layer space and use |
| @@ -492,22 +519,7 @@ void PictureLayerImpl::UpdateTilePriorities( |
| } |
| } |
| - gfx::Rect visible_layer_rect = gfx::ScaleToEnclosingRect( |
| - visible_rect_in_content_space, 1.f / contents_scale_x()); |
| - WhichTree tree = |
| - layer_tree_impl()->IsActiveTree() ? ACTIVE_TREE : PENDING_TREE; |
| - for (size_t i = 0; i < tilings_->num_tilings(); ++i) { |
| - tilings_->tiling_at(i)->UpdateTilePriorities(tree, |
| - visible_layer_rect, |
| - ideal_contents_scale_, |
| - current_frame_time_in_seconds, |
| - occlusion_tracker, |
| - render_target(), |
| - draw_transform()); |
| - } |
| - |
| - // Tile priorities were modified. |
| - layer_tree_impl()->DidModifyTilePriorities(); |
| + return visible_rect_in_content_space; |
| } |
| void PictureLayerImpl::NotifyTileStateChanged(const Tile* tile) { |
| @@ -764,6 +776,7 @@ void PictureLayerImpl::MarkVisibleResourcesAsRequired() const { |
| return; |
| gfx::Rect rect(visible_content_rect()); |
| + rect.Intersect(GetVisibleRectForTilePriorityInContentSpace()); |
|
hush (inactive)
2014/08/15 21:53:18
I think you need to early out when intersection is
danakj
2014/08/15 22:09:08
Why are we intersecting instead of just using the
boliu
2014/08/15 22:33:42
MarkRequiredOffscreenTiles test uses a GetVisibleR
boliu
2014/08/15 23:07:26
This is actually kinda hard to do in webview code.
|
| float min_acceptable_scale = |
| std::min(raster_contents_scale_, ideal_contents_scale_); |