OLD | NEW |
1 /* | 1 /* |
2 * Copyright (c) 2013 The WebRTC project authors. All Rights Reserved. | 2 * Copyright (c) 2013 The WebRTC project authors. All Rights Reserved. |
3 * | 3 * |
4 * Use of this source code is governed by a BSD-style license | 4 * Use of this source code is governed by a BSD-style license |
5 * that can be found in the LICENSE file in the root of the source | 5 * that can be found in the LICENSE file in the root of the source |
6 * tree. An additional intellectual property rights grant can be found | 6 * tree. An additional intellectual property rights grant can be found |
7 * in the file PATENTS. All contributing project authors may | 7 * in the file PATENTS. All contributing project authors may |
8 * be found in the AUTHORS file in the root of the source tree. | 8 * be found in the AUTHORS file in the root of the source tree. |
9 */ | 9 */ |
10 | 10 |
(...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
47 void DesktopRect::Extend(int32_t left_offset, | 47 void DesktopRect::Extend(int32_t left_offset, |
48 int32_t top_offset, | 48 int32_t top_offset, |
49 int32_t right_offset, | 49 int32_t right_offset, |
50 int32_t bottom_offset) { | 50 int32_t bottom_offset) { |
51 left_ -= left_offset; | 51 left_ -= left_offset; |
52 top_ -= top_offset; | 52 top_ -= top_offset; |
53 right_ += right_offset; | 53 right_ += right_offset; |
54 bottom_ += bottom_offset; | 54 bottom_ += bottom_offset; |
55 } | 55 } |
56 | 56 |
| 57 void DesktopRect::UnionWith(const DesktopRect& rect) { |
| 58 if (is_empty()) { |
| 59 left_ = rect.left(); |
| 60 top_ = rect.top(); |
| 61 right_ = rect.right(); |
| 62 bottom_ = rect.bottom(); |
| 63 } else { |
| 64 left_ = std::min(left(), rect.left()); |
| 65 top_ = std::min(top(), rect.top()); |
| 66 right_ = std::max(right(), rect.right()); |
| 67 bottom_ = std::max(bottom(), rect.bottom()); |
| 68 } |
| 69 } |
| 70 |
57 } // namespace webrtc | 71 } // namespace webrtc |
58 | 72 |
OLD | NEW |