Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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/display/types/display_mode.h" | 5 #include "ui/display/types/display_mode.h" |
| 6 | 6 |
| 7 #include "base/memory/ptr_util.h" | 7 #include "base/memory/ptr_util.h" |
| 8 #include "base/strings/stringprintf.h" | 8 #include "base/strings/stringprintf.h" |
| 9 | 9 |
| 10 namespace display { | 10 namespace display { |
| 11 | 11 |
| 12 DisplayMode::DisplayMode(const gfx::Size& size, | 12 DisplayMode::DisplayMode(const gfx::Size& size, |
| 13 bool interlaced, | 13 bool interlaced, |
| 14 float refresh_rate) | 14 float refresh_rate) |
| 15 : size_(size), | 15 : size_(size), |
| 16 is_interlaced_(interlaced), | 16 is_interlaced_(interlaced), |
| 17 refresh_rate_(refresh_rate) {} | 17 refresh_rate_(refresh_rate) {} |
| 18 | 18 |
| 19 DisplayMode::~DisplayMode() {} | 19 DisplayMode::~DisplayMode() {} |
| 20 | 20 |
| 21 std::unique_ptr<DisplayMode> DisplayMode::Clone() const { | 21 std::unique_ptr<DisplayMode> DisplayMode::Clone() const { |
| 22 return base::WrapUnique(new DisplayMode(size_, | 22 return base::WrapUnique(new DisplayMode(size_, |
| 23 is_interlaced_, | 23 is_interlaced_, |
| 24 refresh_rate_)); | 24 refresh_rate_)); |
| 25 } | 25 } |
| 26 | 26 |
| 27 bool DisplayMode::operator==(const DisplayMode& display_mode) const { | |
| 28 return (this->size() == display_mode.size()) && | |
|
kylechar
2017/02/13 22:01:24
You don't need () around each == statement.
thanhph1
2017/02/14 20:20:54
Done.
| |
| 29 (this->is_interlaced() == display_mode.is_interlaced()) && | |
| 30 (this->refresh_rate() == display_mode.refresh_rate()); | |
| 31 } | |
| 32 | |
| 27 std::string DisplayMode::ToString() const { | 33 std::string DisplayMode::ToString() const { |
| 28 return base::StringPrintf("[%dx%d %srate=%f]", | 34 return base::StringPrintf("[%dx%d %srate=%f]", |
| 29 size_.width(), | 35 size_.width(), |
| 30 size_.height(), | 36 size_.height(), |
| 31 is_interlaced_ ? "interlaced " : "", | 37 is_interlaced_ ? "interlaced " : "", |
| 32 refresh_rate_); | 38 refresh_rate_); |
| 33 } | 39 } |
| 34 | 40 |
| 35 void PrintTo(const DisplayMode& mode, std::ostream* os) { | 41 void PrintTo(const DisplayMode& mode, std::ostream* os) { |
| 36 *os << mode.ToString(); | 42 *os << mode.ToString(); |
| 37 } | 43 } |
| 38 | 44 |
| 39 } // namespace display | 45 } // namespace display |
| OLD | NEW |