-
Notifications
You must be signed in to change notification settings - Fork 0
/
dummy_types.cpp
44 lines (35 loc) · 1.02 KB
/
dummy_types.cpp
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
#include "dummy_types.h"
#include <packet.h>
using namespace FTS;
using namespace FTSSrv2;
int FTSSrv2::Graphic::writeToPacket(Packet *in_pPacket) const
{
// Write informations to the packet.
in_pPacket->append(m_usW);
in_pPacket->append(m_usH);
in_pPacket->append(m_cForceAniso);
in_pPacket->append(m_cForceFilter);
// Write data to the packet.
in_pPacket->append(m_pData, m_usH*m_usW*4);
return 0;
}
int FTSSrv2::Graphic::readFromPacket(Packet *in_pPacket)
{
m_usW = m_usH = 0;
m_cForceAniso = m_cForceFilter = 0;
delete m_pData;
m_pData = nullptr;
// Read the informations from the packet.
in_pPacket->get(m_usW);
in_pPacket->get(m_usH);
in_pPacket->get(m_cForceAniso);
in_pPacket->get(m_cForceFilter);
if(m_usW*m_usH <= 4096*4096) {
m_pData = (uint8_t *)calloc(m_usW*m_usH*4, sizeof(uint8_t));
if(m_pData != NULL) {
// Read the data from the packet.
in_pPacket->get(m_pData, m_usH*m_usW*4);
}
}
return 0;
}