Feature #922 ยป 0045-sdl3-Update-create_line-to-sdl3-changes.patch
client/gui-sdl3/graphics.c | ||
---|---|---|
struct color gsdl3_color;
|
||
int l = MAX((xr - xl) + 1, (yb - yt) + 1);
|
||
int i;
|
||
const struct SDL_PixelFormatDetails *details;
|
||
pcol = fc_malloc(sizeof(pcol));
|
||
pcol->r = pcolor->r;
|
||
... | ... | |
spr = create_sprite(w, h, &gsdl3_color);
|
||
lock_surf(spr->psurface);
|
||
details = SDL_GetPixelFormatDetails(spr->psurface->format);
|
||
/* Set off transparency from pixels belonging to the line */
|
||
if ((x0 <= x1 && y0 <= y1)
|
||
... | ... | |
int cy = (yb - yt) * i / l;
|
||
*((Uint32 *)spr->psurface->pixels + spr->psurface->w * cy + cx)
|
||
|= (pcolor->a << spr->psurface->format->Ashift);
|
||
|= (pcolor->a << details->Ashift);
|
||
}
|
||
} else {
|
||
for (i = 0; i < l; i++) {
|
||
... | ... | |
int cy = yb - yt - (yb - yt) * i / l;
|
||
*((Uint32 *)spr->psurface->pixels + spr->psurface->w * cy + cx)
|
||
|= (pcolor->a << spr->psurface->format->Ashift);
|
||
|= (pcolor->a << details->Ashift);
|
||
}
|
||
}
|
||