Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSergey Sharybin <sergey.vfx@gmail.com>2013-12-13 14:22:08 +0400
committerSergey Sharybin <sergey.vfx@gmail.com>2013-12-13 14:30:00 +0400
commitce893552c359d11cfa93709f239a3c93f4cdb244 (patch)
treed9474f190006e89547044c241081f320c44c3a36 /source/blender/makesrna/intern/rna_image.c
parent7eab49f8d923ed3992dff1236e30a62f2d70f460 (diff)
Image cache rewrite to using generic movie cache
Summary: Behaves very much the same as cache for Movie Clip datablock: - Image now have `MovieCache *cache` field which replaced legacy `ListBase ibufs`. This allows image datablock to easily keep of image buffers which are owned by itself. This field isn't saved to the file and getting restored on undo steps. However, cache limit is global for movies, sequences and image datablocks now. So overall cached image buffers size will not go above cache limit size in user preferences. - Image buffers which are marked as BITMAPDIRTY will never be freed from the cache. - Added utility function to iterate over image buffers saved in movie cache. - Movie cache cleanup check callback now have ImBuf argument which can be used in a condition of cleanup. - Added some utility functions which replaces legacy ibufs iterations with image cache iteration which happens from inside a lock. - Fixed `image_mem_size()` which was only counting one of the buffers if both float and byte buffer present. Additional notes: - `BKE_image_get_first_ibuf()` is rather stupid, but direct access to ibufs->first was also the same stupid idea. Would consider avoid this function is another project. - There are some places which doesn't look threadsafe, but they already were not so much threadsafe anyway before. So think not a big deal with solving this later. Finally solves infinite memory usage by image sequences! :) Reviewers: brecht, campbellbarton Reviewed By: brecht CC: sebastian_k Differential Revision: http://developer.blender.org/D95
Diffstat (limited to 'source/blender/makesrna/intern/rna_image.c')
-rw-r--r--source/blender/makesrna/intern/rna_image.c30
1 files changed, 4 insertions, 26 deletions
diff --git a/source/blender/makesrna/intern/rna_image.c b/source/blender/makesrna/intern/rna_image.c
index c901abc834e..69b2d2d0227 100644
--- a/source/blender/makesrna/intern/rna_image.c
+++ b/source/blender/makesrna/intern/rna_image.c
@@ -79,14 +79,7 @@ static void rna_Image_animated_update(Main *UNUSED(bmain), Scene *UNUSED(scene),
static int rna_Image_dirty_get(PointerRNA *ptr)
{
- Image *ima = (Image *)ptr->data;
- ImBuf *ibuf;
-
- for (ibuf = ima->ibufs.first; ibuf; ibuf = ibuf->next)
- if (ibuf->userflags & IB_BITMAPDIRTY)
- return 1;
-
- return 0;
+ return BKE_image_is_dirty((Image *)ptr->data);
}
static void rna_Image_source_set(PointerRNA *ptr, int value)
@@ -210,31 +203,16 @@ static void rna_Image_file_format_set(PointerRNA *ptr, int value)
{
Image *image = (Image *)ptr->data;
if (BKE_imtype_is_movie(value) == 0) { /* should be able to throw an error here */
- ImBuf *ibuf;
int ftype = BKE_imtype_to_ftype(value);
-
-#if 0
- ibuf = BKE_image_acquire_ibuf(image, NULL, NULL);
- if (ibuf)
- ibuf->ftype = ftype;
-#endif
-
- /* to be safe change all buffer file types */
- /* TODO: this is never threadsafe */
- for (ibuf = image->ibufs.first; ibuf; ibuf = ibuf->next) {
- ibuf->ftype = ftype;
- }
+ BKE_image_file_format_set(image, ftype);
}
}
static int rna_Image_has_data_get(PointerRNA *ptr)
{
- Image *im = (Image *)ptr->data;
-
- if (im->ibufs.first)
- return 1;
+ Image *image = (Image *)ptr->data;
- return 0;
+ return BKE_image_has_loaded_ibuf(image);
}
static void rna_Image_size_get(PointerRNA *ptr, int *values)