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

Side by Side Diff: ui/compositor/layer.cc

Issue 1372253002: gfx: Make conversions from gfx::Point to PointF explicit. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: pointfconvert-gfx: . Created 5 years, 2 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
OLDNEW
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 "ui/compositor/layer.h" 5 #include "ui/compositor/layer.h"
6 6
7 #include <algorithm> 7 #include <algorithm>
8 8
9 #include "base/auto_reset.h" 9 #include "base/auto_reset.h"
10 #include "base/command_line.h" 10 #include "base/command_line.h"
(...skipping 848 matching lines...) Expand 10 before | Expand all | Expand 10 after
859 children_.insert(children_.begin() + dest_i, child); 859 children_.insert(children_.begin() + dest_i, child);
860 860
861 child->cc_layer_->RemoveFromParent(); 861 child->cc_layer_->RemoveFromParent();
862 cc_layer_->InsertChild(child->cc_layer_, dest_i); 862 cc_layer_->InsertChild(child->cc_layer_, dest_i);
863 } 863 }
864 864
865 bool Layer::ConvertPointForAncestor(const Layer* ancestor, 865 bool Layer::ConvertPointForAncestor(const Layer* ancestor,
866 gfx::Point* point) const { 866 gfx::Point* point) const {
867 gfx::Transform transform; 867 gfx::Transform transform;
868 bool result = GetTargetTransformRelativeTo(ancestor, &transform); 868 bool result = GetTargetTransformRelativeTo(ancestor, &transform);
869 gfx::Point3F p(*point); 869 auto p = gfx::Point3F(gfx::PointF(*point));
870 transform.TransformPoint(&p); 870 transform.TransformPoint(&p);
871 *point = gfx::ToFlooredPoint(p.AsPointF()); 871 *point = gfx::ToFlooredPoint(p.AsPointF());
872 return result; 872 return result;
873 } 873 }
874 874
875 bool Layer::ConvertPointFromAncestor(const Layer* ancestor, 875 bool Layer::ConvertPointFromAncestor(const Layer* ancestor,
876 gfx::Point* point) const { 876 gfx::Point* point) const {
877 gfx::Transform transform; 877 gfx::Transform transform;
878 bool result = GetTargetTransformRelativeTo(ancestor, &transform); 878 bool result = GetTargetTransformRelativeTo(ancestor, &transform);
879 gfx::Point3F p(*point); 879 auto p = gfx::Point3F(gfx::PointF(*point));
880 transform.TransformPointReverse(&p); 880 transform.TransformPointReverse(&p);
881 *point = gfx::ToFlooredPoint(p.AsPointF()); 881 *point = gfx::ToFlooredPoint(p.AsPointF());
882 return result; 882 return result;
883 } 883 }
884 884
885 void Layer::SetBoundsFromAnimation(const gfx::Rect& bounds) { 885 void Layer::SetBoundsFromAnimation(const gfx::Rect& bounds) {
886 if (bounds == bounds_) 886 if (bounds == bounds_)
887 return; 887 return;
888 888
889 base::Closure closure; 889 base::Closure closure;
(...skipping 184 matching lines...) Expand 10 before | Expand all | Expand 10 after
1074 static_cast<float>(size.width()) / frame_size_in_dip_.width(), 1074 static_cast<float>(size.width()) / frame_size_in_dip_.width(),
1075 static_cast<float>(size.height()) / frame_size_in_dip_.height()); 1075 static_cast<float>(size.height()) / frame_size_in_dip_.height());
1076 texture_layer_->SetUV(uv_top_left, uv_bottom_right); 1076 texture_layer_->SetUV(uv_top_left, uv_bottom_right);
1077 } else if (delegated_renderer_layer_.get() || surface_layer_.get()) { 1077 } else if (delegated_renderer_layer_.get() || surface_layer_.get()) {
1078 size.SetToMin(frame_size_in_dip_); 1078 size.SetToMin(frame_size_in_dip_);
1079 } 1079 }
1080 cc_layer_->SetBounds(size); 1080 cc_layer_->SetBounds(size);
1081 } 1081 }
1082 1082
1083 void Layer::RecomputePosition() { 1083 void Layer::RecomputePosition() {
1084 cc_layer_->SetPosition(bounds_.origin() + subpixel_position_offset_); 1084 cc_layer_->SetPosition(gfx::PointF(bounds_.origin()) +
1085 subpixel_position_offset_);
1085 } 1086 }
1086 1087
1087 void Layer::AddAnimatorsInTreeToCollection( 1088 void Layer::AddAnimatorsInTreeToCollection(
1088 LayerAnimatorCollection* collection) { 1089 LayerAnimatorCollection* collection) {
1089 DCHECK(collection); 1090 DCHECK(collection);
1090 if (IsAnimating()) 1091 if (IsAnimating())
1091 animator_->AddToCollection(collection); 1092 animator_->AddToCollection(collection);
1092 std::for_each( 1093 std::for_each(
1093 children_.begin(), 1094 children_.begin(),
1094 children_.end(), 1095 children_.end(),
(...skipping 11 matching lines...) Expand all
1106 children_.end(), 1107 children_.end(),
1107 std::bind2nd(std::mem_fun(&Layer::RemoveAnimatorsInTreeFromCollection), 1108 std::bind2nd(std::mem_fun(&Layer::RemoveAnimatorsInTreeFromCollection),
1108 collection)); 1109 collection));
1109 } 1110 }
1110 1111
1111 bool Layer::IsAnimating() const { 1112 bool Layer::IsAnimating() const {
1112 return animator_.get() && animator_->is_animating(); 1113 return animator_.get() && animator_->is_animating();
1113 } 1114 }
1114 1115
1115 } // namespace ui 1116 } // namespace ui
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698