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

Unified Diff: cc/resources/picture_layer_tiling.cc

Issue 1021663002: cc: Fix skewport math (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Fix for empty viewport Created 5 years, 9 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 | « no previous file | cc/resources/picture_layer_tiling_unittest.cc » ('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 b52ba9cdf13fbe5b37f85047ebf71b138d48357e..b6ff4f8c11bdf6f6b7055b8de6e9b1ea960ed4fc 100644
--- a/cc/resources/picture_layer_tiling.cc
+++ b/cc/resources/picture_layer_tiling.cc
@@ -529,6 +529,9 @@ gfx::Rect PictureLayerTiling::ComputeSkewport(
double current_frame_time_in_seconds,
const gfx::Rect& visible_rect_in_content_space) const {
gfx::Rect skewport = visible_rect_in_content_space;
+ if (skewport.IsEmpty())
+ return skewport;
+
if (visible_rect_history_[1].frame_time_in_seconds == 0.0)
return skewport;
@@ -564,11 +567,13 @@ gfx::Rect PictureLayerTiling::ComputeSkewport(
extrapolation_multiplier * (old_right - new_right),
extrapolation_multiplier * (old_bottom - new_bottom));
- // Clip the skewport to |max_skewport|.
+ // Ensure that visible rect is contained in the skewport.
+ skewport.Union(visible_rect_in_content_space);
+
+ // Clip the skewport to |max_skewport|. This needs to happen after the
+ // union in case intersecting would have left the empty rect.
skewport.Intersect(max_skewport);
- // Finally, ensure that visible rect is contained in the skewport.
- skewport.Union(visible_rect_in_content_space);
return skewport;
}
« no previous file with comments | « no previous file | cc/resources/picture_layer_tiling_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698