Changeset View
Changeset View
Standalone View
Standalone View
source/blender/blenkernel/intern/image.c
| Show All 34 Lines | |||||
| #ifndef WIN32 | #ifndef WIN32 | ||||
| # include <unistd.h> | # include <unistd.h> | ||||
| #else | #else | ||||
| # include <io.h> | # include <io.h> | ||||
| #endif | #endif | ||||
| #include <time.h> | #include <time.h> | ||||
| #include "CLG_log.h" | |||||
| #include "MEM_guardedalloc.h" | #include "MEM_guardedalloc.h" | ||||
| #include "IMB_colormanagement.h" | #include "IMB_colormanagement.h" | ||||
| #include "IMB_imbuf_types.h" | #include "IMB_imbuf_types.h" | ||||
| #include "IMB_imbuf.h" | #include "IMB_imbuf.h" | ||||
| #include "IMB_moviecache.h" | #include "IMB_moviecache.h" | ||||
| #include "IMB_metadata.h" | #include "IMB_metadata.h" | ||||
| ▲ Show 20 Lines • Show All 42 Lines • ▼ Show 20 Lines | |||||
| #include "BLI_sys_types.h" // for intptr_t support | #include "BLI_sys_types.h" // for intptr_t support | ||||
| /* for image user iteration */ | /* for image user iteration */ | ||||
| #include "DNA_node_types.h" | #include "DNA_node_types.h" | ||||
| #include "DNA_space_types.h" | #include "DNA_space_types.h" | ||||
| #include "DNA_screen_types.h" | #include "DNA_screen_types.h" | ||||
| #include "DNA_view3d_types.h" | #include "DNA_view3d_types.h" | ||||
| static CLG_LogRef LOG = {"bke.image"}; | |||||
| static SpinLock image_spin; | static SpinLock image_spin; | ||||
| /* prototypes */ | /* prototypes */ | ||||
| static int image_num_files(struct Image *ima); | static int image_num_files(struct Image *ima); | ||||
| static ImBuf *image_acquire_ibuf(Image *ima, ImageUser *iuser, void **r_lock); | static ImBuf *image_acquire_ibuf(Image *ima, ImageUser *iuser, void **r_lock); | ||||
| static void image_update_views_format(Image *ima, ImageUser *iuser); | static void image_update_views_format(Image *ima, ImageUser *iuser); | ||||
| static void image_add_view(Image *ima, const char *viewname, const char *filepath); | static void image_add_view(Image *ima, const char *viewname, const char *filepath); | ||||
| ▲ Show 20 Lines • Show All 616 Lines • ▼ Show 20 Lines | for (i = 0, iv = ima->views.first; iv; iv = iv->next, i++) { | ||||
| if (ima->views_format == R_IMF_VIEWS_STEREO_3D) { | if (ima->views_format == R_IMF_VIEWS_STEREO_3D) { | ||||
| const char *suffix[2] = {STEREO_LEFT_SUFFIX, STEREO_RIGHT_SUFFIX}; | const char *suffix[2] = {STEREO_LEFT_SUFFIX, STEREO_RIGHT_SUFFIX}; | ||||
| BLI_path_suffix(iv->filepath, FILE_MAX, suffix[i], ""); | BLI_path_suffix(iv->filepath, FILE_MAX, suffix[i], ""); | ||||
| } | } | ||||
| IMB_saveiff(ibuf, iv->filepath, IB_rect | IB_mem); | IMB_saveiff(ibuf, iv->filepath, IB_rect | IB_mem); | ||||
| if (ibuf->encodedbuffer == NULL) { | if (ibuf->encodedbuffer == NULL) { | ||||
| printf("memory save for pack error\n"); | CLOG_STR_ERROR(&LOG, "memory save for pack error"); | ||||
| IMB_freeImBuf(ibuf); | IMB_freeImBuf(ibuf); | ||||
| image_free_packedfiles(ima); | image_free_packedfiles(ima); | ||||
| return; | return; | ||||
| } | } | ||||
| else { | else { | ||||
| ImagePackedFile *imapf; | ImagePackedFile *imapf; | ||||
| PackedFile *pf = MEM_callocN(sizeof(*pf), "PackedFile"); | PackedFile *pf = MEM_callocN(sizeof(*pf), "PackedFile"); | ||||
| Show All 36 Lines | void BKE_image_memorypack(Image *ima) | ||||
| image_free_packedfiles(ima); | image_free_packedfiles(ima); | ||||
| ibuf->ftype = IMB_FTYPE_PNG; | ibuf->ftype = IMB_FTYPE_PNG; | ||||
| ibuf->planes = R_IMF_PLANES_RGBA; | ibuf->planes = R_IMF_PLANES_RGBA; | ||||
| IMB_saveiff(ibuf, ibuf->name, IB_rect | IB_mem); | IMB_saveiff(ibuf, ibuf->name, IB_rect | IB_mem); | ||||
| if (ibuf->encodedbuffer == NULL) { | if (ibuf->encodedbuffer == NULL) { | ||||
| printf("memory save for pack error\n"); | CLOG_STR_ERROR(&LOG, "memory save for pack error"); | ||||
| } | } | ||||
| else { | else { | ||||
| ImagePackedFile *imapf; | ImagePackedFile *imapf; | ||||
| PackedFile *pf = MEM_callocN(sizeof(*pf), "PackedFile"); | PackedFile *pf = MEM_callocN(sizeof(*pf), "PackedFile"); | ||||
| pf->data = ibuf->encodedbuffer; | pf->data = ibuf->encodedbuffer; | ||||
| pf->size = ibuf->encodedsize; | pf->size = ibuf->encodedsize; | ||||
| ▲ Show 20 Lines • Show All 3,960 Lines • Show Last 20 Lines | |||||