| 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/trees/occlusion_tracker.h" | 5 #include "cc/trees/occlusion_tracker.h" |
| 6 | 6 |
| 7 #include <algorithm> | 7 #include <algorithm> |
| 8 | 8 |
| 9 #include "cc/base/math_util.h" | 9 #include "cc/base/math_util.h" |
| 10 #include "cc/debug/overdraw_metrics.h" | 10 #include "cc/debug/overdraw_metrics.h" |
| (...skipping 486 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 497 gfx::Rect screen_space_rect = | 497 gfx::Rect screen_space_rect = |
| 498 gfx::ToEnclosedRect(screen_space_quad.BoundingBox()); | 498 gfx::ToEnclosedRect(screen_space_quad.BoundingBox()); |
| 499 non_occluding_screen_space_rects_->push_back(screen_space_rect); | 499 non_occluding_screen_space_rects_->push_back(screen_space_rect); |
| 500 } | 500 } |
| 501 } | 501 } |
| 502 | 502 |
| 503 template <typename LayerType> | 503 template <typename LayerType> |
| 504 bool OcclusionTracker<LayerType>::Occluded( | 504 bool OcclusionTracker<LayerType>::Occluded( |
| 505 const LayerType* render_target, | 505 const LayerType* render_target, |
| 506 const gfx::Rect& content_rect, | 506 const gfx::Rect& content_rect, |
| 507 const gfx::Transform& draw_transform, | 507 const gfx::Transform& draw_transform) const { |
| 508 bool impl_draw_transform_is_unknown) const { | |
| 509 DCHECK(!stack_.empty()); | 508 DCHECK(!stack_.empty()); |
| 510 if (stack_.empty()) | 509 if (stack_.empty()) |
| 511 return false; | 510 return false; |
| 512 if (content_rect.IsEmpty()) | 511 if (content_rect.IsEmpty()) |
| 513 return true; | 512 return true; |
| 514 if (impl_draw_transform_is_unknown) | |
| 515 return false; | |
| 516 | 513 |
| 517 // For tests with no render target. | 514 // For tests with no render target. |
| 518 if (!render_target) | 515 if (!render_target) |
| 519 return false; | 516 return false; |
| 520 | 517 |
| 521 DCHECK_EQ(render_target->render_target(), render_target); | 518 DCHECK_EQ(render_target->render_target(), render_target); |
| 522 DCHECK(render_target->render_surface()); | 519 DCHECK(render_target->render_surface()); |
| 523 DCHECK_EQ(render_target, stack_.back().target); | 520 DCHECK_EQ(render_target, stack_.back().target); |
| 524 | 521 |
| 525 if (stack_.back().occlusion_from_inside_target.IsEmpty() && | 522 if (stack_.back().occlusion_from_inside_target.IsEmpty() && |
| (...skipping 19 matching lines...) Expand all Loading... |
| 545 gfx::RectF unoccluded_rect_in_target_surface = | 542 gfx::RectF unoccluded_rect_in_target_surface = |
| 546 unoccluded_region_in_target_surface.bounds(); | 543 unoccluded_region_in_target_surface.bounds(); |
| 547 | 544 |
| 548 return unoccluded_rect_in_target_surface.IsEmpty(); | 545 return unoccluded_rect_in_target_surface.IsEmpty(); |
| 549 } | 546 } |
| 550 | 547 |
| 551 template <typename LayerType> | 548 template <typename LayerType> |
| 552 gfx::Rect OcclusionTracker<LayerType>::UnoccludedContentRect( | 549 gfx::Rect OcclusionTracker<LayerType>::UnoccludedContentRect( |
| 553 const LayerType* render_target, | 550 const LayerType* render_target, |
| 554 const gfx::Rect& content_rect, | 551 const gfx::Rect& content_rect, |
| 555 const gfx::Transform& draw_transform, | 552 const gfx::Transform& draw_transform) const { |
| 556 bool impl_draw_transform_is_unknown) const { | |
| 557 DCHECK(!stack_.empty()); | 553 DCHECK(!stack_.empty()); |
| 558 if (stack_.empty()) | 554 if (stack_.empty()) |
| 559 return content_rect; | 555 return content_rect; |
| 560 if (content_rect.IsEmpty()) | 556 if (content_rect.IsEmpty()) |
| 561 return content_rect; | 557 return content_rect; |
| 562 if (impl_draw_transform_is_unknown) | |
| 563 return content_rect; | |
| 564 | 558 |
| 565 // For tests with no render target. | 559 // For tests with no render target. |
| 566 if (!render_target) | 560 if (!render_target) |
| 567 return content_rect; | 561 return content_rect; |
| 568 | 562 |
| 569 DCHECK_EQ(render_target->render_target(), render_target); | 563 DCHECK_EQ(render_target->render_target(), render_target); |
| 570 DCHECK(render_target->render_surface()); | 564 DCHECK(render_target->render_surface()); |
| 571 DCHECK_EQ(render_target, stack_.back().target); | 565 DCHECK_EQ(render_target, stack_.back().target); |
| 572 | 566 |
| 573 if (stack_.back().occlusion_from_inside_target.IsEmpty() && | 567 if (stack_.back().occlusion_from_inside_target.IsEmpty() && |
| (...skipping 92 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 666 unoccluded_rect.Intersect(content_rect); | 660 unoccluded_rect.Intersect(content_rect); |
| 667 | 661 |
| 668 return unoccluded_rect; | 662 return unoccluded_rect; |
| 669 } | 663 } |
| 670 | 664 |
| 671 // Instantiate (and export) templates here for the linker. | 665 // Instantiate (and export) templates here for the linker. |
| 672 template class OcclusionTracker<Layer>; | 666 template class OcclusionTracker<Layer>; |
| 673 template class OcclusionTracker<LayerImpl>; | 667 template class OcclusionTracker<LayerImpl>; |
| 674 | 668 |
| 675 } // namespace cc | 669 } // namespace cc |
| OLD | NEW |