gint/src/render-fx/dpixel.c
Lephe 4df3d69d8c
render: add a window setting to restrict rendering
Mono text rendering is a bad hack and probably not that fast, but meh.
We can optimize it the day it becomes a bottleneck, if ever...
2022-11-19 17:19:28 +01:00

29 lines
540 B
C

#include <gint/display.h>
#include <gint/defs/types.h>
#include "render-fx.h"
/* dpixel() - change a pixel's color */
void dpixel(int x, int y, int color)
{
if(x < dwindow.left || x >= dwindow.right) return;
if(y < dwindow.top || y >= dwindow.bottom) return;
DMODE_OVERRIDE(dpixel, x, y, color);
uint32_t *lword = gint_vram + (y << 2) + (x >> 5);
uint32_t mask = 1 << (~x & 31);
if(color == C_WHITE)
{
*lword &= ~mask;
}
else if(color == C_BLACK)
{
*lword |= mask;
}
else if(color == C_INVERT)
{
*lword ^= mask;
}
}