diff src/video/SDL_video.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 36d52b1f0504
line wrap: on
line diff
--- a/src/video/SDL_video.c	Mon Jul 10 21:23:51 2006 +0000
+++ b/src/video/SDL_video.c	Wed Jul 12 06:39:26 2006 +0000
@@ -1769,9 +1769,8 @@
             return 0;
         }
     }
-    rect = &real_rect;
 
-    return renderer->RenderFill(renderer, rect, color);
+    return renderer->RenderFill(renderer, &real_rect, color);
 }
 
 int
@@ -1793,25 +1792,26 @@
         return -1;
     }
 
-    /* FIXME: implement clipping */
     window = SDL_GetWindowFromID(renderer->window);
-    real_srcrect.x = 0;
-    real_srcrect.y = 0;
-    real_srcrect.w = texture->w;
-    real_srcrect.h = texture->h;
-    real_dstrect.x = 0;
-    real_dstrect.y = 0;
-    real_dstrect.w = window->w;
-    real_dstrect.h = window->h;
-    if (!srcrect) {
-        srcrect = &real_srcrect;
+    if (srcrect) {
+        real_srcrect = *srcrect;
+    } else {
+        real_srcrect.x = 0;
+        real_srcrect.y = 0;
+        real_srcrect.w = texture->w;
+        real_srcrect.h = texture->h;
     }
-    if (!dstrect) {
-        dstrect = &real_dstrect;
+    if (dstrect) {
+        real_dstrect = *dstrect;
+    } else {
+        real_dstrect.x = 0;
+        real_dstrect.y = 0;
+        real_dstrect.w = window->w;
+        real_dstrect.h = window->h;
     }
 
-    return renderer->RenderCopy(renderer, texture, srcrect, dstrect,
-                                blendMode, scaleMode);
+    return renderer->RenderCopy(renderer, texture, &real_srcrect,
+                                &real_dstrect, blendMode, scaleMode);
 }
 
 int
@@ -1882,6 +1882,9 @@
         return;
     }
 
+    if (renderer->SelectRenderTexture) {
+        renderer->SelectRenderTexture(renderer, NULL);
+    }
     renderer->RenderPresent(renderer);
 }