blob: edcf8f8ee58c5021f886530b8c9938f7f7584329 [file] [log] [blame]
Danil Chapovalovecc46ef2021-08-09 15:30:47 +02001/*
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
14namespace webrtc {
15
Danil Chapovalovecc46ef2021-08-09 15:30:47 +020016class RenderResolution {
17 public:
18 constexpr RenderResolution() = default;
19 constexpr RenderResolution(int width, int height)
20 : width_(width), height_(height) {}
21 RenderResolution(const RenderResolution&) = default;
22 RenderResolution& operator=(const RenderResolution&) = default;
23
24 friend bool operator==(const RenderResolution& lhs,
25 const RenderResolution& rhs) {
26 return lhs.width_ == rhs.width_ && lhs.height_ == rhs.height_;
27 }
28 friend bool operator!=(const RenderResolution& lhs,
29 const RenderResolution& rhs) {
30 return !(lhs == rhs);
31 }
32
33 constexpr bool Valid() const { return width_ > 0 && height_ > 0; }
34
35 constexpr int Width() const { return width_; }
36 constexpr int Height() const { return height_; }
37
38 private:
39 int width_ = 0;
40 int height_ = 0;
41};
42
43} // namespace webrtc
44
45#endif // API_VIDEO_RENDER_RESOLUTION_H_