summaryrefslogtreecommitdiff
path: root/src/egg/core/eggXfb.cpp
blob: 81b65b5debba7dcabb62eb64c80605c348155010 (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
#include "egg/core/eggXfb.h"

#include "egg/core/eggSystem.h"
#include "egg/core/eggVideo.h"


namespace EGG {

/* 804989e0 */ void Xfb::init(u16 width, u16 height, Heap *heap) {
    mWidth = width;
    mHeight = height;
    u32 size = calcBufferSize(width, height);
    if (heap == nullptr) {
        heap = Heap::sCurrentHeap;
    }

    u8 *buf = new (heap, 32) u8[size];
    mBuffer = buf;
    mPrev = nullptr;
    mNext = nullptr;
    mState = XFB_UNPROCESSED;
}

/* 80498a60 */ Xfb::Xfb(Heap *heap) {
    Video *video = BaseSystem::mConfigData->getVideo();
    init(video->pRenderMode->fbWidth, video->pRenderMode->xfbHeight, heap);
}

/* 80498ad0 */ u32 Xfb::calcBufferSize(u16 width, u16 height) {
    return ((width + 0xf) & 0xfff0) * height * 2;
}

} // namespace EGG