Skip to content

Commit 59f0aa5

Browse files
committed
cleanup: remove FD_UpdateRect[s]() wrappers
1 parent d106b7f commit 59f0aa5

7 files changed

Lines changed: 24 additions & 47 deletions

File tree

‎src/graphics.c‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1437,7 +1437,7 @@ white_noise (SDL_Surface *bitmap, SDL_Rect *rect, int timeout)
14371437
SDL_SetClipRect (ne_screen, NULL);
14381438
// set it
14391439
SDL_BlitSurface (noise_tiles[next_tile], NULL, ne_screen, rect);
1440-
FD_UpdateRect (ne_screen, rect->x, rect->y, rect->w, rect->h);
1440+
SDL_UpdateWindowSurfaceRects (FD_GetWindow(), rect, 1);
14411441
SDL_Delay(25);
14421442

14431443
if ( (timeout != 0) && ((int)(SDL_GetTicks() - now) > timeout) )

‎src/misc.c‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1198,7 +1198,7 @@ update_progress (int percent)
11981198
// Fill_Rect (dst, progress_color);
11991199
SDL_BlitSurface (progress_filler_pic, &src, ne_screen, &dst);
12001200

1201-
FD_UpdateRects (ne_screen, 1, &dst);
1201+
SDL_UpdateWindowSurfaceRects (FD_GetWindow(), &dst, 1);
12021202

12031203
return;
12041204

‎src/sdl_compat.c‎

Lines changed: 0 additions & 36 deletions
Original file line numberDiff line numberDiff line change
@@ -26,42 +26,6 @@ FD_SetVideoMode(int width, int height, int bpp, Uint32 flags)
2626
return SDL_GetWindowSurface(fd_window);
2727
}
2828

29-
void
30-
FD_UpdateRect(SDL_Surface *screen, Sint32 x, Sint32 y, Uint32 w, Uint32 h)
31-
{
32-
SDL_Rect rect;
33-
34-
(void)screen;
35-
if (!fd_window)
36-
return;
37-
38-
if (w == 0 || h == 0)
39-
{
40-
SDL_UpdateWindowSurface(fd_window);
41-
return;
42-
}
43-
44-
rect.x = x;
45-
rect.y = y;
46-
rect.w = w;
47-
rect.h = h;
48-
SDL_UpdateWindowSurfaceRects(fd_window, &rect, 1);
49-
}
50-
51-
void
52-
FD_UpdateRects(SDL_Surface *screen, int numrects, SDL_Rect *rects)
53-
{
54-
(void)screen;
55-
if (!fd_window)
56-
return;
57-
if (numrects <= 0 || !rects)
58-
{
59-
SDL_UpdateWindowSurface(fd_window);
60-
return;
61-
}
62-
SDL_UpdateWindowSurfaceRects(fd_window, rects, numrects);
63-
}
64-
6529
SDL_Window *
6630
FD_GetWindow(void)
6731
{

‎src/sdl_compat.h‎

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,8 +8,6 @@ extern "C" {
88
#endif
99

1010
SDL_Surface *FD_SetVideoMode(int width, int height, int bpp, Uint32 flags);
11-
void FD_UpdateRect(SDL_Surface *screen, Sint32 x, Sint32 y, Uint32 w, Uint32 h);
12-
void FD_UpdateRects(SDL_Surface *screen, int numrects, SDL_Rect *rects);
1311
SDL_Window *FD_GetWindow(void);
1412
void FD_DestroyWindow(void);
1513

‎src/ship.c‎

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -806,8 +806,8 @@ Sensors 1: %s\n\
806806

807807
if (flags & UPDATE_ONLY)
808808
{
809-
FD_UpdateRects (ne_screen, 1, &Cons_Header_Rect);
810-
FD_UpdateRects (ne_screen, 1, &Cons_Text_Rect);
809+
SDL_UpdateWindowSurfaceRects (FD_GetWindow(), &Cons_Header_Rect, 1);
810+
SDL_UpdateWindowSurfaceRects (FD_GetWindow(), &Cons_Text_Rect, 1);
811811
}
812812
else
813813
SDL_UpdateWindowSurface(FD_GetWindow());
@@ -918,7 +918,7 @@ show_droid_portrait (SDL_Rect dst, int droid_type, float cycle_time, int flags)
918918
SDL_BlitSurface (droid_background, NULL, ne_screen, &dst);
919919
SDL_BlitSurface (droid_pics, &src_rect, ne_screen, &dst);
920920

921-
FD_UpdateRects (ne_screen, 1, &dst);
921+
SDL_UpdateWindowSurfaceRects (FD_GetWindow(), &dst, 1);
922922

923923
last_frame_time = SDL_GetTicks();
924924
}

‎src/text.c‎

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -692,7 +692,15 @@ printf_SDL (SDL_Surface *screen, int x, int y, const char *fmt, ...)
692692
PutString (screen, x, y, TextBuffer);
693693
h = FontHeight (GetCurrentFont()) + 2;
694694

695-
FD_UpdateRect (screen, x, y, textlen, h); // update the relevant line
695+
if (screen == ne_screen)
696+
{
697+
SDL_Rect dst;
698+
dst.x = x;
699+
dst.y = y;
700+
dst.w = textlen;
701+
dst.h = h;
702+
SDL_UpdateWindowSurfaceRects (FD_GetWindow(), &dst, 1); // update the relevant line
703+
}
696704

697705
if (TextBuffer[strlen(TextBuffer)-1] == '\n')
698706
{

‎src/view.c‎

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -228,8 +228,8 @@ Assemble_Combat_Picture (int mask)
228228

229229
if ( mask & DO_SCREEN_UPDATE )
230230
{
231-
FD_UpdateRect (ne_screen, User_Rect.x, User_Rect.y, User_Rect.w, User_Rect.h);
232-
FD_UpdateRect (ne_screen, TxtRect.x, TxtRect.y, TxtRect.w, TxtRect.h);
231+
SDL_UpdateWindowSurfaceRects (FD_GetWindow(), &User_Rect, 1);
232+
SDL_UpdateWindowSurfaceRects (FD_GetWindow(), &TxtRect, 1);
233233
}
234234

235235
SDL_SetClipRect (ne_screen, NULL);
@@ -724,7 +724,14 @@ DisplayBanner (const char* left, const char* right, int flags )
724724

725725
// finally update the whole top status box
726726
if ( !(flags & BANNER_NO_SDL_UPDATE ) )
727-
FD_UpdateRect( ne_screen, 0, 0, Banner_Rect.w , Banner_Rect.h );
727+
{
728+
SDL_Rect update_rect;
729+
update_rect.x = 0;
730+
update_rect.y = 0;
731+
update_rect.w = Banner_Rect.w;
732+
update_rect.h = Banner_Rect.h;
733+
SDL_UpdateWindowSurfaceRects (FD_GetWindow(), &update_rect, 1);
734+
}
728735
BannerIsDestroyed=FALSE;
729736
return;
730737
} /* if */

0 commit comments

Comments
 (0)