Changeset View
Changeset View
Standalone View
Standalone View
source/blender/blenkernel/intern/image.c
| Show First 20 Lines • Show All 464 Lines • ▼ Show 20 Lines | |||||
| { | { | ||||
| ImBuf *ibuf; | ImBuf *ibuf; | ||||
| void *lock; | void *lock; | ||||
| ibuf = BKE_image_acquire_ibuf(image, NULL, &lock); | ibuf = BKE_image_acquire_ibuf(image, NULL, &lock); | ||||
| if (ibuf) { | if (ibuf) { | ||||
| IMB_scaleImBuf(ibuf, width, height); | IMB_scaleImBuf(ibuf, width, height); | ||||
| ibuf->userflags |= IB_BITMAPDIRTY; | BKE_image_mark_dirty(image, ibuf); | ||||
| } | } | ||||
| BKE_image_release_ibuf(image, ibuf, lock); | BKE_image_release_ibuf(image, ibuf, lock); | ||||
| return (ibuf != NULL); | return (ibuf != NULL); | ||||
| } | } | ||||
| bool BKE_image_has_opengl_texture(Image *ima) | bool BKE_image_has_opengl_texture(Image *ima) | ||||
| ▲ Show 20 Lines • Show All 159 Lines • ▼ Show 20 Lines | else { | ||||
| } | } | ||||
| } | } | ||||
| if (!ibuf) { | if (!ibuf) { | ||||
| return NULL; | return NULL; | ||||
| } | } | ||||
| STRNCPY(ibuf->name, name); | STRNCPY(ibuf->name, name); | ||||
| ibuf->userflags |= IB_BITMAPDIRTY; | |||||
| switch (gen_type) { | switch (gen_type) { | ||||
| case IMA_GENTYPE_GRID: | case IMA_GENTYPE_GRID: | ||||
| BKE_image_buf_fill_checker(rect, rect_float, width, height); | BKE_image_buf_fill_checker(rect, rect_float, width, height); | ||||
| break; | break; | ||||
| case IMA_GENTYPE_GRID_COLOR: | case IMA_GENTYPE_GRID_COLOR: | ||||
| BKE_image_buf_fill_checker_color(rect, rect_float, width, height); | BKE_image_buf_fill_checker_color(rect, rect_float, width, height); | ||||
| break; | break; | ||||
| ▲ Show 20 Lines • Show All 4,448 Lines • ▼ Show 20 Lines | if (image->cache != NULL) { | ||||
| } | } | ||||
| IMB_moviecacheIter_free(iter); | IMB_moviecacheIter_free(iter); | ||||
| } | } | ||||
| BLI_spin_unlock(&image_spin); | BLI_spin_unlock(&image_spin); | ||||
| return is_dirty; | return is_dirty; | ||||
| } | } | ||||
| void BKE_image_mark_dirty(Image *UNUSED(image), ImBuf *ibuf) | void BKE_image_mark_dirty(Image *image, ImBuf *ibuf) | ||||
| { | { | ||||
| if (image->source == IMA_SRC_GENERATED) { | |||||
| /* Convert generated images to packed file so we preserve the | |||||
| * modifications on file save. */ | |||||
| if (!BKE_image_has_packedfile(image)) { | |||||
| BKE_image_memorypack(image); | |||||
| } | |||||
| } | |||||
| ibuf->userflags |= IB_BITMAPDIRTY; | ibuf->userflags |= IB_BITMAPDIRTY; | ||||
| } | } | ||||
| void BKE_image_packed_update(Image *image) | |||||
| { | |||||
| if (BKE_image_is_dirty(image) && BKE_image_has_packedfile(image)) { | |||||
| BKE_image_memorypack(image); | |||||
| } | |||||
| } | |||||
| void BKE_image_file_format_set(Image *image, int ftype, const ImbFormatOptions *options) | void BKE_image_file_format_set(Image *image, int ftype, const ImbFormatOptions *options) | ||||
| { | { | ||||
| BLI_spin_lock(&image_spin); | BLI_spin_lock(&image_spin); | ||||
| if (image->cache != NULL) { | if (image->cache != NULL) { | ||||
| struct MovieCacheIter *iter = IMB_moviecacheIter_new(image->cache); | struct MovieCacheIter *iter = IMB_moviecacheIter_new(image->cache); | ||||
| while (!IMB_moviecacheIter_done(iter)) { | while (!IMB_moviecacheIter_done(iter)) { | ||||
| ImBuf *ibuf = IMB_moviecacheIter_getImBuf(iter); | ImBuf *ibuf = IMB_moviecacheIter_getImBuf(iter); | ||||
| ▲ Show 20 Lines • Show All 269 Lines • Show Last 20 Lines | |||||