| OLD | NEW |
| 1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 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/layers/layer_position_constraint.h" | 5 #include "cc/layers/layer_position_constraint.h" |
| 6 #include "cc/proto/layer_position_constraint.pb.h" | |
| 7 | 6 |
| 8 namespace cc { | 7 namespace cc { |
| 9 | 8 |
| 10 LayerPositionConstraint::LayerPositionConstraint() | 9 LayerPositionConstraint::LayerPositionConstraint() |
| 11 : is_fixed_position_(false), | 10 : is_fixed_position_(false), |
| 12 is_fixed_to_right_edge_(false), | 11 is_fixed_to_right_edge_(false), |
| 13 is_fixed_to_bottom_edge_(false) { | 12 is_fixed_to_bottom_edge_(false) { |
| 14 } | 13 } |
| 15 | 14 |
| 16 void LayerPositionConstraint::ToProtobuf( | |
| 17 proto::LayerPositionConstraint* proto) const { | |
| 18 proto->set_is_fixed_position(is_fixed_position_); | |
| 19 proto->set_is_fixed_to_right_edge(is_fixed_to_right_edge_); | |
| 20 proto->set_is_fixed_to_bottom_edge(is_fixed_to_bottom_edge_); | |
| 21 } | |
| 22 | |
| 23 void LayerPositionConstraint::FromProtobuf( | |
| 24 const proto::LayerPositionConstraint& proto) { | |
| 25 is_fixed_position_ = proto.is_fixed_position(); | |
| 26 is_fixed_to_right_edge_ = proto.is_fixed_to_right_edge(); | |
| 27 is_fixed_to_bottom_edge_ = proto.is_fixed_to_bottom_edge(); | |
| 28 } | |
| 29 | |
| 30 bool LayerPositionConstraint::operator==( | 15 bool LayerPositionConstraint::operator==( |
| 31 const LayerPositionConstraint& other) const { | 16 const LayerPositionConstraint& other) const { |
| 32 if (!is_fixed_position_ && !other.is_fixed_position_) | 17 if (!is_fixed_position_ && !other.is_fixed_position_) |
| 33 return true; | 18 return true; |
| 34 return is_fixed_position_ == other.is_fixed_position_ && | 19 return is_fixed_position_ == other.is_fixed_position_ && |
| 35 is_fixed_to_right_edge_ == other.is_fixed_to_right_edge_ && | 20 is_fixed_to_right_edge_ == other.is_fixed_to_right_edge_ && |
| 36 is_fixed_to_bottom_edge_ == other.is_fixed_to_bottom_edge_; | 21 is_fixed_to_bottom_edge_ == other.is_fixed_to_bottom_edge_; |
| 37 } | 22 } |
| 38 | 23 |
| 39 bool LayerPositionConstraint::operator!=( | 24 bool LayerPositionConstraint::operator!=( |
| 40 const LayerPositionConstraint& other) const { | 25 const LayerPositionConstraint& other) const { |
| 41 return !(*this == other); | 26 return !(*this == other); |
| 42 } | 27 } |
| 43 | 28 |
| 44 } // namespace cc | 29 } // namespace cc |
| OLD | NEW |