image/svg+xml
Brteve's API for EveApps
Version 0.0.1
The reference document for common folder of EveApps project.
Loading...
Searching...
No Matches
EVE_CoDl.c
Go to the documentation of this file.
1
32
#include "
EVE_CoDl.h
"
33
34
#if defined(_MSC_VER) && (_MSC_VER < 1800)
35
#include <stdio.h>
/* memset */
36
#endif
37
38
EVE_HAL_EXPORT
void
EVE_CoDlImpl_resetDlState
(
EVE_HalContext
*phost)
39
{
40
#if (EVE_DL_OPTIMIZE) || (EVE_DL_CACHE_SCISSOR) || (EVE_SUPPORT_CHIPID < EVE_FT810) || defined(EVE_MULTI_GRAPHICS_TARGET)
41
phost->
DlStateIndex
= 0;
42
#if defined(_MSC_VER) && (_MSC_VER < 1800)
43
/* Designated initializers not supported in older Visual Studio versions */
44
memset(&phost->
DlState
[0], 0,
sizeof
(
EVE_HalDlState
));
45
#if (EVE_DL_OPTIMIZE)
46
phost->
DlState
[0].
LineWidth
= 16;
47
phost->
DlState
[0].
PointSize
= 16;
48
phost->
DlState
[0].
ColorRGB
= 0xFFFFFF;
49
phost->
DlState
[0].
ColorA
= 0xFF;
50
phost->
DlState
[0].
Handle
= 0x3F;
/* Invalid value */
51
#endif
52
phost->
DlState
[0].
VertexFormat
= 4;
53
#else
54
phost->
DlState
[0] = (
EVE_HalDlState
)
55
{
56
#if (EVE_DL_OPTIMIZE)
57
.
LineWidth
= 16,
58
.PointSize = 16,
59
.ColorRGB = 0xFFFFFF,
60
#endif
61
#if (EVE_DL_CACHE_SCISSOR)
62
.ScissorWidth = (
uint16_t
)phost->
Width
,
63
.ScissorHeight = (
uint16_t
)phost->
Height
,
64
#endif
65
#if (EVE_DL_OPTIMIZE)
66
.ColorA = 0xFF,
67
.Handle = 0x3F,
/* Invalid value */
68
#endif
69
#if (EVE_DL_OPTIMIZE) || (EVE_SUPPORT_CHIPID < EVE_FT810) || defined(EVE_MULTI_GRAPHICS_TARGET)
70
.VertexFormat = 4,
71
#elif (EVE_DL_CACHE_SCISSOR)
72
0
73
#endif
74
};
75
#endif
76
#endif
77
78
#if (EVE_DL_OPTIMIZE)
79
phost->
DlPrimitive
= 0;
80
#endif
81
}
82
83
EVE_HAL_EXPORT
void
EVE_CoDlImpl_resetCoState
(
EVE_HalContext
*phost)
84
{
85
#if (EVE_DL_OPTIMIZE)
86
phost->
CoFgColor
= 0x003870;
87
phost->
CoBgColor
= 0x002040;
88
phost->
CoBitmapTransform
=
false
;
89
#endif
90
91
#if (EVE_SUPPORT_CHIPID >= EVE_FT810)
92
if
(
EVE_CHIPID
>=
EVE_FT810
)
93
{
94
phost->
CoScratchHandle
= 15;
95
}
96
#endif
97
}
98
99
#if (EVE_SUPPORT_CHIPID < EVE_FT810) || defined(EVE_MULTI_GRAPHICS_TARGET)
100
101
EVE_HAL_EXPORT
void
EVE_CoDlImpl_vertex2ii_translate(
EVE_HalContext
*phost,
uint16_t
x,
uint16_t
y,
uint8_t
handle,
uint8_t
cell)
102
{
103
int16_t
xf = (x << 4) +
EVE_DL_STATE
.VertexTranslateX;
104
int16_t
yf = (y << 4) +
EVE_DL_STATE
.VertexTranslateY;
105
if
(xf < 0 || yf < 0 || xf & 0xF || yf & 0xF)
106
{
107
#if (EVE_DL_OPTIMIZE) || (!EVE_DL_END_PRIMITIVE)
108
if
(phost->DlPrimitive ==
BITMAPS
109
#if (
EVE_DL_OPTIMIZE
)
110
&& (
EVE_DL_STATE
.Handle != handle ||
EVE_DL_STATE
.Cell != cell)
111
#endif
112
)
113
#endif
114
{
115
EVE_CoCmd_dl
(phost,
SAVE_CONTEXT
());
116
EVE_CoCmd_dl
(phost,
BITMAP_HANDLE
(handle));
117
EVE_CoCmd_dl
(phost,
CELL
(cell));
118
EVE_CoCmd_dl
(phost,
VERTEX2F
(xf, yf));
119
EVE_CoCmd_dl
(phost,
RESTORE_CONTEXT
());
120
}
121
#if (EVE_DL_OPTIMIZE) || (!EVE_DL_END_PRIMITIVE)
122
else
123
{
124
EVE_CoCmd_dl
(phost,
VERTEX2F
(xf, yf));
125
}
126
#endif
127
}
128
else
129
{
130
EVE_CoCmd_dl
(phost,
VERTEX2II
(xf >> 4, yf >> 4, handle, cell));
131
}
132
}
133
134
#endif
135
136
/* Nothing beyond this */
EVE_CoCmd_dl
static void EVE_CoCmd_dl(EVE_HalContext *phost, uint32_t dl)
Write a display list instruction. Example: EVE_CoCmd_dl(DISPLAY());.
Definition
EVE_CoCmd.h:117
EVE_CoDlImpl_resetCoState
EVE_HAL_EXPORT void EVE_CoDlImpl_resetCoState(EVE_HalContext *phost)
Definition
EVE_CoDl.c:83
EVE_CoDlImpl_resetDlState
EVE_HAL_EXPORT void EVE_CoDlImpl_resetDlState(EVE_HalContext *phost)
Definition
EVE_CoDl.c:38
EVE_CoDl.h
EVE's co-processor command.
EVE_HAL_EXPORT
#define EVE_HAL_EXPORT
Definition
EVE_Config.h:1410
EVE_DL_OPTIMIZE
#define EVE_DL_OPTIMIZE
Definition
EVE_Config.h:1482
EVE_CHIPID
#define EVE_CHIPID
Definition
EVE_Config.h:1439
EVE_FT810
#define EVE_FT810
Definition
EVE_Config.h:58
VERTEX2F
#define VERTEX2F(x, y)
Definition
EVE_GpuDefs.h:554
SAVE_CONTEXT
#define SAVE_CONTEXT()
Definition
EVE_GpuDefs.h:605
BITMAPS
#define BITMAPS
Definition
EVE_GpuDefs.h:732
BITMAP_HANDLE
#define BITMAP_HANDLE(handle)
Definition
EVE_GpuDefs.h:561
RESTORE_CONTEXT
#define RESTORE_CONTEXT()
Definition
EVE_GpuDefs.h:606
CELL
#define CELL(cell)
Definition
EVE_GpuDefs.h:562
VERTEX2II
#define VERTEX2II(x, y, handle, cell)
Definition
EVE_GpuDefs.h:555
EVE_DL_STATE
#define EVE_DL_STATE
Definition
EVE_HalDefs.h:198
uint16_t
unsigned short uint16_t
Definition
EVE_IntTypes_MSVC12.h:41
int16_t
short int16_t
Definition
EVE_IntTypes_MSVC12.h:37
uint8_t
unsigned char uint8_t
Definition
EVE_IntTypes_MSVC12.h:40
EVE_HalContext
Definition
EVE_HalDefs.h:233
EVE_HalContext::Height
uint32_t Height
Definition
EVE_HalDefs.h:266
EVE_HalContext::CoBgColor
uint32_t CoBgColor
Definition
EVE_HalDefs.h:357
EVE_HalContext::CoScratchHandle
uint8_t CoScratchHandle
Definition
EVE_HalDefs.h:361
EVE_HalContext::Width
uint32_t Width
Definition
EVE_HalDefs.h:265
EVE_HalContext::DlPrimitive
uint8_t DlPrimitive
Definition
EVE_HalDefs.h:355
EVE_HalContext::DlStateIndex
uint8_t DlStateIndex
Definition
EVE_HalDefs.h:352
EVE_HalContext::DlState
EVE_HalDlState DlState[EVE_DL_STATE_STACK_SIZE]
Definition
EVE_HalDefs.h:351
EVE_HalContext::CoFgColor
uint32_t CoFgColor
Definition
EVE_HalDefs.h:356
EVE_HalContext::CoBitmapTransform
bool CoBitmapTransform
Definition
EVE_HalDefs.h:358
EVE_HalDlState
Definition
EVE_HalDefs.h:200
EVE_HalDlState::LineWidth
int16_t LineWidth
Definition
EVE_HalDefs.h:207
EVE_HalDlState::VertexFormat
uint8_t VertexFormat
Definition
EVE_HalDefs.h:225
EVE_HalDlState::Handle
uint8_t Handle
Definition
EVE_HalDefs.h:222
EVE_HalDlState::ColorA
uint8_t ColorA
Definition
EVE_HalDefs.h:221
EVE_HalDlState::ColorRGB
uint32_t ColorRGB
Definition
EVE_HalDefs.h:206
EVE_HalDlState::PointSize
int16_t PointSize
Definition
EVE_HalDefs.h:208
common
eve_hal
EVE_CoDl.c
Copyright © Bridgetek Pte Ltd