Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(358)

Unified Diff: cc/resources/picture_layer_tiling.cc

Issue 935333002: Update from https://crrev.com/316786 (Closed) Base URL: git@github.com:domokit/mojo.git@master
Patch Set: Created 5 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « cc/resources/picture_layer_tiling.h ('k') | cc/resources/picture_layer_tiling_set.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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);
« no previous file with comments | « cc/resources/picture_layer_tiling.h ('k') | cc/resources/picture_layer_tiling_set.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698