Skip to content
This repository has been archived by the owner on Feb 11, 2021. It is now read-only.

Commit

Permalink
Zero streaming textures at the driver level
Browse files Browse the repository at this point in the history
  • Loading branch information
slouken committed Feb 27, 2011
1 parent 4b08854 commit 1ffc529
Show file tree
Hide file tree
Showing 3 changed files with 3 additions and 3 deletions.
2 changes: 1 addition & 1 deletion src/render/opengl/SDL_render_gl.c
Expand Up @@ -427,7 +427,7 @@ GL_CreateTexture(SDL_Renderer * renderer, SDL_Texture * texture)
/* 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);
Expand Down
2 changes: 1 addition & 1 deletion src/render/opengles/SDL_render_gles.c
Expand Up @@ -322,7 +322,7 @@ GLES_CreateTexture(SDL_Renderer * renderer, SDL_Texture * texture)

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);
Expand Down
2 changes: 1 addition & 1 deletion src/render/opengles2/SDL_render_gles2.c
Expand Up @@ -272,7 +272,7 @@ GLES2_CreateTexture(SDL_Renderer *renderer, SDL_Texture *texture)
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();
Expand Down

0 comments on commit 1ffc529

Please sign in to comment.