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

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

Issue 216973006: Fix fixed-pos jitter related to physical pixel snapping. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Set fallback value to 1 Created 6 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 | Annotate | Revision Log
« no previous file with comments | « cc/trees/layer_tree_host_common.cc ('k') | no next file » | 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_common.h" 5 #include "cc/trees/layer_tree_host_common.h"
6 6
7 #include <set> 7 #include <set>
8 8
9 #include "cc/animation/layer_animation_controller.h" 9 #include "cc/animation/layer_animation_controller.h"
10 #include "cc/base/math_util.h" 10 #include "cc/base/math_util.h"
(...skipping 9671 matching lines...) Expand 10 before | Expand all | Expand 10 after
9682 EXPECT_TRANSFORMATION_MATRIX_EQ( 9682 EXPECT_TRANSFORMATION_MATRIX_EQ(
9683 container_layer->draw_properties().screen_space_transform, 9683 container_layer->draw_properties().screen_space_transform,
9684 fixed_layer->draw_properties().screen_space_transform); 9684 fixed_layer->draw_properties().screen_space_transform);
9685 EXPECT_VECTOR_EQ( 9685 EXPECT_VECTOR_EQ(
9686 fixed_layer->draw_properties().screen_space_transform.To2dTranslation(), 9686 fixed_layer->draw_properties().screen_space_transform.To2dTranslation(),
9687 container_offset); 9687 container_offset);
9688 EXPECT_VECTOR_EQ(scroll_layer->draw_properties() 9688 EXPECT_VECTOR_EQ(scroll_layer->draw_properties()
9689 .screen_space_transform.To2dTranslation(), 9689 .screen_space_transform.To2dTranslation(),
9690 container_offset - rounded_scroll_delta); 9690 container_offset - rounded_scroll_delta);
9691 } 9691 }
9692
9693 // Scale is applied earlier in the tree.
9694 {
9695 gfx::Transform scaled_container_transform = container_transform;
9696 scaled_container_transform.Scale3d(3.0, 3.0, 1.0);
9697 container_layer->SetTransform(scaled_container_transform);
9698
9699 gfx::Vector2dF scroll_delta(4.5f, 8.5f);
9700 scroll_layer->SetScrollDelta(scroll_delta);
9701
9702 LayerImplList render_surface_layer_list;
9703 LayerTreeHostCommon::CalcDrawPropsImplInputsForTesting inputs(
9704 root.get(), root->bounds(), &render_surface_layer_list);
9705 LayerTreeHostCommon::CalculateDrawProperties(&inputs);
9706
9707 EXPECT_TRANSFORMATION_MATRIX_EQ(
9708 container_layer->draw_properties().screen_space_transform,
9709 fixed_layer->draw_properties().screen_space_transform);
9710 EXPECT_VECTOR_EQ(
9711 fixed_layer->draw_properties().screen_space_transform.To2dTranslation(),
9712 container_offset);
9713
9714 container_layer->SetTransform(container_transform);
9715 }
9716
9717 // Scale is applied on the scroll layer itself.
9718 {
9719 gfx::Transform scale_transform;
9720 scale_transform.Scale3d(3.0, 3.0, 1.0);
9721 scroll_layer->SetTransform(scale_transform);
9722
9723 gfx::Vector2dF scroll_delta(4.5f, 8.5f);
9724 scroll_layer->SetScrollDelta(scroll_delta);
9725
9726 LayerImplList render_surface_layer_list;
9727 LayerTreeHostCommon::CalcDrawPropsImplInputsForTesting inputs(
9728 root.get(), root->bounds(), &render_surface_layer_list);
9729 LayerTreeHostCommon::CalculateDrawProperties(&inputs);
9730
9731 EXPECT_VECTOR_EQ(
9732 fixed_layer->draw_properties().screen_space_transform.To2dTranslation(),
9733 container_offset);
9734
9735 scroll_layer->SetTransform(identity_transform);
9736 }
9692 } 9737 }
9693 9738
9694 } // namespace 9739 } // namespace
9695 } // namespace cc 9740 } // namespace cc
OLDNEW
« no previous file with comments | « cc/trees/layer_tree_host_common.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698