Changeset View
Changeset View
Standalone View
Standalone View
source/blender/imbuf/intern/png.c
| Show First 20 Lines • Show All 113 Lines • ▼ Show 20 Lines | |||||
| } | } | ||||
| /* wrap to avoid macro calling functions multiple times */ | /* wrap to avoid macro calling functions multiple times */ | ||||
| BLI_INLINE unsigned short ftoshort(float val) | BLI_INLINE unsigned short ftoshort(float val) | ||||
| { | { | ||||
| return unit_float_to_ushort_clamp(val); | return unit_float_to_ushort_clamp(val); | ||||
| } | } | ||||
| int imb_savepng(struct ImBuf *ibuf, const char *name, int flags) | int imb_savepng(struct ImBuf *ibuf, const char *name, eImBufFlags flags) | ||||
| { | { | ||||
| png_structp png_ptr; | png_structp png_ptr; | ||||
| png_infop info_ptr; | png_infop info_ptr; | ||||
| unsigned char *pixels = NULL; | unsigned char *pixels = NULL; | ||||
| unsigned char *from, *to; | unsigned char *from, *to; | ||||
| unsigned short *pixels16 = NULL, *to16; | unsigned short *pixels16 = NULL, *to16; | ||||
| float *from_float, from_straight[4]; | float *from_float, from_straight[4]; | ||||
| ▲ Show 20 Lines • Show All 394 Lines • ▼ Show 20 Lines | static void imb_png_warning(png_structp UNUSED(png_ptr), png_const_charp message) | ||||
| fprintf(stderr, "libpng warning: %s\n", message); | fprintf(stderr, "libpng warning: %s\n", message); | ||||
| } | } | ||||
| static void imb_png_error(png_structp UNUSED(png_ptr), png_const_charp message) | static void imb_png_error(png_structp UNUSED(png_ptr), png_const_charp message) | ||||
| { | { | ||||
| fprintf(stderr, "libpng error: %s\n", message); | fprintf(stderr, "libpng error: %s\n", message); | ||||
| } | } | ||||
| ImBuf *imb_loadpng(const unsigned char *mem, size_t size, int flags, char colorspace[IM_MAX_SPACE]) | ImBuf *imb_loadpng(const unsigned char *mem, | ||||
| size_t size, | |||||
| eImBufFlags flags, | |||||
| char colorspace[IM_MAX_SPACE]) | |||||
| { | { | ||||
| struct ImBuf *ibuf = NULL; | struct ImBuf *ibuf = NULL; | ||||
| png_structp png_ptr; | png_structp png_ptr; | ||||
| png_infop info_ptr; | png_infop info_ptr; | ||||
| unsigned char *pixels = NULL; | unsigned char *pixels = NULL; | ||||
| unsigned short *pixels16 = NULL; | unsigned short *pixels16 = NULL; | ||||
| png_bytepp row_pointers = NULL; | png_bytepp row_pointers = NULL; | ||||
| png_uint_32 width, height; | png_uint_32 width, height; | ||||
| ▲ Show 20 Lines • Show All 280 Lines • Show Last 20 Lines | |||||