changeset 5217:b0797947dd1c

You don't need to copy the pixels into the streaming texture's pixel data. This behavior is defined specifically to optimize the UpdateTexture path.
author Sam Lantinga <slouken@libsdl.org>
date Sun, 06 Feb 2011 20:56:21 -0800
parents 25ad4a50d34f
children b1b0811a1ccc 42e0e2f91c55
files Xcode-iPhoneOS/Demos/src/happy.c src/render/opengles2/SDL_render_gles2.c
diffstat 2 files changed, 3 insertions(+), 25 deletions(-) [+]
line wrap: on
line diff
--- a/Xcode-iPhoneOS/Demos/src/happy.c	Sun Feb 06 19:12:55 2011 -0800
+++ b/Xcode-iPhoneOS/Demos/src/happy.c	Sun Feb 06 20:56:21 2011 -0800
@@ -164,7 +164,7 @@
         } else if (delay > MILLESECONDS_PER_FRAME) {
             delay = MILLESECONDS_PER_FRAME;
         }
-        //SDL_Delay(delay);
+        SDL_Delay(delay);
     }
 
     /* cleanup */
--- a/src/render/opengles2/SDL_render_gles2.c	Sun Feb 06 19:12:55 2011 -0800
+++ b/src/render/opengles2/SDL_render_gles2.c	Sun Feb 06 20:56:21 2011 -0800
@@ -389,35 +389,13 @@
                     tdata->pixel_format,
                     tdata->pixel_type,
                     src);
+    SDL_free(blob);
+
     if (glGetError() != GL_NO_ERROR)
     {
         SDL_SetError("Failed to update texture");
         return -1;
     }
-
-    /* Update the (streaming) texture buffer, in one pass if possible */
-    if (tdata->pixel_data)
-    {
-        dest = (Uint8 *)tdata->pixel_data +
-               (tdata->pitch * rect->y) +
-               (SDL_BYTESPERPIXEL(texture->format) * rect->x);
-        if (rect->w == texture->w)
-        {
-            SDL_memcpy(dest, src, srcPitch * rect->h);
-        }
-        else
-        {
-            for (y = 0; y < rect->h; ++y)
-            {
-                SDL_memcpy(dest, src, srcPitch);
-                src += srcPitch;
-                dest += tdata->pitch;
-            }
-        }
-    }
-
-    /* Clean up and return */
-    SDL_free(blob);
     return 0;
 }