| 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 <stddef.h> | 5 #include <stddef.h> |
| 6 | 6 |
| 7 #include "cc/layers/append_quads_data.h" | 7 #include "cc/layers/append_quads_data.h" |
| 8 #include "cc/layers/nine_patch_layer_impl.h" | 8 #include "cc/layers/nine_patch_layer_impl.h" |
| 9 #include "cc/quads/texture_draw_quad.h" | 9 #include "cc/quads/texture_draw_quad.h" |
| 10 #include "cc/resources/ui_resource_bitmap.h" | 10 #include "cc/resources/ui_resource_bitmap.h" |
| (...skipping 369 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 380 LayerTestCommon::VerifyQuadsExactlyCoverRect(impl.quad_list(), gfx::Rect()); | 380 LayerTestCommon::VerifyQuadsExactlyCoverRect(impl.quad_list(), gfx::Rect()); |
| 381 EXPECT_EQ(impl.quad_list().size(), 0u); | 381 EXPECT_EQ(impl.quad_list().size(), 0u); |
| 382 } | 382 } |
| 383 | 383 |
| 384 { | 384 { |
| 385 SCOPED_TRACE("Partial occlusion"); | 385 SCOPED_TRACE("Partial occlusion"); |
| 386 gfx::Rect occluded(0, 0, 500, 1000); | 386 gfx::Rect occluded(0, 0, 500, 1000); |
| 387 impl.AppendQuadsWithOcclusion(nine_patch_layer_impl, occluded); | 387 impl.AppendQuadsWithOcclusion(nine_patch_layer_impl, occluded); |
| 388 | 388 |
| 389 size_t partially_occluded_count = 0; | 389 size_t partially_occluded_count = 0; |
| 390 LayerTestCommon::VerifyQuadsAreOccluded( | 390 LayerTestCommon::VerifyQuadsAreOccluded(impl.quad_list(), occluded, false, |
| 391 impl.quad_list(), occluded, &partially_occluded_count); | 391 &partially_occluded_count); |
| 392 // The layer outputs nine quads, three of which are partially occluded, and | 392 // The layer outputs nine quads, three of which are partially occluded, and |
| 393 // three fully occluded. | 393 // three fully occluded. |
| 394 EXPECT_EQ(6u, impl.quad_list().size()); | 394 EXPECT_EQ(6u, impl.quad_list().size()); |
| 395 EXPECT_EQ(3u, partially_occluded_count); | 395 EXPECT_EQ(3u, partially_occluded_count); |
| 396 } | 396 } |
| 397 } | 397 } |
| 398 | 398 |
| 399 TEST(NinePatchLayerImplTest, OpaqueRect) { | 399 TEST(NinePatchLayerImplTest, OpaqueRect) { |
| 400 gfx::Size layer_size(1000, 1000); | 400 gfx::Size layer_size(1000, 1000); |
| 401 gfx::Size viewport_size(1000, 1000); | 401 gfx::Size viewport_size(1000, 1000); |
| (...skipping 54 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 456 | 456 |
| 457 const QuadList &quad_list = impl.quad_list(); | 457 const QuadList &quad_list = impl.quad_list(); |
| 458 for (QuadList::ConstBackToFrontIterator it = quad_list.BackToFrontBegin(); | 458 for (QuadList::ConstBackToFrontIterator it = quad_list.BackToFrontBegin(); |
| 459 it != quad_list.BackToFrontEnd(); ++it) | 459 it != quad_list.BackToFrontEnd(); ++it) |
| 460 EXPECT_TRUE(it->ShouldDrawWithBlending()); | 460 EXPECT_TRUE(it->ShouldDrawWithBlending()); |
| 461 } | 461 } |
| 462 } | 462 } |
| 463 | 463 |
| 464 } // namespace | 464 } // namespace |
| 465 } // namespace cc | 465 } // namespace cc |
| OLD | NEW |