diff options
Diffstat (limited to 'source/blender/imbuf/intern/png.c')
-rw-r--r-- | source/blender/imbuf/intern/png.c | 34 |
1 files changed, 17 insertions, 17 deletions
diff --git a/source/blender/imbuf/intern/png.c b/source/blender/imbuf/intern/png.c index 2aed1485700..928eb219ea5 100644 --- a/source/blender/imbuf/intern/png.c +++ b/source/blender/imbuf/intern/png.c @@ -73,7 +73,7 @@ static void WriteData(png_structp png_ptr, png_bytep data, png_size_t length) { ImBuf *ibuf = (ImBuf *) png_get_io_ptr(png_ptr); - // if buffer is to small increase it. + /* if buffer is to small increase it. */ while (ibuf->encodedsize + length > ibuf->encodedbuffersize) { imb_enlargeencodedbufferImBuf(ibuf); } @@ -144,7 +144,7 @@ int imb_savepng(struct ImBuf *ibuf, const char *name, int flags) return 0; } - // copy image data + /* copy image data */ pixels = MEM_mallocN(ibuf->x * ibuf->y * bytesperpixel * sizeof(unsigned char), "pixels"); if (pixels == NULL) { @@ -186,7 +186,7 @@ int imb_savepng(struct ImBuf *ibuf, const char *name, int flags) } if (flags & IB_mem) { - // create image in memory + /* create image in memory */ imb_addencodedbufferImBuf(ibuf); ibuf->encodedsize = 0; @@ -218,7 +218,7 @@ int imb_savepng(struct ImBuf *ibuf, const char *name, int flags) png_set_compression_level(png_ptr, compression); - // png image settings + /* png image settings */ png_set_IHDR(png_ptr, info_ptr, ibuf->x, @@ -261,10 +261,10 @@ int imb_savepng(struct ImBuf *ibuf, const char *name, int flags) png_set_pHYs(png_ptr, info_ptr, (unsigned int)(ibuf->ppm[0] + 0.5), (unsigned int)(ibuf->ppm[1] + 0.5), PNG_RESOLUTION_METER); } - // write the file header information + /* write the file header information */ png_write_info(png_ptr, info_ptr); - // allocate memory for an array of row-pointers + /* allocate memory for an array of row-pointers */ row_pointers = (png_bytepp) MEM_mallocN(ibuf->y * sizeof(png_bytep), "row_pointers"); if (row_pointers == NULL) { printf("imb_savepng: Cannot allocate row-pointers array for file '%s'\n", name); @@ -276,19 +276,19 @@ int imb_savepng(struct ImBuf *ibuf, const char *name, int flags) return 0; } - // set the individual row-pointers to point at the correct offsets + /* set the individual row-pointers to point at the correct offsets */ for (i = 0; i < ibuf->y; i++) { row_pointers[ibuf->y - 1 - i] = (png_bytep) ((unsigned char *)pixels + (i * ibuf->x) * bytesperpixel * sizeof(unsigned char)); } - // write out the entire image data in one call + /* write out the entire image data in one call */ png_write_image(png_ptr, row_pointers); - // write the additional chunks to the PNG file (not really needed) + /* write the additional chunks to the PNG file (not really needed) */ png_write_end(png_ptr, info_ptr); - // clean up + /* clean up */ MEM_freeN(pixels); MEM_freeN(row_pointers); png_destroy_write_struct(&png_ptr, &info_ptr); @@ -419,14 +419,14 @@ ImBuf *imb_loadpng(unsigned char *mem, size_t size, int flags) longjmp(png_jmpbuf(png_ptr), 1); } - // allocate memory for an array of row-pointers + /* allocate memory for an array of row-pointers */ row_pointers = (png_bytepp) MEM_mallocN(ibuf->y * sizeof(png_uint_16p), "row_pointers"); if (row_pointers == NULL) { printf("Cannot allocate row-pointers array\n"); longjmp(png_jmpbuf(png_ptr), 1); } - // set the individual row-pointers to point at the correct offsets + /* set the individual row-pointers to point at the correct offsets */ for (i = 0; i < ibuf->y; i++) { row_pointers[ibuf->y - 1 - i] = (png_bytep) ((png_uint_16 *)pixels16 + (i * ibuf->x) * bytesperpixel); @@ -434,7 +434,7 @@ ImBuf *imb_loadpng(unsigned char *mem, size_t size, int flags) png_read_image(png_ptr, row_pointers); - // copy image data + /* copy image data */ to_float = ibuf->rect_float; from16 = pixels16; @@ -487,14 +487,14 @@ ImBuf *imb_loadpng(unsigned char *mem, size_t size, int flags) longjmp(png_jmpbuf(png_ptr), 1); } - // allocate memory for an array of row-pointers + /* allocate memory for an array of row-pointers */ row_pointers = (png_bytepp) MEM_mallocN(ibuf->y * sizeof(png_bytep), "row_pointers"); if (row_pointers == NULL) { printf("Cannot allocate row-pointers array\n"); longjmp(png_jmpbuf(png_ptr), 1); } - // set the individual row-pointers to point at the correct offsets + /* set the individual row-pointers to point at the correct offsets */ for (i = 0; i < ibuf->y; i++) { row_pointers[ibuf->y - 1 - i] = (png_bytep) ((unsigned char *)pixels + (i * ibuf->x) * bytesperpixel * sizeof(unsigned char)); @@ -502,7 +502,7 @@ ImBuf *imb_loadpng(unsigned char *mem, size_t size, int flags) png_read_image(png_ptr, row_pointers); - // copy image data + /* copy image data */ to = (unsigned char *) ibuf->rect; from = pixels; @@ -555,7 +555,7 @@ ImBuf *imb_loadpng(unsigned char *mem, size_t size, int flags) png_read_end(png_ptr, info_ptr); } - // clean up + /* clean up */ if (pixels) MEM_freeN(pixels); if (pixels16) |