Commit 87ca0acb authored by Sam Lantinga's avatar Sam Lantinga

You don't need to copy the pixels into the streaming texture's pixel data. ...

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.
parent 1c8816f6
......@@ -164,7 +164,7 @@ main(int argc, char *argv[])
} else if (delay > MILLESECONDS_PER_FRAME) {
delay = MILLESECONDS_PER_FRAME;
}
//SDL_Delay(delay);
SDL_Delay(delay);
}
/* cleanup */
......
......@@ -389,35 +389,13 @@ GLES2_UpdateTexture(SDL_Renderer *renderer, SDL_Texture *texture, const SDL_Rect
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;
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment