diff options
Diffstat (limited to 'nebu/video/png_texture.c')
-rw-r--r-- | nebu/video/png_texture.c | 12 |
1 files changed, 6 insertions, 6 deletions
diff --git a/nebu/video/png_texture.c b/nebu/video/png_texture.c index 0721523..6576307 100644 --- a/nebu/video/png_texture.c +++ b/nebu/video/png_texture.c @@ -28,7 +28,7 @@ png_texture* load_png_texture(char *filename) { png_structp png_ptr; png_infop info_ptr; png_byte **row_pointers; - + f = fopen(filename, "rb"); if(f == NULL) { fprintf(stderr, ERR_PREFIX "can't open file %s\n", filename); @@ -72,11 +72,11 @@ png_texture* load_png_texture(char *filename) { fclose(f); return NULL; } - + switch(color_type) { case PNG_COLOR_TYPE_RGB: zsize = 3; break; case PNG_COLOR_TYPE_RGB_ALPHA: zsize = 4; break; - default: + default: fprintf(stderr, "unknown png color type\n"); return NULL; } @@ -86,11 +86,11 @@ png_texture* load_png_texture(char *filename) { tex->width = x; tex->height = y; tex->channels = zsize; - + /* get pointers */ row_pointers = (png_byte**) malloc(y * sizeof(png_byte*)); for(i = 0; i < y; i++) - row_pointers[i] = tex->data + (y - i - 1) + row_pointers[i] = tex->data + (y - i - 1) * zsize * x; png_read_image(png_ptr, row_pointers); @@ -122,7 +122,7 @@ png_texture* mipmap_png_texture(png_texture *source, int level, mip->channels = source->channels; fx = (source->width > 1) ? 2 : 1; fy = (source->height > 1) ? 2 : 1; - + mip->width = source->width / fx; mip->height = source->height / fy; mip->data = (unsigned char*) malloc(mip->width * mip->height * |