OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 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 "base/basictypes.h" | 5 #include "base/basictypes.h" |
6 #include "base/bind.h" | 6 #include "base/bind.h" |
7 #include "base/compiler_specific.h" | 7 #include "base/compiler_specific.h" |
8 #include "base/debug/trace_event.h" | 8 #include "base/debug/trace_event.h" |
9 #include "base/file_util.h" | 9 #include "base/file_util.h" |
10 #include "base/files/file_path.h" | 10 #include "base/files/file_path.h" |
(...skipping 1324 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1335 child->SetBounds(gfx::Rect(200, 200, 400, 400)); | 1335 child->SetBounds(gfx::Rect(200, 200, 400, 400)); |
1336 child->SetVisible(true); | 1336 child->SetVisible(true); |
1337 DrawTree(root.get()); | 1337 DrawTree(root.get()); |
1338 EXPECT_TRUE(delegate.painted()); | 1338 EXPECT_TRUE(delegate.painted()); |
1339 } | 1339 } |
1340 | 1340 |
1341 static scoped_ptr<cc::DelegatedFrameData> MakeFrameData(gfx::Size size) { | 1341 static scoped_ptr<cc::DelegatedFrameData> MakeFrameData(gfx::Size size) { |
1342 scoped_ptr<cc::DelegatedFrameData> frame_data(new cc::DelegatedFrameData); | 1342 scoped_ptr<cc::DelegatedFrameData> frame_data(new cc::DelegatedFrameData); |
1343 scoped_ptr<cc::RenderPass> render_pass(cc::RenderPass::Create()); | 1343 scoped_ptr<cc::RenderPass> render_pass(cc::RenderPass::Create()); |
1344 render_pass->SetNew( | 1344 render_pass->SetNew( |
1345 cc::RenderPass::Id(1, 1), gfx::Rect(size), gfx::Rect(), gfx::Transform()); | 1345 cc::RenderPassId(1, 1), gfx::Rect(size), gfx::Rect(), gfx::Transform()); |
1346 frame_data->render_pass_list.push_back(render_pass.Pass()); | 1346 frame_data->render_pass_list.push_back(render_pass.Pass()); |
1347 return frame_data.Pass(); | 1347 return frame_data.Pass(); |
1348 } | 1348 } |
1349 | 1349 |
1350 TEST_F(LayerWithDelegateTest, DelegatedLayer) { | 1350 TEST_F(LayerWithDelegateTest, DelegatedLayer) { |
1351 scoped_ptr<Layer> root(CreateNoTextureLayer(gfx::Rect(0, 0, 1000, 1000))); | 1351 scoped_ptr<Layer> root(CreateNoTextureLayer(gfx::Rect(0, 0, 1000, 1000))); |
1352 | 1352 |
1353 scoped_ptr<Layer> child(CreateLayer(LAYER_TEXTURED)); | 1353 scoped_ptr<Layer> child(CreateLayer(LAYER_TEXTURED)); |
1354 | 1354 |
1355 child->SetBounds(gfx::Rect(0, 0, 10, 10)); | 1355 child->SetBounds(gfx::Rect(0, 0, 10, 10)); |
(...skipping 229 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1585 | 1585 |
1586 c11->SetBounds(gfx::Rect(2, 2, 10, 10)); | 1586 c11->SetBounds(gfx::Rect(2, 2, 10, 10)); |
1587 SnapLayerToPhysicalPixelBoundary(root.get(), c11.get()); | 1587 SnapLayerToPhysicalPixelBoundary(root.get(), c11.get()); |
1588 // c11 is now off the pixel. | 1588 // c11 is now off the pixel. |
1589 // 0.5 / 1.5 = 0.333... | 1589 // 0.5 / 1.5 = 0.333... |
1590 EXPECT_EQ("0.33 0.33", | 1590 EXPECT_EQ("0.33 0.33", |
1591 Vector2dFTo100thPercisionString(c11->subpixel_position_offset())); | 1591 Vector2dFTo100thPercisionString(c11->subpixel_position_offset())); |
1592 } | 1592 } |
1593 | 1593 |
1594 } // namespace ui | 1594 } // namespace ui |
OLD | NEW |