| 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 "cc/nine_patch_layer_impl.h" | 5 #include "cc/nine_patch_layer_impl.h" |
| 6 | 6 |
| 7 #include "cc/append_quads_data.h" | 7 #include "cc/append_quads_data.h" |
| 8 #include "cc/single_thread_proxy.h" | 8 #include "cc/single_thread_proxy.h" |
| 9 #include "cc/test/geometry_test_utils.h" | 9 #include "cc/test/geometry_test_utils.h" |
| 10 #include "cc/test/layer_test_common.h" | 10 #include "cc/test/layer_test_common.h" |
| (...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 52 | 52 |
| 53 AppendQuadsData data; | 53 AppendQuadsData data; |
| 54 layer->appendQuads(quadCuller, data); | 54 layer->appendQuads(quadCuller, data); |
| 55 | 55 |
| 56 // Verify quad rects | 56 // Verify quad rects |
| 57 const QuadList& quads = quadCuller.quadList(); | 57 const QuadList& quads = quadCuller.quadList(); |
| 58 EXPECT_EQ(quads.size(), 8); | 58 EXPECT_EQ(quads.size(), 8); |
| 59 Region remaining(visibleContentRect); | 59 Region remaining(visibleContentRect); |
| 60 for (size_t i = 0; i < quads.size(); ++i) { | 60 for (size_t i = 0; i < quads.size(); ++i) { |
| 61 DrawQuad* quad = quads[i]; | 61 DrawQuad* quad = quads[i]; |
| 62 gfx::Rect quadRect = quad->rect(); | 62 gfx::Rect quadRect = quad->rect; |
| 63 | 63 |
| 64 EXPECT_TRUE(visibleContentRect.Contains(quadRect)) << i; | 64 EXPECT_TRUE(visibleContentRect.Contains(quadRect)) << i; |
| 65 EXPECT_TRUE(remaining.Contains(quadRect)) << i; | 65 EXPECT_TRUE(remaining.Contains(quadRect)) << i; |
| 66 EXPECT_EQ(quad->quadTransform(), transform) << i; | 66 EXPECT_EQ(quad->quadTransform(), transform) << i; |
| 67 remaining.Subtract(Region(quadRect)); | 67 remaining.Subtract(Region(quadRect)); |
| 68 } | 68 } |
| 69 EXPECT_RECT_EQ(remaining.bounds(), scaledApertureNonUniform); | 69 EXPECT_RECT_EQ(remaining.bounds(), scaledApertureNonUniform); |
| 70 Region scaledApertureRegion(scaledApertureNonUniform); | 70 Region scaledApertureRegion(scaledApertureNonUniform); |
| 71 EXPECT_EQ(remaining, scaledApertureRegion); | 71 EXPECT_EQ(remaining, scaledApertureRegion); |
| 72 | 72 |
| 73 // Verify UV rects | 73 // Verify UV rects |
| 74 gfx::Rect bitmapRect(gfx::Point(), bitmapSize); | 74 gfx::Rect bitmapRect(gfx::Point(), bitmapSize); |
| 75 Region texRemaining(bitmapRect); | 75 Region texRemaining(bitmapRect); |
| 76 for (size_t i = 0; i < quads.size(); ++i) { | 76 for (size_t i = 0; i < quads.size(); ++i) { |
| 77 DrawQuad* quad = quads[i]; | 77 DrawQuad* quad = quads[i]; |
| 78 ASSERT_EQ(quad->material(), DrawQuad::TEXTURE_CONTENT); | |
| 79 const TextureDrawQuad* texQuad = TextureDrawQuad::materialCast(quad); | 78 const TextureDrawQuad* texQuad = TextureDrawQuad::materialCast(quad); |
| 80 gfx::RectF texRect = texQuad->uvRect(); | 79 gfx::RectF texRect = texQuad->uvRect(); |
| 81 texRect.Scale(bitmapSize.width(), bitmapSize.height()); | 80 texRect.Scale(bitmapSize.width(), bitmapSize.height()); |
| 82 texRemaining.Subtract(Region(ToRoundedIntRect(texRect))); | 81 texRemaining.Subtract(Region(ToRoundedIntRect(texRect))); |
| 83 } | 82 } |
| 84 EXPECT_RECT_EQ(texRemaining.bounds(), apertureRect); | 83 EXPECT_RECT_EQ(texRemaining.bounds(), apertureRect); |
| 85 Region apertureRegion(apertureRect); | 84 Region apertureRegion(apertureRect); |
| 86 EXPECT_EQ(texRemaining, apertureRegion); | 85 EXPECT_EQ(texRemaining, apertureRegion); |
| 87 } | 86 } |
| 88 | 87 |
| 89 } // namespace | 88 } // namespace |
| 90 } // namespace cc | 89 } // namespace cc |
| OLD | NEW |