Changeset View
Changeset View
Standalone View
Standalone View
source/blender/imbuf/intern/jpeg.c
| Show First 20 Lines • Show All 416 Lines • ▼ Show 20 Lines | if (jpeg_read_header(cinfo, false) == JPEG_HEADER_OK) { | ||||
| } | } | ||||
| } | } | ||||
| return (ibuf); | return (ibuf); | ||||
| } | } | ||||
| ImBuf *imb_load_jpeg(const unsigned char *buffer, | ImBuf *imb_load_jpeg(const unsigned char *buffer, | ||||
| size_t size, | size_t size, | ||||
| int flags, | eImBufFlags flags, | ||||
| char colorspace[IM_MAX_SPACE]) | char colorspace[IM_MAX_SPACE]) | ||||
| { | { | ||||
| struct jpeg_decompress_struct _cinfo, *cinfo = &_cinfo; | struct jpeg_decompress_struct _cinfo, *cinfo = &_cinfo; | ||||
| struct my_error_mgr jerr; | struct my_error_mgr jerr; | ||||
| ImBuf *ibuf; | ImBuf *ibuf; | ||||
| if (!imb_is_a_jpeg(buffer)) { | if (!imb_is_a_jpeg(buffer)) { | ||||
| return NULL; | return NULL; | ||||
| ▲ Show 20 Lines • Show All 203 Lines • ▼ Show 20 Lines | static int save_stdjpeg(const char *name, struct ImBuf *ibuf) | ||||
| write_jpeg(cinfo, ibuf); | write_jpeg(cinfo, ibuf); | ||||
| fclose(outfile); | fclose(outfile); | ||||
| jpeg_destroy_compress(cinfo); | jpeg_destroy_compress(cinfo); | ||||
| return 1; | return 1; | ||||
| } | } | ||||
| int imb_savejpeg(struct ImBuf *ibuf, const char *name, int flags) | int imb_savejpeg(struct ImBuf *ibuf, const char *name, eImBufFlags flags) | ||||
| { | { | ||||
| ibuf->flags = flags; | ibuf->flags = flags; | ||||
| return save_stdjpeg(name, ibuf); | return save_stdjpeg(name, ibuf); | ||||
| } | } | ||||