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
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
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
101EVE_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));
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 */
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_HAL_EXPORT void EVE_CoDlImpl_resetCoState(EVE_HalContext *phost)
Definition EVE_CoDl.c:83
EVE_HAL_EXPORT void EVE_CoDlImpl_resetDlState(EVE_HalContext *phost)
Definition EVE_CoDl.c:38
EVE's co-processor command.
#define EVE_HAL_EXPORT
#define EVE_DL_OPTIMIZE
#define EVE_CHIPID
#define EVE_FT810
Definition EVE_Config.h:58
#define VERTEX2F(x, y)
#define SAVE_CONTEXT()
#define BITMAPS
#define BITMAP_HANDLE(handle)
#define RESTORE_CONTEXT()
#define CELL(cell)
#define VERTEX2II(x, y, handle, cell)
#define EVE_DL_STATE
unsigned short uint16_t
short int16_t
unsigned char uint8_t
uint32_t Height
uint32_t CoBgColor
uint8_t CoScratchHandle
uint8_t DlPrimitive
uint8_t DlStateIndex
EVE_HalDlState DlState[EVE_DL_STATE_STACK_SIZE]
uint32_t CoFgColor
int16_t LineWidth
uint8_t VertexFormat
uint32_t ColorRGB
int16_t PointSize