1/*
2 * Copyright (C) 2020-2022 The opuntiaOS Project Authors.
3 * + Contributed by Nikita Melekhin <nimelehin@gmail.com>
4 *
5 * Use of this source code is governed by a BSD-style license that can be
6 * found in the LICENSE file.
7 */
8
9#include <libg/Rect.h>
10
11namespace LG {
12
13Rect::Rect(int x, int y, size_t width, size_t height)
14 : m_origin(x, y)
15 , m_width(width)
16 , m_height(height)
17{
18}
19
20void Rect::encode(EncodedMessage& buf) const
21{
22 Encoder::append(buf, m_origin);
23 Encoder::append(buf, m_width);
24 Encoder::append(buf, m_height);
25}
26
27void Rect::decode(const char* buf, size_t& offset)
28{
29 Encoder::decode(buf, offset, m_origin);
30 Encoder::decode(buf, offset, m_width);
31 Encoder::decode(buf, offset, m_height);
32}
33
34} // namespace LG