diff options
author | Ton Roosendaal <ton@blender.org> | 2009-01-27 22:32:44 +0300 |
---|---|---|
committer | Ton Roosendaal <ton@blender.org> | 2009-01-27 22:32:44 +0300 |
commit | 764168d62a22659ac9947835a3308f7bc66fc1d5 (patch) | |
tree | 4a65fa9c4a2070d95092acc73658a4e131d7549c /source/blender/blenkernel/intern/image.c | |
parent | 92b0cbd6da1809efaaa28fe9e7271464631e8275 (diff) |
2.5
Added support in threaded compositor to copy the viewer
image safely away, prevents crashing especially for
people using blender -E or redrawing viewer while it
composites.
(Note; reloading images in nodes, render result, and
probably other cases have to be checked still)
Diffstat (limited to 'source/blender/blenkernel/intern/image.c')
-rw-r--r-- | source/blender/blenkernel/intern/image.c | 28 |
1 files changed, 28 insertions, 0 deletions
diff --git a/source/blender/blenkernel/intern/image.c b/source/blender/blenkernel/intern/image.c index 1b851444e04..ee631a89083 100644 --- a/source/blender/blenkernel/intern/image.c +++ b/source/blender/blenkernel/intern/image.c @@ -91,6 +91,7 @@ /* quick lookup: supports 1 million frames, thousand passes */ #define IMA_MAKE_INDEX(frame, index) ((frame)<<10)+index #define IMA_INDEX_FRAME(index) (index>>10) +#define IMA_INDEX_PASS(index) (index & ~1023) /* ******** IMAGE PROCESSING ************* */ @@ -332,6 +333,33 @@ static void image_assign_ibuf(Image *ima, ImBuf *ibuf, int index, int frame) } } +/* empty image block, of similar type and filename */ +Image *BKE_image_copy(Image *ima) +{ + Image *new= image_alloc(ima->id.name+2, ima->source, ima->type); + + BLI_strncpy(new->name, ima->name, sizeof(ima->name)); + + new->gen_x= ima->gen_x; + new->gen_y= ima->gen_y; + new->gen_type= ima->gen_type; + + return new; +} + +void BKE_image_merge(Image *dest, Image *source) +{ + ImBuf *ibuf; + + while((ibuf= source->ibufs.first)) { + BLI_remlink(&source->ibufs, ibuf); + image_assign_ibuf(dest, ibuf, IMA_INDEX_PASS(ibuf->index), IMA_INDEX_FRAME(ibuf->index)); + } + + free_libblock(&G.main->image, source); +} + + /* checks if image was already loaded, then returns same image */ /* otherwise creates new. */ /* does not load ibuf itself */ |