summaryrefslogtreecommitdiffhomepage
path: root/dev/Modules/FB/WS.h
blob: 72259eb48bae2a75ab8c57c2172fd1b41a2766cf (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
/* -------------------------------------------

	Copyright (C) 2024, EL Mahrouss Logic, all rights reserved.

------------------------------------------- */

#pragma once

#include <ArchKit/ArchKit.h>
#include <Modules/FB/FB.h>
#include <Modules/FB/Text.h>
#include <NewKit/Utils.h>

/// @file WS.h
/// @brief WindowServer's endpoint implementation. (within the zka-dev subsystem)

namespace WS
{
    using namespace Kernel;

    struct WSWindowContainer;

    typedef UInt32* WSBackBufferKind;

    class WSWindowContainer final
    {
    public:
        WSWindowContainer() = default;
        ~WSWindowContainer() = default;

        ZKA_COPY_DEFAULT(WSWindowContainer);

        /// @note the trick is, it could be GPU processed data, that's the cool thing.
        BOOL PopulateWindow(WSBackBufferKind contents_buf, SizeT contents_len)
        {
            if (contents_len > BackBufferLength)
                return NO;

            if (!contents_buf)
                return NO;

            if (!BackBuffer ||
                !BackBufferLength)
                return NO;

            rt_copy_memory(contents_buf, BackBuffer, contents_len);
            return YES;
        }

    public:
        WSBackBufferKind BackBuffer{nullptr};
        SizeT BackBufferLength{0UL};

    };
}

#define rtl_allocate_backbuffer(width, height) new WS::WSBackBufferKind[width * height]
#define rtl_compute_fb_geometry(width, height) (width * height)