Danil Chapovalov | ecc46ef | 2021-08-09 15:30:47 +0200 | [diff] [blame] | 1 | /* |
| 2 | * Copyright (c) 2021 The WebRTC project authors. All Rights Reserved. |
| 3 | * |
| 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 |
| 6 | * tree. An additional intellectual property rights grant can be found |
| 7 | * in the file PATENTS. All contributing project authors may |
| 8 | * be found in the AUTHORS file in the root of the source tree. |
| 9 | */ |
| 10 | |
| 11 | #ifndef API_VIDEO_RENDER_RESOLUTION_H_ |
| 12 | #define API_VIDEO_RENDER_RESOLUTION_H_ |
| 13 | |
| 14 | namespace webrtc { |
| 15 | |
Jonas Oreland | 0deda15 | 2022-09-23 12:08:57 +0200 | [diff] [blame] | 16 | // TODO(bugs.webrtc.org/12114) : remove in favor of Resolution. |
Danil Chapovalov | ecc46ef | 2021-08-09 15:30:47 +0200 | [diff] [blame] | 17 | class RenderResolution { |
| 18 | public: |
| 19 | constexpr RenderResolution() = default; |
| 20 | constexpr RenderResolution(int width, int height) |
| 21 | : width_(width), height_(height) {} |
| 22 | RenderResolution(const RenderResolution&) = default; |
| 23 | RenderResolution& operator=(const RenderResolution&) = default; |
| 24 | |
| 25 | friend bool operator==(const RenderResolution& lhs, |
| 26 | const RenderResolution& rhs) { |
| 27 | return lhs.width_ == rhs.width_ && lhs.height_ == rhs.height_; |
| 28 | } |
| 29 | friend bool operator!=(const RenderResolution& lhs, |
| 30 | const RenderResolution& rhs) { |
| 31 | return !(lhs == rhs); |
| 32 | } |
| 33 | |
| 34 | constexpr bool Valid() const { return width_ > 0 && height_ > 0; } |
| 35 | |
| 36 | constexpr int Width() const { return width_; } |
| 37 | constexpr int Height() const { return height_; } |
| 38 | |
| 39 | private: |
| 40 | int width_ = 0; |
| 41 | int height_ = 0; |
| 42 | }; |
| 43 | |
| 44 | } // namespace webrtc |
| 45 | |
| 46 | #endif // API_VIDEO_RENDER_RESOLUTION_H_ |