diff options
author | hush@chromium.org <hush@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2014-07-31 09:09:33 +0000 |
---|---|---|
committer | hush@chromium.org <hush@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2014-07-31 09:09:33 +0000 |
commit | bd5324590122e686c34a66b1bbf7acbfc3fc73da (patch) | |
tree | 0f858d11bd9e26259206661e64be29be364e3caf /cc/layers/picture_layer_impl.cc | |
parent | 81314fe02b07b543a360ed442ef0085583bf4397 (diff) | |
download | chromium_src-bd5324590122e686c34a66b1bbf7acbfc3fc73da.zip chromium_src-bd5324590122e686c34a66b1bbf7acbfc3fc73da.tar.gz chromium_src-bd5324590122e686c34a66b1bbf7acbfc3fc73da.tar.bz2 |
Tiling priorities in Android Webview.
Use the parent compositor's clip and transform for tile
priorities in child compositor.
When the transform matrix changes in parent compositor
(hardware_renderer.cc), it posts the matrix and the clip to
the child compositor. (The parent clip is in screen space
and the parent matrix transforms from webview space to
screen space) Child compositor will use them for tile
prioritization.
In child compositor during updating tile priority, the clip
from parent is transformed from screen space to view space,
then from view space to content space. Then the result rect
will intersect with content_bounds() and the intersection
is used as tile priority input.
BUG=372073
Review URL: https://codereview.chromium.org/394113002
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@286731 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'cc/layers/picture_layer_impl.cc')
-rw-r--r-- | cc/layers/picture_layer_impl.cc | 23 |
1 files changed, 15 insertions, 8 deletions
diff --git a/cc/layers/picture_layer_impl.cc b/cc/layers/picture_layer_impl.cc index 179bd35..7bd66cd9 100644 --- a/cc/layers/picture_layer_impl.cc +++ b/cc/layers/picture_layer_impl.cc @@ -412,7 +412,8 @@ void PictureLayerImpl::UpdateTiles( // resourceless software draw, so don't update them. if (!layer_tree_impl()->resourceless_software_draw()) { visible_rect_for_tile_priority_ = visible_content_rect(); - viewport_size_for_tile_priority_ = layer_tree_impl()->DrawViewportSize(); + viewport_rect_for_tile_priority_ = + layer_tree_impl()->ViewportRectForTilePriority(); screen_space_transform_for_tile_priority_ = screen_space_transform(); } @@ -470,16 +471,22 @@ void PictureLayerImpl::UpdateTilePriorities( if (!tiling_needs_update) return; - // Use visible_content_rect, unless it's empty. If it's empty, then - // try to inverse project the viewport into layer space and use that. + // 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 + // that. Otherwise just use visible_rect_for_tile_priority_ gfx::Rect visible_rect_in_content_space = visible_rect_for_tile_priority_; - if (visible_rect_in_content_space.IsEmpty()) { - gfx::Transform screen_to_layer(gfx::Transform::kSkipInitialization); - if (screen_space_transform_for_tile_priority_.GetInverse( - &screen_to_layer)) { + + if (visible_rect_in_content_space.IsEmpty() || + layer_tree_impl()->DeviceViewport() != viewport_rect_for_tile_priority_) { + gfx::Transform view_to_layer(gfx::Transform::kSkipInitialization); + + if (screen_space_transform_for_tile_priority_.GetInverse(&view_to_layer)) { + // Transform from view space to content space. visible_rect_in_content_space = gfx::ToEnclosingRect(MathUtil::ProjectClippedRect( - screen_to_layer, gfx::Rect(viewport_size_for_tile_priority_))); + view_to_layer, viewport_rect_for_tile_priority_)); + visible_rect_in_content_space.Intersect(gfx::Rect(content_bounds())); } } |