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 "cc/base/math_util.h" | 7 #include "cc/base/math_util.h" |
8 #include "cc/layers/layer_impl.h" | 8 #include "cc/layers/layer_impl.h" |
9 #include "cc/output/filter_operation.h" | 9 #include "cc/output/filter_operation.h" |
10 #include "cc/output/filter_operations.h" | 10 #include "cc/output/filter_operations.h" |
(...skipping 522 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
533 } | 533 } |
534 | 534 |
535 TEST_F(DamageTrackerTest, VerifyDamageForImageFilter) { | 535 TEST_F(DamageTrackerTest, VerifyDamageForImageFilter) { |
536 scoped_ptr<LayerImpl> root = CreateAndSetUpTestTreeWithOneSurface(); | 536 scoped_ptr<LayerImpl> root = CreateAndSetUpTestTreeWithOneSurface(); |
537 LayerImpl* child = root->children()[0]; | 537 LayerImpl* child = root->children()[0]; |
538 gfx::Rect root_damage_rect, child_damage_rect; | 538 gfx::Rect root_damage_rect, child_damage_rect; |
539 | 539 |
540 // Allow us to set damage on child too. | 540 // Allow us to set damage on child too. |
541 child->SetDrawsContent(true); | 541 child->SetDrawsContent(true); |
542 | 542 |
543 skia::RefPtr<SkImageFilter> filter = | 543 skia::RefPtr<SkImageFilter> filter = skia::AdoptRef( |
544 skia::AdoptRef(new SkBlurImageFilter(SkIntToScalar(2), | 544 SkBlurImageFilter::Create(SkIntToScalar(2), SkIntToScalar(2))); |
545 SkIntToScalar(2))); | |
546 FilterOperations filters; | 545 FilterOperations filters; |
547 filters.Append(FilterOperation::CreateReferenceFilter(filter)); | 546 filters.Append(FilterOperation::CreateReferenceFilter(filter)); |
548 | 547 |
549 // Setting the filter will damage the whole surface. | 548 // Setting the filter will damage the whole surface. |
550 ClearDamageForAllSurfaces(root.get()); | 549 ClearDamageForAllSurfaces(root.get()); |
551 child->SetFilters(filters); | 550 child->SetFilters(filters); |
552 EmulateDrawingOneFrame(root.get()); | 551 EmulateDrawingOneFrame(root.get()); |
553 root_damage_rect = | 552 root_damage_rect = |
554 root->render_surface()->damage_tracker()->current_damage_rect(); | 553 root->render_surface()->damage_tracker()->current_damage_rect(); |
555 child_damage_rect = | 554 child_damage_rect = |
(...skipping 919 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1475 gfx::Rect root_damage_rect = | 1474 gfx::Rect root_damage_rect = |
1476 root->render_surface()->damage_tracker()->current_damage_rect(); | 1475 root->render_surface()->damage_tracker()->current_damage_rect(); |
1477 gfx::Rect damage_we_care_about = gfx::Rect(i, i); | 1476 gfx::Rect damage_we_care_about = gfx::Rect(i, i); |
1478 EXPECT_LE(damage_we_care_about.right(), root_damage_rect.right()); | 1477 EXPECT_LE(damage_we_care_about.right(), root_damage_rect.right()); |
1479 EXPECT_LE(damage_we_care_about.bottom(), root_damage_rect.bottom()); | 1478 EXPECT_LE(damage_we_care_about.bottom(), root_damage_rect.bottom()); |
1480 } | 1479 } |
1481 } | 1480 } |
1482 | 1481 |
1483 } // namespace | 1482 } // namespace |
1484 } // namespace cc | 1483 } // namespace cc |
OLD | NEW |