ImBuf *IMB_makeSingleUser(ImBuf *ibuf) { ImBuf *rval; if (ibuf) { bool is_single; BLI_spin_lock(&refcounter_spin); is_single = (ibuf->refcounter == 0); BLI_spin_unlock(&refcounter_spin); if (is_single) { return ibuf; } } else { return NULL; } rval = IMB_dupImBuf(ibuf); IMB_metadata_copy(rval, ibuf); IMB_freeImBuf(ibuf); return rval; }
ImBuf *IMB_makeSingleUser(ImBuf *ibuf) { ImBuf *rval; if (!ibuf || ibuf->refcounter == 0) { return ibuf; } rval = IMB_dupImBuf(ibuf); IMB_metadata_copy(rval, ibuf); IMB_freeImBuf(ibuf); return rval; }