Project

General

Profile

Feature #837 ยป 0029-sdl3-Drop-unused-flags-parameter-from-create_surf.patch

Marko Lindqvist, 09/07/2024 06:34 AM

View differences:

client/gui-sdl3/action_dialog.c
if (buf->id == ID_SEPARATOR) {
FREESURFACE(buf->theme);
buf->size.h = h;
buf->theme = create_surf(w, h, SDL_SWSURFACE);
buf->theme = create_surf(w, h);
area2.y = buf->size.h / 2 - 1;
area2.w = buf->size.w - adj_size(20);
client/gui-sdl3/canvas.c
{
struct canvas *result = fc_malloc(sizeof(*result));
result->surf = create_surf(width, height, SDL_SWSURFACE);
result->surf = create_surf(width, height);
return result;
}
client/gui-sdl3/citydlg.c
}
psurf = create_surf(src_rect.w, src_rect.h, SDL_SWSURFACE);
psurf = create_surf(src_rect.w, src_rect.h);
alphablit(destcanvas->surf, &src_rect, psurf, NULL, 255);
canvas_free(destcanvas);
client/gui-sdl3/dialogs.c
if (buf->id == ID_SEPARATOR) {
FREESURFACE(buf->theme);
buf->size.h = h;
buf->theme = create_surf(w, h, SDL_SWSURFACE);
buf->theme = create_surf(w, h);
area2.y = buf->size.h / 2 - 1;
area2.w = buf->size.w - adj_size(20);
......
/* Create nations list */
/* Create Imprv Background Icon */
main_bg = create_surf(adj_size(96*2), adj_size(64), SDL_SWSURFACE);
main_bg = create_surf(adj_size(96*2), adj_size(64));
SDL_FillSurfaceRect(main_bg, NULL,
map_rgba(main_bg->format, bg_color));
client/gui-sdl3/graphics.c
struct gui_layer *gui_layer = NULL;
SDL_Surface *buffer;
buffer = create_surf(width, height, SDL_SWSURFACE);
buffer = create_surf(width, height);
gui_layer = gui_layer_new(0, 0, buffer);
/* add to buffers array */
/* Add to buffers array */
if (main_data.guis) {
int i;
/* find NULL element */
/* Find NULL element */
for (i = 0; i < main_data.guis_count; i++) {
if (!main_data.guis[i]) {
main_data.guis[i] = gui_layer;
......
/**********************************************************************//**
Create surface with the same format as main window
**************************************************************************/
SDL_Surface *create_surf(int width, int height, Uint32 flags)
SDL_Surface *create_surf(int width, int height)
{
return create_surf_with_format(main_surface->format, width, height);
}
......
Create an surface with screen format and fill with color.
If pcolor == NULL surface is filled with transparent white A = 128
**************************************************************************/
SDL_Surface *create_filled_surface(Uint16 w, Uint16 h, Uint32 flags,
SDL_Color *pcolor)
SDL_Surface *create_filled_surface(Uint16 w, Uint16 h, SDL_Color *pcolor)
{
SDL_Surface *new_surf;
SDL_Color color = {255, 255, 255, 128};
new_surf = create_surf(w, h, flags);
new_surf = create_surf(w, h);
if (!new_surf) {
return NULL;
......
if (main_data.gui) {
FREESURFACE(main_data.gui->surface);
main_data.gui->surface = create_surf(width, height, SDL_SWSURFACE);
main_data.gui->surface = create_surf(width, height);
} else {
main_data.gui = add_gui_layer(width, height);
}
......
return -3;
}
colorbar = create_surf(surf->w, surf->h, 0);
colorbar = create_surf(surf->w, surf->h);
SDL_FillSurfaceRect(colorbar, prect,
SDL_MapRGB(surf->format,
......
0, 0
};
result = create_surf(new_width, new_height, SDL_SWSURFACE);
result = create_surf(new_width, new_height);
alphablit(tmp_surface, NULL, result, &area, 255);
FREESURFACE(tmp_surface);
} else {
client/gui-sdl3/graphics.h
SDL_Surface *create_surf_with_format(SDL_PixelFormat *pf,
int width, int height);
SDL_Surface *create_surf(int width, int height, Uint32 flags);
SDL_Surface *create_surf(int width, int height);
SDL_Surface *convert_surf(SDL_Surface *surf_in);
SDL_Surface *create_filled_surface(Uint16 w, Uint16 h, Uint32 flags,
SDL_Color *pcolor);
SDL_Surface *create_filled_surface(Uint16 w, Uint16 h, SDL_Color *pcolor);
SDL_Surface *crop_rect_from_surface(SDL_Surface *psource,
SDL_Rect *prect);
client/gui-sdl3/gui_mouse.c
std_cursor = SDL_GetCursor();
surf = create_surf(1, 1, SDL_SWSURFACE);
surf = create_surf(1, 1);
disabled_cursor = SurfaceToCursor(surf, 0, 0);
FREESURFACE(surf);
client/gui-sdl3/gui_string.c
log_debug("create_utf8_surf: String is %d length", text->w);
} else {
log_debug("create_utf8_surf: text NULL");
text = create_surf(0, 0, SDL_SWSURFACE);
text = create_surf(0, 0);
}
if (!((pstr->style & 0x0F) & TTF_STYLE_NORMAL)) {
......
switch (pstr->render) {
case 1:
text = create_surf(w, count * tmp[0]->h, SDL_SWSURFACE);
text = create_surf(w, count * tmp[0]->h);
SDL_FillSurfaceRect(text, NULL, color);
SDL_SetSurfaceColorKey(text, SDL_TRUE, color);
break;
......
SDL_FillSurfaceRect(text, NULL, color);
break;
default:
text = create_surf(w, count * tmp[0]->h, SDL_SWSURFACE);
text = create_surf(w, count * tmp[0]->h);
SDL_FillSurfaceRect(text, NULL, color);
break;
}
client/gui-sdl3/gui_tilespec.c
load_city_icon_surface(spr, police, "city.police");
/* ================================================================= */
icons->worklist = create_surf(9,9, SDL_SWSURFACE);
icons->worklist = create_surf(9, 9);
SDL_FillSurfaceRect(icons->worklist, NULL,
SDL_MapRGB(icons->worklist->format, 255, 255,255));
......
pstr->style |= (TTF_STYLE_BOLD | SF_CENTER);
/* Create icons */
surf = create_surf(adj_size(50), adj_size(50), SDL_SWSURFACE);
surf = create_surf(adj_size(50), adj_size(50));
SDL_FillSurfaceRect(surf, NULL, map_rgba(surf->format, bg_color));
create_frame(surf,
0 , 0, surf->w - 1, surf->h - 1,
client/gui-sdl3/helpdlg.c
pstr->style |= (TTF_STYLE_BOLD | SF_CENTER);
/* Background template for entries in scroll list */
background_tmpl = create_surf(adj_size(135), adj_size(40), SDL_SWSURFACE);
background_tmpl = create_surf(adj_size(135), adj_size(40));
SDL_FillSurfaceRect(background_tmpl, NULL,
map_rgba(background_tmpl->format, bg_color));
......
pstr->style |= (TTF_STYLE_BOLD | SF_CENTER);
/* Background template for entries in scroll list */
background_tmpl = create_surf(adj_size(135), adj_size(40), SDL_SWSURFACE);
background_tmpl = create_surf(adj_size(135), adj_size(40));
SDL_FillSurfaceRect(background_tmpl, NULL,
map_rgba(background_tmpl->format, bg_color));
client/gui-sdl3/mapctrl.c
pwidget->size.y = main_window_height() - h;
FREESURFACE(pwidget->theme);
pwidget->theme = create_surf(w, h, SDL_SWSURFACE);
pwidget->theme = create_surf(w, h);
draw_frame(pwidget->theme, 0, 0, pwidget->size.w, pwidget->size.h);
......
/* Make UNITS Icon */
icon_theme = create_surf(current_theme->map_icon->w,
current_theme->map_icon->h, SDL_SWSURFACE);
current_theme->map_icon->h);
alphablit(current_theme->map_icon, NULL, icon_theme, NULL, 255);
alphablit(current_theme->r_arrow_icon, NULL, icon_theme, NULL, 255);
......
add_to_gui_list(ID_CLIENT_OPTIONS, options_button);
#endif /* GUI_SDL3_SMALL_SCREEN */
/* show/hide minimap button */
/* Show/hide minimap button */
/* make Map Icon */
/* Make Map Icon */
icon_theme = create_surf(current_theme->map_icon->w,
current_theme->map_icon->h,
SDL_SWSURFACE);
current_theme->map_icon->h);
alphablit(current_theme->map_icon, NULL, icon_theme, NULL, 255);
alphablit(current_theme->l_arrow_icon, NULL, icon_theme, NULL, 255);
client/gui-sdl3/mapview.c
astr_free(&addition);
buf_surf = create_surf(tileset_full_tile_width(tileset),
tileset_full_tile_height(tileset),
SDL_SWSURFACE);
tileset_full_tile_height(tileset));
destcanvas = canvas_create(tileset_full_tile_width(tileset),
tileset_full_tile_height(tileset));
client/gui-sdl3/optiondlg.c
area.y += adj_size(12);
area.w -= adj_size(12) + adj_size(12);
area.h -= adj_size(12) + adj_size(12);
background->theme = create_surf(area.w, area.h, SDL_SWSURFACE);
background->theme = create_surf(area.w, area.h);
widget_set_area(background, area);
widget_set_position(background, area.x, area.y);
SDL_FillSurfaceRect(background->theme, NULL,
client/gui-sdl3/repodlgs.c
if (entries_used > 0) {
/* Create Imprv Background Icon */
background = create_surf(adj_size(116), adj_size(116), SDL_SWSURFACE);
background = create_surf(adj_size(116), adj_size(116));
SDL_FillSurfaceRect(background, NULL, map_rgba(background->format, bg_color));
......
text = create_text_surf_smaller_than_w(pstr, adj_size(100 - 4));
/* Create label surface */
surf = create_surf(w, h, SDL_SWSURFACE);
surf = create_surf(w, h);
if (tech_id == research_get(client_player())->researching) {
color.a = 180;
client/gui-sdl3/widget.c
j = MAX(tile_width_height_end * 2, height);
zoom = ((i != width) || (j != height));
/* now allocate memory */
background = create_surf(i, j, SDL_SWSURFACE);
/* Now allocate memory */
background = create_surf(i, j);
/* copy left end */
/* Copy left end */
/* left top */
/* Left top */
src.x = 0;
src.y = start_y;
src.w = tile_width_len_end;
......
pwidget->info_label->style |= TTF_STYLE_BOLD;
pwidget->info_label->fgcol = *get_theme_color(COLOR_THEME_QUICK_INFO_TEXT);
/* create string and bcgd theme */
/* Create string and bcgd theme */
text = create_text_surf_from_utf8(pwidget->info_label);
pwidget->info_label->fgcol = color;
info_label = create_filled_surface(text->w + adj_size(10), text->h + adj_size(6),
SDL_SWSURFACE,
get_theme_color(COLOR_THEME_QUICK_INFO_BG));
/* calculate start position */
/* Calculate start position */
if ((pwidget->dst->dest_rect.y + pwidget->size.y) - info_label->h - adj_size(6) < 0) {
info_area->y = (pwidget->dst->dest_rect.y + pwidget->size.y) + pwidget->size.h + adj_size(3);
} else {
......
info_area->w = info_label->w + adj_size(2);
info_area->h = info_label->h + adj_size(3);
/* draw text */
/* Draw text */
dstrect.x = adj_size(6);
dstrect.y = adj_size(3);
......
FREESURFACE(text);
/* draw frame */
/* Draw frame */
create_frame(info_label,
0, 0, info_label->w - 1, info_label->h - 1,
get_theme_color(COLOR_THEME_QUICK_INFO_FRAME));
client/gui-sdl3/widget_icon.c
SDL_Surface *ptheme;
get_smaller_surface_rect(icon, &src);
ptheme = create_surf((src.w + adj_size(4)) * 4, src.h + adj_size(4),
SDL_SWSURFACE);
ptheme = create_surf((src.w + adj_size(4)) * 4, src.h + adj_size(4));
dest.x = adj_size(2);
dest.y = (ptheme->h - src.h) / 2;
/* normal */
/* Normal */
alphablit(icon, &src, ptheme, &dest, 255);
/* selected */
/* Selected */
dest.x += (src.w + adj_size(4));
alphablit(icon, &src, ptheme, &dest, 255);
/* draw selected frame */
/* Draw selected frame */
create_frame(ptheme,
dest.x - 1, dest.y - 1, src.w + 1, src.h + 1,
get_theme_color(COLOR_THEME_CUSTOM_WIDGET_SELECTED_FRAME));
/* pressed */
/* Pressed */
dest.x += (src.w + adj_size(4));
alphablit(icon, &src, ptheme, &dest, 255);
/* draw selected frame */
/* Draw selected frame */
create_frame(ptheme,
dest.x - 1, dest.y - 1, src.w + 1, src.h + 1,
get_theme_color(COLOR_THEME_CUSTOM_WIDGET_SELECTED_FRAME));
/* draw press frame */
/* Draw press frame */
create_frame(ptheme,
dest.x - adj_size(2), dest.y - adj_size(2),
src.w + adj_size(3), src.h + adj_size(3),
get_theme_color(COLOR_THEME_CUSTOM_WIDGET_PRESSED_FRAME));
/* disabled */
/* Disabled */
dest.x += (src.w + adj_size(4));
alphablit(icon, &src, ptheme, &dest, 255);
dest.w = src.w;
client/gui-sdl3/widget_label.c
label->size.w = MAX(label->size.w, w);
label->size.h = MAX(label->size.h, h);
ptheme = create_surf(label->size.w, label->size.h * 2, SDL_SWSURFACE);
ptheme = create_surf(label->size.w, label->size.h * 2);
colorkey = SDL_MapRGBA(ptheme->format, pstr->bgcol.r,
pstr->bgcol.g, pstr->bgcol.b, pstr->bgcol.a);
......
Uint32 colorkey, flags = get_wflags(icon_label);
SDL_Surface *pdest;
SDL_Surface *ptheme = create_surf(icon_label->size.w,
icon_label->size.h * 2, SDL_SWSURFACE);
icon_label->size.h * 2);
colorkey = SDL_MapRGBA(ptheme->format,
icon_label->string_utf8->bgcol.r,
client/gui-sdl3/widget_scrollbar.c
}
if (!tile_count_midd) {
versurf = create_surf(vert_theme->w, tile_len_end * 2, SDL_SWSURFACE);
versurf = create_surf(vert_theme->w, tile_len_end * 2);
} else {
versurf = create_surf(vert_theme->w, height, SDL_SWSURFACE);
versurf = create_surf(vert_theme->w, height);
}
src.x = 0;
......
}
if (!tile_count_midd) {
horsurf = create_surf(tile_len_end * 2, horiz_theme->h, SDL_SWSURFACE);
horsurf = create_surf(tile_len_end * 2, horiz_theme->h);
} else {
horsurf = create_surf(width, horiz_theme->h, SDL_SWSURFACE);
horsurf = create_surf(width, horiz_theme->h);
}
src.y = 0;
client/gui-sdl3/widget_window.c
FREESURFACE(pwindow->dst->surface);
pwindow->dst->surface = create_surf(pwindow->size.w,
pwindow->size.h,
SDL_SWSURFACE);
pwindow->size.h);
}
if (bcgd != pwindow->theme) {
......
return FALSE;
}
} else {
pwindow->theme = create_surf(new_w, new_h, SDL_SWSURFACE);
pwindow->theme = create_surf(new_w, new_h);
if (pcolor == NULL) {
color = *get_theme_color(COLOR_THEME_BACKGROUND);
client/gui-sdl3/wldlg.c
/* --------------- */
/* Create Target Background Icon */
main_surf = create_surf(adj_size(116), adj_size(116), SDL_SWSURFACE);
main_surf = create_surf(adj_size(116), adj_size(116));
SDL_FillSurfaceRect(main_surf, NULL, map_rgba(main_surf->format, bg_color));
create_frame(main_surf,
    (1-1/1)