diff options
author | Peter Schlaile <peter@schlaile.de> | 2011-04-17 14:05:27 +0400 |
---|---|---|
committer | Peter Schlaile <peter@schlaile.de> | 2011-04-17 14:05:27 +0400 |
commit | 163dbded30efc0eea40086cd5f9b8bafdad90790 (patch) | |
tree | 599bddc53c3e0df583dedeb539181b591886dcf9 /source/blender | |
parent | 69f9104ea79e629119821ad6526c8e4293ac1f66 (diff) |
== Sequencer ==
Fixes Fix for [#25713] VSE shows and renders wrong straight alpha gradient even after convert to pr
(see revision: 34540, fix by Janne)
By not breaking the seqcache interface API.
Added comments to header file, so that it is easier to understand, how the
cache API is supposed to work.
Diffstat (limited to 'source/blender')
-rw-r--r-- | source/blender/blenkernel/BKE_sequencer.h | 7 | ||||
-rw-r--r-- | source/blender/blenkernel/intern/seqcache.c | 4 | ||||
-rw-r--r-- | source/blender/blenkernel/intern/sequencer.c | 27 |
3 files changed, 26 insertions, 12 deletions
diff --git a/source/blender/blenkernel/BKE_sequencer.h b/source/blender/blenkernel/BKE_sequencer.h index 33bff1cd6a7..42786e1c9be 100644 --- a/source/blender/blenkernel/BKE_sequencer.h +++ b/source/blender/blenkernel/BKE_sequencer.h @@ -217,9 +217,16 @@ void seq_stripelem_cache_destruct(void); void seq_stripelem_cache_cleanup(void); +/* returned ImBuf is properly refed and has to be freed */ struct ImBuf * seq_stripelem_cache_get( SeqRenderData context, struct Sequence * seq, float cfra, seq_stripelem_ibuf_t type); + +/* passed ImBuf is properly refed, so ownership is *not* + transfered to the cache. + you can pass the same ImBuf multiple times to the cache without problems. +*/ + void seq_stripelem_cache_put( SeqRenderData context, struct Sequence * seq, float cfra, seq_stripelem_ibuf_t type, struct ImBuf * nval); diff --git a/source/blender/blenkernel/intern/seqcache.c b/source/blender/blenkernel/intern/seqcache.c index e698402c538..00f88fb6202 100644 --- a/source/blender/blenkernel/intern/seqcache.c +++ b/source/blender/blenkernel/intern/seqcache.c @@ -237,9 +237,7 @@ void seq_stripelem_cache_put( key->cfra = cfra - seq->start; key->type = type; - /* Normally we want our own version, but start and end stills are duplicates of the original. */ - if(ELEM(type, SEQ_STRIPELEM_IBUF_STARTSTILL, SEQ_STRIPELEM_IBUF_ENDSTILL)==0) - IMB_refImBuf(i); + IMB_refImBuf(i); e = (seqCacheEntry*) BLI_mempool_alloc(entrypool); diff --git a/source/blender/blenkernel/intern/sequencer.c b/source/blender/blenkernel/intern/sequencer.c index 7a6eb1adc9f..a765c9ee8f0 100644 --- a/source/blender/blenkernel/intern/sequencer.c +++ b/source/blender/blenkernel/intern/sequencer.c @@ -1720,16 +1720,25 @@ static ImBuf * copy_from_ibuf_still(SeqRenderData context, Sequence * seq, static void copy_to_ibuf_still(SeqRenderData context, Sequence * seq, float nr, ImBuf * ibuf) { - if (nr == 0) { - seq_stripelem_cache_put( - context, seq, seq->start, - SEQ_STRIPELEM_IBUF_STARTSTILL, IMB_dupImBuf(ibuf)); - } + if (nr == 0 || nr == seq->len - 1) { + /* we have to store a copy, since the passed ibuf + could be preprocessed afterwards (thereby silently + changing the cached image... */ + ibuf = IMB_dupImBuf(ibuf); - if (nr == seq->len - 1) { - seq_stripelem_cache_put( - context, seq, seq->start, - SEQ_STRIPELEM_IBUF_ENDSTILL, IMB_dupImBuf(ibuf)); + if (nr == 0) { + seq_stripelem_cache_put( + context, seq, seq->start, + SEQ_STRIPELEM_IBUF_STARTSTILL, ibuf); + } + + if (nr == seq->len - 1) { + seq_stripelem_cache_put( + context, seq, seq->start, + SEQ_STRIPELEM_IBUF_ENDSTILL, ibuf); + } + + IMB_freeImBuf(ibuf); } } |