[uae] Re: SDL speedup

  • From: blynel@xxxxxxxxxx
  • To: uae@xxxxxxxxxxxxx
  • Date: Fri, 12 Nov 2004 23:16:18 +0100

Some lines got wrapped :(

I have attached the patch in stead.

Jesper
--- sdlgfx.c    2004-10-26 07:42:20.000000000 +0200
+++ sdlgfx.c.new        2004-11-12 20:35:56.504922840 +0100
@@ -131,22 +131,40 @@
     /* Not implemented for SDL output */
 }
 
+static int pending_flush = 0;
+static int ystart_p, ystop_p;
+
 void flush_block (int ystart, int ystop)
 {
     DEBUG_LOG ("Function: flush_block %d %d\n", ystart, ystop);
 
-    SDL_UnlockSurface (prSDLScreen);
-    SDL_UpdateRect (prSDLScreen, 0, ystart, current_width, ystop - ystart + 1);
-    SDL_LockSurface (prSDLScreen);
+    if (pending_flush) {
+        if (ystart <= ystop_p + 2) {
+           /* merge with pending flush */
+           ystop_p = ystop;
+        } else {
+           /* do previous pending flush and make this flush pending */
+           SDL_UpdateRect (prSDLScreen, 0, ystart_p, current_width, ystop_p - 
ystart_p + 1);
+           ystart_p = ystart;
+           ystop_p = ystop;
+        }
+    } else {
+        /* make this flush pending */
+        ystart_p = ystart;
+        ystop_p = ystop;
+        pending_flush = 1;
+    }
 }
 
 void flush_screen (int ystart, int ystop)
 {
     DEBUG_LOG ("Function: flush_screen\n");
 
-#if 0
-    SDL_UpdateRect(prSDLScreen, 0, 0, current_width, current_height);
-#endif
+    if (prSDLScreen) {
+        SDL_Rect rect = { 0, 0, prSDLScreen->w, prSDLScreen->h };
+        SDL_FillRect (prSDLScreen, &rect, SDL_MapRGB (prSDLScreen->format, 
0,0,0));
+        SDL_UpdateRect (prSDLScreen, 0, 0, rect.w, rect.h);
+    }
 }
 
 void flush_clear_screen (void)

Other related posts: