Mercurial > hg > dmlib
comparison src/libgfx.c @ 929:e1378398be0f
Add size field for allocated data size in DMImage.
author | Matti Hamalainen <ccr@tnsp.org> |
---|---|
date | Wed, 25 Feb 2015 19:25:51 +0200 |
parents | ebe0d93e03c0 |
children | efbad8817b79 |
comparison
equal
deleted
inserted
replaced
928:ebe0d93e03c0 | 929:e1378398be0f |
---|---|
32 if (img == NULL) | 32 if (img == NULL) |
33 return NULL; | 33 return NULL; |
34 | 34 |
35 img->width = img->pitch = width; | 35 img->width = img->pitch = width; |
36 img->height = height; | 36 img->height = height; |
37 img->data = dmMalloc(width * height * sizeof(Uint8)); | 37 img->size = width * height * sizeof(Uint8); |
38 if (img->data == NULL) | 38 if ((img->data = dmMalloc(img->size)) == NULL) |
39 { | 39 { |
40 dmFree(img); | 40 dmFree(img); |
41 return NULL; | 41 return NULL; |
42 } | 42 } |
43 | 43 |