| 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/resources/picture_layer_tiling.h" | 5 #include "cc/resources/picture_layer_tiling.h" |
| 6 | 6 |
| 7 #include "cc/test/fake_picture_layer_tiling_client.h" | 7 #include "cc/test/fake_picture_layer_tiling_client.h" |
| 8 #include "testing/gtest/include/gtest/gtest.h" | 8 #include "testing/gtest/include/gtest/gtest.h" |
| 9 #include "ui/gfx/rect_conversions.h" | 9 #include "ui/gfx/rect_conversions.h" |
| 10 #include "ui/gfx/size_conversions.h" | 10 #include "ui/gfx/size_conversions.h" |
| (...skipping 27 matching lines...) Expand all Loading... |
| 38 // back to floating point texture coordinates. | 38 // back to floating point texture coordinates. |
| 39 float dest_to_contents_scale = tiling_->contents_scale() / rect_scale; | 39 float dest_to_contents_scale = tiling_->contents_scale() / rect_scale; |
| 40 ASSERT_LE(dest_to_contents_scale, 2.0); | 40 ASSERT_LE(dest_to_contents_scale, 2.0); |
| 41 | 41 |
| 42 Region remaining = expect_rect; | 42 Region remaining = expect_rect; |
| 43 for (PictureLayerTiling::Iterator iter(tiling_.get(), | 43 for (PictureLayerTiling::Iterator iter(tiling_.get(), |
| 44 rect_scale, | 44 rect_scale, |
| 45 request_rect); | 45 request_rect); |
| 46 iter; | 46 iter; |
| 47 ++iter) { | 47 ++iter) { |
| 48 | |
| 49 // Geometry cannot overlap previous geometry at all | 48 // Geometry cannot overlap previous geometry at all |
| 50 gfx::Rect geometry = iter.geometry_rect(); | 49 gfx::Rect geometry = iter.geometry_rect(); |
| 51 EXPECT_TRUE(expect_rect.Contains(geometry)); | 50 EXPECT_TRUE(expect_rect.Contains(geometry)); |
| 52 EXPECT_TRUE(remaining.Contains(geometry)); | 51 EXPECT_TRUE(remaining.Contains(geometry)); |
| 53 remaining.Subtract(geometry); | 52 remaining.Subtract(geometry); |
| 54 | 53 |
| 55 // Sanity check that texture coords are within the texture rect. | 54 // Sanity check that texture coords are within the texture rect. |
| 56 gfx::RectF texture_rect = iter.texture_rect(); | 55 gfx::RectF texture_rect = iter.texture_rect(); |
| 57 EXPECT_GE(texture_rect.x(), 0); | 56 EXPECT_GE(texture_rect.x(), 0); |
| 58 EXPECT_GE(texture_rect.y(), 0); | 57 EXPECT_GE(texture_rect.y(), 0); |
| (...skipping 296 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 355 gfx::Rect in(40, 50, 100, 200); | 354 gfx::Rect in(40, 50, 100, 200); |
| 356 gfx::Rect bounds(0, 0, 10, 10); | 355 gfx::Rect bounds(0, 0, 10, 10); |
| 357 int64 target_area = 400 * 400; | 356 int64 target_area = 400 * 400; |
| 358 gfx::Rect out = PictureLayerTiling::ExpandRectEquallyToAreaBoundedBy( | 357 gfx::Rect out = PictureLayerTiling::ExpandRectEquallyToAreaBoundedBy( |
| 359 in, target_area, bounds); | 358 in, target_area, bounds); |
| 360 EXPECT_TRUE(out.IsEmpty()); | 359 EXPECT_TRUE(out.IsEmpty()); |
| 361 } | 360 } |
| 362 | 361 |
| 363 } // namespace | 362 } // namespace |
| 364 } // namespace cc | 363 } // namespace cc |
| OLD | NEW |