Cleanup: Remove BKE_mask_copy_nolib() and BKE_mask_free().

Generic ID management code can now do those local temp copy handling, so
no need for duplicated own code for that.

No behavioral changes expected here.
This commit is contained in:
Bastien Montagne
2020-10-08 11:36:11 +02:00
parent fdb2240e4d
commit df5fe9718b
4 changed files with 7 additions and 38 deletions
-3
View File
@@ -141,9 +141,6 @@ void BKE_mask_point_select_set_handle(struct MaskSplinePoint *point,
/* general */
struct Mask *BKE_mask_new(struct Main *bmain, const char *name);
struct Mask *BKE_mask_copy_nolib(struct Mask *mask);
void BKE_mask_free(struct Mask *mask);
void BKE_mask_coord_from_frame(float r_co[2], const float co[2], const float frame_size[2]);
void BKE_mask_coord_from_movieclip(struct MovieClip *clip,
-27
View File
@@ -1053,27 +1053,6 @@ Mask *BKE_mask_new(Main *bmain, const char *name)
return mask;
}
/* TODO(sergey): Use generic BKE_libblock_copy_nolib() instead. */
/* TODO(bastien): Use new super cool & generic BKE_id_copy_ex() instead! */
Mask *BKE_mask_copy_nolib(Mask *mask)
{
Mask *mask_new;
mask_new = MEM_dupallocN(mask);
/*take care here! - we may want to copy anim data */
mask_new->adt = NULL;
BLI_listbase_clear(&mask_new->masklayers);
BKE_mask_layer_copy_list(&mask_new->masklayers, &mask->masklayers);
/* enable fake user by default */
id_fake_user_set(&mask->id);
return mask_new;
}
void BKE_mask_point_free(MaskSplinePoint *point)
{
if (point->uw) {
@@ -1216,12 +1195,6 @@ void BKE_mask_layer_free_list(ListBase *masklayers)
}
}
/** Free (or release) any data used by this mask (does not free the mask itself). */
void BKE_mask_free(Mask *mask)
{
mask_free_data(&mask->id);
}
void BKE_mask_coord_from_frame(float r_co[2], const float co[2], const float frame_size[2])
{
if (frame_size[0] == frame_size[1]) {
@@ -23,6 +23,7 @@
#include "BLI_listbase.h"
#include "BLI_math.h"
#include "BKE_lib_id.h"
#include "BKE_mask.h"
MaskOperation::MaskOperation() : NodeOperation()
@@ -59,9 +60,8 @@ void MaskOperation::initExecution()
const float frame_step = (this->m_frame_shutter * 2.0f) / this->m_rasterMaskHandleTot;
float frame_iter = frame;
Mask *mask_temp;
mask_temp = BKE_mask_copy_nolib(this->m_mask);
Mask *mask_temp = (Mask *)BKE_id_copy_ex(
NULL, &this->m_mask->id, NULL, LIB_ID_COPY_LOCALIZE | LIB_ID_COPY_NO_ANIMDATA);
/* trick so we can get unkeyed edits to display */
{
@@ -92,8 +92,7 @@ void MaskOperation::initExecution()
frame_iter += frame_step;
}
BKE_mask_free(mask_temp);
MEM_freeN(mask_temp);
BKE_id_free(NULL, &mask_temp->id);
}
}
}
+3 -3
View File
@@ -3387,7 +3387,8 @@ static ImBuf *seq_render_mask(const SeqRenderData *context, Mask *mask, float nr
Mask *mask_temp;
MaskRasterHandle *mr_handle;
mask_temp = BKE_mask_copy_nolib(mask);
mask_temp = (Mask *)BKE_id_copy_ex(
NULL, &mask->id, NULL, LIB_ID_COPY_LOCALIZE | LIB_ID_COPY_NO_ANIMDATA);
BKE_mask_evaluate(mask_temp, mask->sfra + nr, true);
@@ -3404,8 +3405,7 @@ static ImBuf *seq_render_mask(const SeqRenderData *context, Mask *mask, float nr
BKE_maskrasterize_handle_init(
mr_handle, mask_temp, context->rectx, context->recty, true, true, true);
BKE_mask_free(mask_temp);
MEM_freeN(mask_temp);
BKE_id_free(NULL, &mask_temp->id);
BKE_maskrasterize_buffer(mr_handle, context->rectx, context->recty, maskbuf);