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