mirror of
https://github.com/Interlisp/maiko.git
synced 2026-01-14 15:36:34 +00:00
Only update texture on damage.
This commit is contained in:
parent
6f0ca7ad1c
commit
380416fa2d
@ -80,6 +80,10 @@ extern DLword *ColorDisplayRegion68k;
|
||||
extern int MonoOrColor;
|
||||
#endif /* COLOR */
|
||||
|
||||
#ifdef SDL
|
||||
extern void sdl_notify_damage(int, int, int, int);
|
||||
#endif /* SDL */
|
||||
|
||||
#ifdef XWINDOW
|
||||
DLword *DisplayRegion68k_end_addr;
|
||||
extern int *Xdisplay; /* DAANGER -jarl nilsson 27-apr-92 */
|
||||
@ -264,7 +268,7 @@ in_display_segment(baseaddr)
|
||||
<<<<<<< HEAD
|
||||
void flush_display_buffer(void) {
|
||||
#ifdef SDL
|
||||
// sdl_bitblt_to_screen(0, 0, sdl_displaywidth, sdl_displayheight);
|
||||
sdl_notify_damage(0, 0, sdl_displaywidth, sdl_displayheight);
|
||||
#endif
|
||||
#ifdef XWINDOW
|
||||
(currentdsp->bitblt_to_screen)(currentdsp, DisplayRegion68k, currentdsp->Visible.x,
|
||||
@ -295,7 +299,7 @@ void flush_display_region(int x, int y, int w, int h)
|
||||
{
|
||||
// printf("flush_display_region %d %d %d %d\n", x, y, w, h);
|
||||
#ifdef SDL
|
||||
// sdl_bitblt_to_screen(x, y, w, h);
|
||||
sdl_notify_damage(x, y, w, h);
|
||||
#endif
|
||||
#if (defined(XWINDOW) || defined(DOS))
|
||||
TPRINT(("Enter flush_display_region x=%d, y=%d, w=%d, h=%d\n", x, y, w, h));
|
||||
@ -341,7 +345,7 @@ void flush_display_lineregion(UNSIGNED x, DLword *ybase, int w, int h)
|
||||
y = ((DLword *)ybase - DisplayRegion68k) / DLWORD_PERLINE;
|
||||
// printf("flush_display_lineregion %d %d %d %d\n", x, y, w, h);
|
||||
#ifdef SDL
|
||||
// sdl_bitblt_to_screen(x, y, w, h);
|
||||
sdl_notify_damage(x, y, w, h);
|
||||
#endif
|
||||
#if (defined(XWINDOW) || defined(DOS))
|
||||
TPRINT(("Enter flush_display_lineregion x=%p, y=%d, w=%d, h=%d\n", (void *)x, y, w, h));
|
||||
@ -375,7 +379,7 @@ void flush_display_ptrregion(DLword *ybase, UNSIGNED bitoffset, int w, int h)
|
||||
x = bitoffset + (BITSPERWORD * (baseoffset - (DLWORD_PERLINE * y)));
|
||||
// printf("flush_display_ptrregion %d %d %d %d\n", x, y, w, h);
|
||||
#ifdef SDL
|
||||
// sdl_bitblt_to_screen(x, y, w, h);
|
||||
sdl_notify_damage(x, y, w, h);
|
||||
#endif
|
||||
#if (defined(XWINDOW) || defined(DOS))
|
||||
TPRINT(("Enter flush_display_ptrregion\n x=%d, y=%d, w=%d, h=%d\n", x, y, w, h));
|
||||
|
||||
30
src/sdl.c
30
src/sdl.c
@ -207,8 +207,12 @@ void set_pixel(SDL_Surface *surface, int x, int y, Uint32 pixel)
|
||||
}
|
||||
int should_update_texture = 0;
|
||||
|
||||
void sdl_notify_damage(int x, int y, int w, int h) {
|
||||
should_update_texture = 1;
|
||||
}
|
||||
|
||||
void sdl_bitblt_to_screen(int _x, int _y, int _w, int _h) {
|
||||
// printf("bitblting\n");
|
||||
//printf("bitblting\n");
|
||||
int before = SDL_GetTicks();
|
||||
int width = sdl_displaywidth;
|
||||
int height = sdl_displayheight;
|
||||
@ -234,7 +238,7 @@ void sdl_bitblt_to_screen(int _x, int _y, int _w, int _h) {
|
||||
}
|
||||
}
|
||||
}
|
||||
should_update_texture = 1;
|
||||
//should_update_texture = 1;
|
||||
int after = SDL_GetTicks();
|
||||
// printf("bitblting took %dms\n", after - before);
|
||||
/* before = SDL_GetTicks(); */
|
||||
@ -414,27 +418,25 @@ void process_SDLevents() {
|
||||
}
|
||||
}
|
||||
// handle_keyboard();
|
||||
/* sdl_bitblt_to_screen(); */
|
||||
// SDL_UpdateTexture(sdl_texture, NULL, buffer, sdl_displaywidth * sizeof(Uint32));
|
||||
int before = 0;
|
||||
int after = 0;
|
||||
/* if(should_update_texture) { */
|
||||
/* before = SDL_GetTicks(); */
|
||||
/* SDL_UpdateTexture(sdl_texture, NULL, buffer, sdl_displaywidth * sizeof(Uint32)); */
|
||||
/* after = SDL_GetTicks(); */
|
||||
/* should_update_texture = 0; */
|
||||
/* } */
|
||||
// printf("UpdateTexture took %dms\n", after - before);
|
||||
if(should_update_texture) {
|
||||
before = SDL_GetTicks();
|
||||
sdl_bitblt_to_screen(0, 0, sdl_displaywidth, sdl_displayheight);
|
||||
SDL_UpdateTexture(sdl_texture, NULL, buffer, sdl_displaywidth * sizeof(Uint32));
|
||||
after = SDL_GetTicks();
|
||||
// printf("UpdateTexture took %dms\n", after - before);
|
||||
should_update_texture = 0;
|
||||
}
|
||||
int this_draw = SDL_GetTicks();
|
||||
before = SDL_GetTicks();
|
||||
// printf("processing events took %dms\n", before - process_events_time);
|
||||
if(this_draw - last_draw > 16) {
|
||||
before = SDL_GetTicks();
|
||||
SDL_UpdateTexture(sdl_texture, NULL, buffer, sdl_displaywidth * sizeof(Uint32));
|
||||
/* SDL_UpdateTexture(sdl_texture, NULL, buffer, sdl_displaywidth * sizeof(Uint32)); */
|
||||
after = SDL_GetTicks();
|
||||
should_update_texture = 0;
|
||||
// should_update_texture = 0;
|
||||
|
||||
sdl_bitblt_to_screen(0, 0, sdl_displaywidth, sdl_displayheight);
|
||||
SDL_RenderClear(sdl_renderer);
|
||||
SDL_Rect r;
|
||||
r.x = 0;
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user