diff src/render/opengles2/SDL_render_gles2.c @ 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 c66b2a778b7e
line wrap: on
line diff
--- 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;
 }