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/resources/picture_layer_tiling.h" | 5 #include "cc/resources/picture_layer_tiling.h" |
6 | 6 |
7 #include <algorithm> | 7 #include <algorithm> |
8 #include <cmath> | 8 #include <cmath> |
9 | 9 |
10 #include "base/debug/trace_event.h" | 10 #include "base/debug/trace_event.h" |
(...skipping 508 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
519 struct EdgeEvent { | 519 struct EdgeEvent { |
520 enum { BOTTOM, TOP, LEFT, RIGHT } edge; | 520 enum { BOTTOM, TOP, LEFT, RIGHT } edge; |
521 int* num_edges; | 521 int* num_edges; |
522 int distance; | 522 int distance; |
523 }; | 523 }; |
524 | 524 |
525 gfx::Rect PictureLayerTiling::ExpandRectEquallyToAreaBoundedBy( | 525 gfx::Rect PictureLayerTiling::ExpandRectEquallyToAreaBoundedBy( |
526 gfx::Rect starting_rect, | 526 gfx::Rect starting_rect, |
527 int64 target_area, | 527 int64 target_area, |
528 gfx::Rect bounding_rect) { | 528 gfx::Rect bounding_rect) { |
529 DCHECK(!starting_rect.IsEmpty()); | 529 if (starting_rect.IsEmpty()) |
| 530 return starting_rect; |
| 531 |
530 DCHECK(!bounding_rect.IsEmpty()); | 532 DCHECK(!bounding_rect.IsEmpty()); |
531 DCHECK_GT(target_area, 0); | 533 DCHECK_GT(target_area, 0); |
532 | 534 |
533 gfx::Rect rect = IntersectRects(starting_rect, bounding_rect); | 535 gfx::Rect rect = IntersectRects(starting_rect, bounding_rect); |
534 if (rect.IsEmpty()) | 536 if (rect.IsEmpty()) |
535 return rect; | 537 return rect; |
536 | 538 |
537 // These values will be updated by the loop and uses as the output. | 539 // These values will be updated by the loop and uses as the output. |
538 int origin_x = rect.x(); | 540 int origin_x = rect.x(); |
539 int origin_y = rect.y(); | 541 int origin_y = rect.y(); |
(...skipping 68 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
608 | 610 |
609 // If our delta is less then our event distance, we're done. | 611 // If our delta is less then our event distance, we're done. |
610 if (delta < event.distance) | 612 if (delta < event.distance) |
611 break; | 613 break; |
612 } | 614 } |
613 | 615 |
614 return gfx::Rect(origin_x, origin_y, width, height); | 616 return gfx::Rect(origin_x, origin_y, width, height); |
615 } | 617 } |
616 | 618 |
617 } // namespace cc | 619 } // namespace cc |
OLD | NEW |