OLD | NEW |
1 // Copyright 2012 The Chromium Authors. All rights reserved. | 1 // Copyright 2012 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #include "cc/tiles/picture_layer_tiling.h" | 5 #include "cc/tiles/picture_layer_tiling.h" |
6 | 6 |
7 #include <algorithm> | 7 #include <algorithm> |
8 #include <cmath> | 8 #include <cmath> |
9 #include <limits> | 9 #include <limits> |
10 #include <set> | 10 #include <set> |
(...skipping 534 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
545 extrapolation_multiplier * (old_right - new_right), | 545 extrapolation_multiplier * (old_right - new_right), |
546 extrapolation_multiplier * (old_bottom - new_bottom)); | 546 extrapolation_multiplier * (old_bottom - new_bottom)); |
547 | 547 |
548 // Ensure that visible rect is contained in the skewport. | 548 // Ensure that visible rect is contained in the skewport. |
549 skewport.Union(visible_rect_in_content_space); | 549 skewport.Union(visible_rect_in_content_space); |
550 | 550 |
551 // Clip the skewport to |max_skewport|. This needs to happen after the | 551 // Clip the skewport to |max_skewport|. This needs to happen after the |
552 // union in case intersecting would have left the empty rect. | 552 // union in case intersecting would have left the empty rect. |
553 skewport.Intersect(max_skewport); | 553 skewport.Intersect(max_skewport); |
554 | 554 |
| 555 // Due to limits in int's representation, it is possible that the two |
| 556 // operations above (union and intersect) result in an empty skewport. To |
| 557 // avoid any unpleasant situations like that, union the visible rect again to |
| 558 // ensure that skewport.Contains(visible_rect_in_content_space) is always |
| 559 // true. |
| 560 skewport.Union(visible_rect_in_content_space); |
| 561 |
555 return skewport; | 562 return skewport; |
556 } | 563 } |
557 | 564 |
558 bool PictureLayerTiling::ComputeTilePriorityRects( | 565 bool PictureLayerTiling::ComputeTilePriorityRects( |
559 const gfx::Rect& viewport_in_layer_space, | 566 const gfx::Rect& viewport_in_layer_space, |
560 float ideal_contents_scale, | 567 float ideal_contents_scale, |
561 double current_frame_time_in_seconds, | 568 double current_frame_time_in_seconds, |
562 const Occlusion& occlusion_in_layer_space) { | 569 const Occlusion& occlusion_in_layer_space) { |
563 if (!NeedsUpdateForFrameAtTimeAndViewport(current_frame_time_in_seconds, | 570 if (!NeedsUpdateForFrameAtTimeAndViewport(current_frame_time_in_seconds, |
564 viewport_in_layer_space)) { | 571 viewport_in_layer_space)) { |
(...skipping 506 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1071 break; | 1078 break; |
1072 } | 1079 } |
1073 | 1080 |
1074 gfx::Rect result(origin_x, origin_y, width, height); | 1081 gfx::Rect result(origin_x, origin_y, width, height); |
1075 if (cache) | 1082 if (cache) |
1076 cache->previous_result = result; | 1083 cache->previous_result = result; |
1077 return result; | 1084 return result; |
1078 } | 1085 } |
1079 | 1086 |
1080 } // namespace cc | 1087 } // namespace cc |
OLD | NEW |