| 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 545 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 556 } | 556 } |
| 557 | 557 |
| 558 TEST_F(DamageTrackerTest, VerifyDamageForImageFilter) { | 558 TEST_F(DamageTrackerTest, VerifyDamageForImageFilter) { |
| 559 LayerImpl* root = CreateAndSetUpTestTreeWithOneSurface(); | 559 LayerImpl* root = CreateAndSetUpTestTreeWithOneSurface(); |
| 560 LayerImpl* child = root->children()[0]; | 560 LayerImpl* child = root->children()[0]; |
| 561 gfx::Rect root_damage_rect, child_damage_rect; | 561 gfx::Rect root_damage_rect, child_damage_rect; |
| 562 | 562 |
| 563 // Allow us to set damage on child too. | 563 // Allow us to set damage on child too. |
| 564 child->SetDrawsContent(true); | 564 child->SetDrawsContent(true); |
| 565 | 565 |
| 566 skia::RefPtr<SkImageFilter> filter = skia::AdoptRef( | 566 sk_sp<SkImageFilter> filter(SkBlurImageFilter::Make(2, 2, nullptr)); |
| 567 SkBlurImageFilter::Create(SkIntToScalar(2), SkIntToScalar(2))); | |
| 568 FilterOperations filters; | 567 FilterOperations filters; |
| 569 filters.Append(FilterOperation::CreateReferenceFilter(filter)); | 568 filters.Append(FilterOperation::CreateReferenceFilter(filter)); |
| 570 int outset_top, outset_right, outset_bottom, outset_left; | 569 int outset_top, outset_right, outset_bottom, outset_left; |
| 571 filters.GetOutsets(&outset_top, &outset_right, &outset_bottom, &outset_left); | 570 filters.GetOutsets(&outset_top, &outset_right, &outset_bottom, &outset_left); |
| 572 | 571 |
| 573 // Setting the filter will damage the whole surface. | 572 // Setting the filter will damage the whole surface. |
| 574 ClearDamageForAllSurfaces(root); | 573 ClearDamageForAllSurfaces(root); |
| 575 child->SetForceRenderSurface(true); | 574 child->SetForceRenderSurface(true); |
| 576 child->SetFilters(filters); | 575 child->SetFilters(filters); |
| 577 root->layer_tree_impl()->property_trees()->needs_rebuild = true; | 576 root->layer_tree_impl()->property_trees()->needs_rebuild = true; |
| (...skipping 976 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1554 gfx::Rect root_damage_rect = | 1553 gfx::Rect root_damage_rect = |
| 1555 root->render_surface()->damage_tracker()->current_damage_rect(); | 1554 root->render_surface()->damage_tracker()->current_damage_rect(); |
| 1556 gfx::Rect damage_we_care_about = gfx::Rect(i, i); | 1555 gfx::Rect damage_we_care_about = gfx::Rect(i, i); |
| 1557 EXPECT_LE(damage_we_care_about.right(), root_damage_rect.right()); | 1556 EXPECT_LE(damage_we_care_about.right(), root_damage_rect.right()); |
| 1558 EXPECT_LE(damage_we_care_about.bottom(), root_damage_rect.bottom()); | 1557 EXPECT_LE(damage_we_care_about.bottom(), root_damage_rect.bottom()); |
| 1559 } | 1558 } |
| 1560 } | 1559 } |
| 1561 | 1560 |
| 1562 } // namespace | 1561 } // namespace |
| 1563 } // namespace cc | 1562 } // namespace cc |
| OLD | NEW |