blob: 735036e8c72c26613d0af66d078587f804a48894 (
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
|
#include "rgl.h"
void RGL_Rect(RGL_Context *ctx, unsigned int x, unsigned int y,
unsigned int width, unsigned int height) {
RGL_Command *rectCommand =
(RGL_Command *)RGL_ArenaAlloc(&ctx->queue.arena, sizeof(RGL_Command));
rectCommand->type = Rect;
rectCommand->data.rect.x = x;
rectCommand->data.rect.y = y;
rectCommand->data.rect.width = width;
rectCommand->data.rect.height = height;
rectCommand->data.rect.color = ctx->color;
ctx->queue.size += 1;
}
void RGL_BeginPath(RGL_Context *ctx, RGL_PathVerb verb) {
ctx->current =
(RGL_Command *)RGL_ArenaAlloc(&ctx->queue.arena, sizeof(RGL_Command));
ctx->current->type = Path;
ctx->current->data.path.color = ctx->color;
ctx->current->data.path.size = 0;
ctx->current->data.path.verb = verb;
}
void RGL_PathMoveTo(RGL_Context *ctx, int x, int y) {
RGL_Point *p =
(RGL_Point *)RGL_ArenaAlloc(&ctx->queue.arena, sizeof(RGL_Point));
p->x = RGL_GetFixedI(x);
p->y = RGL_GetFixedI(y);
ctx->current->data.path.size += 1;
}
void RGL_EndPath(RGL_Context *ctx) {
ctx->current->data.path.color = ctx->color;
ctx->current = 0;
ctx->queue.size += 1;
}
|