58 if (alpha != osd.alpha_last) {
59 osd.alpha_last = alpha;
60 SDL_SetTextureAlphaMod(osd.tex, alpha);
62 SDL_RenderCopy(
sdl_ren, osd.tex, NULL, NULL);
71 DEBUG(
"OSD: osd_clear_with_colour() called." NL);
72 for (
int i = 0; i < osd.xsize * osd.ysize; i++)
73 osd.pixels[i] = osd.colours[
index];
81 DEBUG(
"OSD: osd_clear() called." NL);
82 memset(osd.pixels, 0, osd.xsize * osd.ysize * 4);
90 DEBUG(
"OSD: %s() called." NL, __func__);
91 SDL_UpdateTexture(osd.tex, rect, rect ? osd.pixels + rect->y * osd.xsize + rect->x : osd.pixels, osd.xsize * sizeof (
Uint32));
101 if (osd.tex || osd.pixels)
102 FATAL(
"Calling osd_init() multiple times?");
105 ERROR_WINDOW(
"Error with SDL_CreateTexture(), OSD won't be available: %s", SDL_GetError());
108 if (SDL_SetTextureBlendMode(osd.tex, SDL_BLENDMODE_BLEND)) {
109 ERROR_WINDOW(
"Error with SDL_SetTextureBlendMode(), OSD won't be available: %s", SDL_GetError());
110 SDL_DestroyTexture(osd.tex);
119 for (
int a = 0; a < palette_entries; a++)
134 0xC0, 0x40, 0x40, 0xFF,
135 0xFF, 0xFF, 0x00, 0xFF,
136 0x00, 0x00, 0x00, 0x80,
137 0x00, 0xFF, 0x00, 0xFF
162 DEBUG(
"OSD: osd_off() called." NL);
168 osd.enabled = (
status && osd.available);
171 DEBUG(
"OSD: osd_global_enable(%d), result of status = %d" NL,
status, osd.enabled);
177 osd.colour_fg = osd.colours[fg_index];
178 osd.colour_bg = osd.colours[bg_index];
179 DEBUG(
"OSD: osd_set_colours(%d,%d) called." NL, fg_index, bg_index);
188 Uint32 *d = osd.pixels +
y * osd.xsize +
x;
189 Uint32 *e = osd.pixels + osd.xsize * osd.ysize;
190 if ((
signed char)ch < 32)
192 s =
font_16x16 + (((
unsigned char)ch - 32) << 4);
193 for (row = 0; row < 16; row++) {
197 *d = *s &
mask ? osd.colour_fg : osd.colour_bg;
200 DEBUG(
"OSD: ERROR: out of OSD dimensions for char %c at starting point %d:%d" NL, ch,
x,
y);
219 while (s[len] && s[len] !=
'\n')
221 xt = (
x < 0) ? ((osd.xsize - len * 16) / 2) :
x;
234 void osd_hijack (
void(*updater)(
void),
int *xsize_ptr,
int *ysize_ptr,
Uint32 **pixel_ptr )
242 *xsize_ptr = osd.xsize;
244 *ysize_ptr = osd.ysize;
246 *pixel_ptr = osd.pixels;