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.
authorSam Lantinga <slouken@libsdl.org>
Sun, 06 Feb 2011 20:56:21 -0800
changeset 5214 b0797947dd1c
parent 5213 25ad4a50d34f
child 5215 42e0e2f91c55
child 5280 b1b0811a1ccc
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.
Xcode-iPhoneOS/Demos/src/happy.c
src/render/opengles2/SDL_render_gles2.c
--- 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;
 }