Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(63)

Side by Side Diff: cc/trees/layer_tree_host_impl_unittest.cc

Issue 1908593002: cc : Stop pushing transform origin from Layer and LayerImpl. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « cc/trees/layer_tree_host_common_unittest.cc ('k') | cc/trees/property_tree_builder.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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/layer_tree_host_impl.h" 5 #include "cc/trees/layer_tree_host_impl.h"
6 6
7 #include <stddef.h> 7 #include <stddef.h>
8 8
9 #include <algorithm> 9 #include <algorithm>
10 #include <cmath> 10 #include <cmath>
(...skipping 5347 matching lines...) Expand 10 before | Expand all | Expand 10 after
5358 rotate_transform.Rotate(child_layer_angle); 5358 rotate_transform.Rotate(child_layer_angle);
5359 rotate_transform.Translate(50.0, 50.0); 5359 rotate_transform.Translate(50.0, 50.0);
5360 clip_layer->SetTransform(rotate_transform); 5360 clip_layer->SetTransform(rotate_transform);
5361 5361
5362 // Only allow vertical scrolling. 5362 // Only allow vertical scrolling.
5363 clip_layer->SetBounds( 5363 clip_layer->SetBounds(
5364 gfx::Size(child->bounds().width(), child->bounds().height() / 2)); 5364 gfx::Size(child->bounds().width(), child->bounds().height() / 2));
5365 // The rotation depends on the layer's transform origin, and the child layer 5365 // The rotation depends on the layer's transform origin, and the child layer
5366 // is a different size than the clip, so make sure the clip layer's origin 5366 // is a different size than the clip, so make sure the clip layer's origin
5367 // lines up over the child. 5367 // lines up over the child.
5368 clip_layer->SetTransformOrigin(gfx::Point3F( 5368 clip_layer->test_properties()->transform_origin = gfx::Point3F(
5369 clip_layer->bounds().width() * 0.5f, clip_layer->bounds().height(), 0.f)); 5369 clip_layer->bounds().width() * 0.5f, clip_layer->bounds().height(), 0.f);
5370 LayerImpl* child_ptr = child.get(); 5370 LayerImpl* child_ptr = child.get();
5371 clip_layer->AddChild(std::move(child)); 5371 clip_layer->AddChild(std::move(child));
5372 scroll_layer->AddChild(std::move(clip_layer)); 5372 scroll_layer->AddChild(std::move(clip_layer));
5373 5373
5374 gfx::Size surface_size(50, 50); 5374 gfx::Size surface_size(50, 50);
5375 host_impl_->SetViewportSize(surface_size); 5375 host_impl_->SetViewportSize(surface_size);
5376 SetNeedsRebuildPropertyTrees(); 5376 SetNeedsRebuildPropertyTrees();
5377 DrawFrame(); 5377 DrawFrame();
5378 { 5378 {
5379 // Scroll down in screen coordinates with a gesture. 5379 // Scroll down in screen coordinates with a gesture.
(...skipping 64 matching lines...) Expand 10 before | Expand all | Expand 10 after
5444 perspective_transform.ApplyPerspectiveDepth(20); 5444 perspective_transform.ApplyPerspectiveDepth(20);
5445 perspective_transform.RotateAboutXAxis(45); 5445 perspective_transform.RotateAboutXAxis(45);
5446 perspective_transform.Translate(50.0, 50.0); 5446 perspective_transform.Translate(50.0, 50.0);
5447 clip_layer->SetTransform(perspective_transform); 5447 clip_layer->SetTransform(perspective_transform);
5448 5448
5449 clip_layer->SetBounds(gfx::Size(child_ptr->bounds().width() / 2, 5449 clip_layer->SetBounds(gfx::Size(child_ptr->bounds().width() / 2,
5450 child_ptr->bounds().height() / 2)); 5450 child_ptr->bounds().height() / 2));
5451 // The transform depends on the layer's transform origin, and the child layer 5451 // The transform depends on the layer's transform origin, and the child layer
5452 // is a different size than the clip, so make sure the clip layer's origin 5452 // is a different size than the clip, so make sure the clip layer's origin
5453 // lines up over the child. 5453 // lines up over the child.
5454 clip_layer->SetTransformOrigin(gfx::Point3F( 5454 clip_layer->test_properties()->transform_origin = gfx::Point3F(
5455 clip_layer->bounds().width(), clip_layer->bounds().height(), 0.f)); 5455 clip_layer->bounds().width(), clip_layer->bounds().height(), 0.f);
5456 clip_layer->AddChild(std::move(child)); 5456 clip_layer->AddChild(std::move(child));
5457 scroll_layer->AddChild(std::move(clip_layer)); 5457 scroll_layer->AddChild(std::move(clip_layer));
5458 5458
5459 gfx::Size surface_size(50, 50); 5459 gfx::Size surface_size(50, 50);
5460 host_impl_->SetViewportSize(surface_size); 5460 host_impl_->SetViewportSize(surface_size);
5461 5461
5462 std::unique_ptr<ScrollAndScaleSet> scroll_info; 5462 std::unique_ptr<ScrollAndScaleSet> scroll_info;
5463 5463
5464 gfx::Vector2d gesture_scroll_deltas[4]; 5464 gfx::Vector2d gesture_scroll_deltas[4];
5465 gesture_scroll_deltas[0] = gfx::Vector2d(4, 10); 5465 gesture_scroll_deltas[0] = gfx::Vector2d(4, 10);
(...skipping 5203 matching lines...) Expand 10 before | Expand all | Expand 10 after
10669 // There should not be any jitter measured till we hit the fixed point hits 10669 // There should not be any jitter measured till we hit the fixed point hits
10670 // threshold. 10670 // threshold.
10671 float expected_jitter = 10671 float expected_jitter =
10672 (i == pending_tree->kFixedPointHitsThreshold) ? 500 : 0; 10672 (i == pending_tree->kFixedPointHitsThreshold) ? 500 : 0;
10673 EXPECT_EQ(jitter, expected_jitter); 10673 EXPECT_EQ(jitter, expected_jitter);
10674 } 10674 }
10675 } 10675 }
10676 10676
10677 } // namespace 10677 } // namespace
10678 } // namespace cc 10678 } // namespace cc
OLDNEW
« no previous file with comments | « cc/trees/layer_tree_host_common_unittest.cc ('k') | cc/trees/property_tree_builder.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698