Zero streaming textures at the driver level
authorSam Lantinga <slouken@libsdl.org>
Sat, 26 Feb 2011 21:39:34 -0800
changeset 5402 5d102cd8aef3
parent 5401 ccaccc76a196
child 5403 424f036f7c68
Zero streaming textures at the driver level
src/render/opengl/SDL_render_gl.c
src/render/opengles/SDL_render_gles.c
src/render/opengles2/SDL_render_gles2.c
--- a/src/render/opengl/SDL_render_gl.c	Sat Feb 26 11:59:33 2011 -0800
+++ b/src/render/opengl/SDL_render_gl.c	Sat Feb 26 21:39:34 2011 -0800
@@ -427,7 +427,7 @@
             /* Need to add size for the U and V planes */
             size += (2 * (texture->h * data->pitch) / 4);
         }
-        data->pixels = SDL_malloc(size);
+        data->pixels = SDL_calloc(1, size);
         if (!data->pixels) {
             SDL_OutOfMemory();
             SDL_free(data);
--- a/src/render/opengles/SDL_render_gles.c	Sat Feb 26 11:59:33 2011 -0800
+++ b/src/render/opengles/SDL_render_gles.c	Sat Feb 26 21:39:34 2011 -0800
@@ -322,7 +322,7 @@
 
     if (texture->access == SDL_TEXTUREACCESS_STREAMING) {
         data->pitch = texture->w * SDL_BYTESPERPIXEL(texture->format);
-        data->pixels = SDL_malloc(texture->h * data->pitch);
+        data->pixels = SDL_calloc(1, texture->h * data->pitch);
         if (!data->pixels) {
             SDL_OutOfMemory();
             SDL_free(data);
--- a/src/render/opengles2/SDL_render_gles2.c	Sat Feb 26 11:59:33 2011 -0800
+++ b/src/render/opengles2/SDL_render_gles2.c	Sat Feb 26 21:39:34 2011 -0800
@@ -272,7 +272,7 @@
     if (texture->access == SDL_TEXTUREACCESS_STREAMING)
     {
         tdata->pitch = texture->w * SDL_BYTESPERPIXEL(texture->format);
-        tdata->pixel_data = SDL_malloc(tdata->pitch * texture->h);
+        tdata->pixel_data = SDL_calloc(1, tdata->pitch * texture->h);
         if (!tdata->pixel_data)
         {
             SDL_OutOfMemory();