| OLD | NEW |
| 1 // Copyright 2011 The Chromium Authors. All rights reserved. | 1 // Copyright 2011 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/damage_tracker.h" | 5 #include "cc/trees/damage_tracker.h" |
| 6 | 6 |
| 7 #include <stddef.h> | 7 #include <stddef.h> |
| 8 | 8 |
| 9 #include "cc/base/math_util.h" | 9 #include "cc/base/math_util.h" |
| 10 #include "cc/layers/layer_impl.h" | 10 #include "cc/layers/layer_impl.h" |
| (...skipping 679 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 690 // Allow us to set damage on child1 too. | 690 // Allow us to set damage on child1 too. |
| 691 child1->SetDrawsContent(true); | 691 child1->SetDrawsContent(true); |
| 692 | 692 |
| 693 FilterOperations filters; | 693 FilterOperations filters; |
| 694 filters.Append(FilterOperation::CreateBlurFilter(2.f)); | 694 filters.Append(FilterOperation::CreateBlurFilter(2.f)); |
| 695 int outset_top, outset_right, outset_bottom, outset_left; | 695 int outset_top, outset_right, outset_bottom, outset_left; |
| 696 filters.GetOutsets(&outset_top, &outset_right, &outset_bottom, &outset_left); | 696 filters.GetOutsets(&outset_top, &outset_right, &outset_bottom, &outset_left); |
| 697 | 697 |
| 698 // Setting the filter will damage the whole surface. | 698 // Setting the filter will damage the whole surface. |
| 699 ClearDamageForAllSurfaces(root); | 699 ClearDamageForAllSurfaces(root); |
| 700 child1->SetBackgroundFilters(filters); | 700 child1->test_properties()->background_filters = filters; |
| 701 child1->NoteLayerPropertyChanged(); |
| 701 root->layer_tree_impl()->property_trees()->needs_rebuild = true; | 702 root->layer_tree_impl()->property_trees()->needs_rebuild = true; |
| 702 EmulateDrawingOneFrame(root); | 703 EmulateDrawingOneFrame(root); |
| 703 | 704 |
| 704 // CASE 1: Setting the update rect should cause the corresponding damage to | 705 // CASE 1: Setting the update rect should cause the corresponding damage to |
| 705 // the surface, blurred based on the size of the child's background | 706 // the surface, blurred based on the size of the child's background |
| 706 // blur filter. Note that child1's render surface has a size of | 707 // blur filter. Note that child1's render surface has a size of |
| 707 // 206x208 due to contributions from grand_child1 and grand_child2. | 708 // 206x208 due to contributions from grand_child1 and grand_child2. |
| 708 ClearDamageForAllSurfaces(root); | 709 ClearDamageForAllSurfaces(root); |
| 709 root->SetUpdateRect(gfx::Rect(297, 297, 2, 2)); | 710 root->SetUpdateRect(gfx::Rect(297, 297, 2, 2)); |
| 710 root->layer_tree_impl()->property_trees()->needs_rebuild = true; | 711 root->layer_tree_impl()->property_trees()->needs_rebuild = true; |
| (...skipping 926 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1637 gfx::Rect root_damage_rect = | 1638 gfx::Rect root_damage_rect = |
| 1638 root->render_surface()->damage_tracker()->current_damage_rect(); | 1639 root->render_surface()->damage_tracker()->current_damage_rect(); |
| 1639 gfx::Rect damage_we_care_about = gfx::Rect(i, i); | 1640 gfx::Rect damage_we_care_about = gfx::Rect(i, i); |
| 1640 EXPECT_LE(damage_we_care_about.right(), root_damage_rect.right()); | 1641 EXPECT_LE(damage_we_care_about.right(), root_damage_rect.right()); |
| 1641 EXPECT_LE(damage_we_care_about.bottom(), root_damage_rect.bottom()); | 1642 EXPECT_LE(damage_we_care_about.bottom(), root_damage_rect.bottom()); |
| 1642 } | 1643 } |
| 1643 } | 1644 } |
| 1644 | 1645 |
| 1645 } // namespace | 1646 } // namespace |
| 1646 } // namespace cc | 1647 } // namespace cc |
| OLD | NEW |