diff src/SDL_compat.c @ 1897:c2a27da60b18

Solved the performance problems by introducing the concept of a single-buffered display, which is a fast path used for the whole-surface SDL 1.2 API. Solved the flicker problems by implementing a backbuffer in the GDI renderer. Unfortunately, now using the GDI renderer with a backbuffer and HBITMAPs is significantly slower than SDL's surface code. *sigh*
author Sam Lantinga <slouken@libsdl.org>
date Wed, 12 Jul 2006 06:39:26 +0000
parents c121d94672cb
children 06c27a737b7a
line wrap: on
line diff
--- a/src/SDL_compat.c	Mon Jul 10 21:23:51 2006 +0000
+++ b/src/SDL_compat.c	Wed Jul 12 06:39:26 2006 +0000
@@ -442,7 +442,8 @@
     }
 
     /* Create a renderer for the window */
-    if (SDL_CreateRenderer(SDL_VideoWindow, -1, 0) < 0) {
+    if (SDL_CreateRenderer(SDL_VideoWindow, -1, SDL_Renderer_SingleBuffer) <
+        0) {
         return NULL;
     }
 
@@ -517,6 +518,7 @@
 
     /* Clear the surface for display */
     SDL_FillRect(SDL_PublicSurface, NULL, 0);
+    SDL_UpdateRect(SDL_PublicSurface, 0, 0, 0, 0);
 
     /* We're finally done! */
     return SDL_PublicSurface;
@@ -617,21 +619,11 @@
     if (screen) {
         SDL_Rect rect;
 
-        /* Perform some checking */
-        if (w == 0)
-            w = screen->w;
-        if (h == 0)
-            h = screen->h;
-        if ((int) (x + w) > screen->w)
-            return;
-        if ((int) (y + h) > screen->h)
-            return;
-
         /* Fill the rectangle */
-        rect.x = (Sint16) x;
-        rect.y = (Sint16) y;
-        rect.w = (Uint16) w;
-        rect.h = (Uint16) h;
+        rect.x = (int) x;
+        rect.y = (int) y;
+        rect.w = (int) (w ? w : screen->w);
+        rect.h = (int) (h ? h : screen->h);
         SDL_UpdateRects(screen, 1, &rect);
     }
 }