| Index: cc/resources/picture_layer_tiling.cc
|
| diff --git a/cc/resources/picture_layer_tiling.cc b/cc/resources/picture_layer_tiling.cc
|
| index 033f9f6a7116ee1cf241885b4ae9d55ceeb2a07b..1e7281d6fdc4259f2f85eeacc93157b41884acb0 100644
|
| --- a/cc/resources/picture_layer_tiling.cc
|
| +++ b/cc/resources/picture_layer_tiling.cc
|
| @@ -23,7 +23,8 @@
|
| namespace cc {
|
| namespace {
|
|
|
| -const float kSoonBorderDistanceInScreenPixels = 312.f;
|
| +const float kSoonBorderDistanceViewportPercentage = 0.15f;
|
| +const float kMaxSoonBorderDistanceInScreenPixels = 312.f;
|
|
|
| } // namespace
|
|
|
| @@ -83,6 +84,17 @@ PictureLayerTiling::~PictureLayerTiling() {
|
| it->second->set_shared(false);
|
| }
|
|
|
| +// static
|
| +float PictureLayerTiling::CalculateSoonBorderDistance(
|
| + const gfx::Rect& visible_rect_in_content_space,
|
| + float content_to_screen_scale) {
|
| + float max_dimension = std::max(visible_rect_in_content_space.width(),
|
| + visible_rect_in_content_space.height());
|
| + return std::min(
|
| + kMaxSoonBorderDistanceInScreenPixels / content_to_screen_scale,
|
| + max_dimension * kSoonBorderDistanceViewportPercentage);
|
| +}
|
| +
|
| Tile* PictureLayerTiling::CreateTile(int i,
|
| int j,
|
| const PictureLayerTiling* twin_tiling,
|
| @@ -605,7 +617,8 @@ bool PictureLayerTiling::ComputeTilePriorityRects(
|
| // Calculate the soon border rect.
|
| float content_to_screen_scale = ideal_contents_scale / contents_scale_;
|
| gfx::Rect soon_border_rect = visible_rect_in_content_space;
|
| - float border = kSoonBorderDistanceInScreenPixels / content_to_screen_scale;
|
| + float border = CalculateSoonBorderDistance(visible_rect_in_content_space,
|
| + content_to_screen_scale);
|
| soon_border_rect.Inset(-border, -border, -border, -border);
|
|
|
| last_impl_frame_time_in_seconds_ = current_frame_time_in_seconds;
|
| @@ -866,7 +879,8 @@ void PictureLayerTiling::GetAllTilesForTracing(
|
| tiles->insert(it->second.get());
|
| }
|
|
|
| -void PictureLayerTiling::AsValueInto(base::debug::TracedValue* state) const {
|
| +void PictureLayerTiling::AsValueInto(
|
| + base::trace_event::TracedValue* state) const {
|
| state->SetInteger("num_tiles", tiles_.size());
|
| state->SetDouble("content_scale", contents_scale_);
|
| MathUtil::AddToTracedValue("tiling_size", tiling_size(), state);
|
|
|