diff options
author | Campbell Barton <ideasman42@gmail.com> | 2019-04-17 07:17:24 +0300 |
---|---|---|
committer | Campbell Barton <ideasman42@gmail.com> | 2019-04-17 07:21:24 +0300 |
commit | e12c08e8d170b7ca40f204a5b0423c23a9fbc2c1 (patch) | |
tree | 8cf3453d12edb177a218ef8009357518ec6cab6a /source/blender/editors/sculpt_paint/paint_curve_undo.c | |
parent | b3dabc200a4b0399ec6b81f2ff2730d07b44fcaa (diff) |
ClangFormat: apply to source, most of intern
Apply clang format as proposed in T53211.
For details on usage and instructions for migrating branches
without conflicts, see:
https://wiki.blender.org/wiki/Tools/ClangFormat
Diffstat (limited to 'source/blender/editors/sculpt_paint/paint_curve_undo.c')
-rw-r--r-- | source/blender/editors/sculpt_paint/paint_curve_undo.c | 122 |
1 files changed, 63 insertions, 59 deletions
diff --git a/source/blender/editors/sculpt_paint/paint_curve_undo.c b/source/blender/editors/sculpt_paint/paint_curve_undo.c index 1eaed8eabb8..c03cb69df88 100644 --- a/source/blender/editors/sculpt_paint/paint_curve_undo.c +++ b/source/blender/editors/sculpt_paint/paint_curve_undo.c @@ -44,30 +44,30 @@ * \{ */ typedef struct UndoCurve { - PaintCurvePoint *points; /* points of curve */ - int tot_points; - int add_index; + PaintCurvePoint *points; /* points of curve */ + int tot_points; + int add_index; } UndoCurve; static void undocurve_from_paintcurve(UndoCurve *uc, const PaintCurve *pc) { - BLI_assert(BLI_array_is_zeroed(uc, 1)); - uc->points = MEM_dupallocN(pc->points); - uc->tot_points = pc->tot_points; - uc->add_index = pc->add_index; + BLI_assert(BLI_array_is_zeroed(uc, 1)); + uc->points = MEM_dupallocN(pc->points); + uc->tot_points = pc->tot_points; + uc->add_index = pc->add_index; } static void undocurve_to_paintcurve(const UndoCurve *uc, PaintCurve *pc) { - MEM_SAFE_FREE(pc->points); - pc->points = MEM_dupallocN(uc->points); - pc->tot_points = uc->tot_points; - pc->add_index = uc->add_index; + MEM_SAFE_FREE(pc->points); + pc->points = MEM_dupallocN(uc->points); + pc->tot_points = uc->tot_points; + pc->add_index = uc->add_index; } static void undocurve_free_data(UndoCurve *uc) { - MEM_SAFE_FREE(uc->points); + MEM_SAFE_FREE(uc->points); } /** \} */ @@ -77,92 +77,96 @@ static void undocurve_free_data(UndoCurve *uc) * \{ */ typedef struct PaintCurveUndoStep { - UndoStep step; - PaintCurve *pc; - UndoCurve data; + UndoStep step; + PaintCurve *pc; + UndoCurve data; } PaintCurveUndoStep; static bool paintcurve_undosys_poll(bContext *C) { - if (C == NULL || !paint_curve_poll(C)) { - return false; - } - Paint *p = BKE_paint_get_active_from_context(C); - return (p->brush && p->brush->paint_curve); + if (C == NULL || !paint_curve_poll(C)) { + return false; + } + Paint *p = BKE_paint_get_active_from_context(C); + return (p->brush && p->brush->paint_curve); } static void paintcurve_undosys_step_encode_init(struct bContext *C, UndoStep *us_p) { - /* XXX, use to set the undo type only. */ - UNUSED_VARS(C, us_p); + /* XXX, use to set the undo type only. */ + UNUSED_VARS(C, us_p); } -static bool paintcurve_undosys_step_encode(struct bContext *C, struct Main *UNUSED(bmain), UndoStep *us_p) +static bool paintcurve_undosys_step_encode(struct bContext *C, + struct Main *UNUSED(bmain), + UndoStep *us_p) { - if (C == NULL || !paint_curve_poll(C)) { - return false; - } - Paint *p = BKE_paint_get_active_from_context(C); - PaintCurve *pc = p ? (p->brush ? p->brush->paint_curve : NULL) : NULL; - if (pc == NULL) { - return false; - } - - PaintCurveUndoStep *us = (PaintCurveUndoStep *)us_p; - BLI_assert(us->step.data_size == 0); - - us->pc = pc; - undocurve_from_paintcurve(&us->data, pc); - - return true; + if (C == NULL || !paint_curve_poll(C)) { + return false; + } + Paint *p = BKE_paint_get_active_from_context(C); + PaintCurve *pc = p ? (p->brush ? p->brush->paint_curve : NULL) : NULL; + if (pc == NULL) { + return false; + } + + PaintCurveUndoStep *us = (PaintCurveUndoStep *)us_p; + BLI_assert(us->step.data_size == 0); + + us->pc = pc; + undocurve_from_paintcurve(&us->data, pc); + + return true; } -static void paintcurve_undosys_step_decode(struct bContext *UNUSED(C), struct Main *UNUSED(bmain), UndoStep *us_p, int UNUSED(dir)) +static void paintcurve_undosys_step_decode(struct bContext *UNUSED(C), + struct Main *UNUSED(bmain), + UndoStep *us_p, + int UNUSED(dir)) { - PaintCurveUndoStep *us = (PaintCurveUndoStep *)us_p; - undocurve_to_paintcurve(&us->data, us->pc); + PaintCurveUndoStep *us = (PaintCurveUndoStep *)us_p; + undocurve_to_paintcurve(&us->data, us->pc); } static void paintcurve_undosys_step_free(UndoStep *us_p) { - PaintCurveUndoStep *us = (PaintCurveUndoStep *)us_p; - undocurve_free_data(&us->data); + PaintCurveUndoStep *us = (PaintCurveUndoStep *)us_p; + undocurve_free_data(&us->data); } /* Export for ED_undo_sys. */ void ED_paintcurve_undosys_type(UndoType *ut) { - ut->name = "Paint Curve"; - /* don't poll for now */ - ut->poll = paintcurve_undosys_poll; - ut->step_encode_init = paintcurve_undosys_step_encode_init; - ut->step_encode = paintcurve_undosys_step_encode; - ut->step_decode = paintcurve_undosys_step_decode; - ut->step_free = paintcurve_undosys_step_free; + ut->name = "Paint Curve"; + /* don't poll for now */ + ut->poll = paintcurve_undosys_poll; + ut->step_encode_init = paintcurve_undosys_step_encode_init; + ut->step_encode = paintcurve_undosys_step_encode; + ut->step_decode = paintcurve_undosys_step_decode; + ut->step_free = paintcurve_undosys_step_free; - ut->use_context = false; + ut->use_context = false; - ut->step_size = sizeof(PaintCurveUndoStep); + ut->step_size = sizeof(PaintCurveUndoStep); } /** \} */ - /* -------------------------------------------------------------------- */ /** \name Utilities * \{ */ void ED_paintcurve_undo_push_begin(const char *name) { - UndoStack *ustack = ED_undo_stack_get(); - bContext *C = NULL; /* special case, we never read from this. */ - BKE_undosys_step_push_init_with_type(ustack, C, name, BKE_UNDOSYS_TYPE_PAINTCURVE); + UndoStack *ustack = ED_undo_stack_get(); + bContext *C = NULL; /* special case, we never read from this. */ + BKE_undosys_step_push_init_with_type(ustack, C, name, BKE_UNDOSYS_TYPE_PAINTCURVE); } void ED_paintcurve_undo_push_end(void) { - UndoStack *ustack = ED_undo_stack_get(); - BKE_undosys_step_push(ustack, NULL, NULL); + UndoStack *ustack = ED_undo_stack_get(); + BKE_undosys_step_push(ustack, NULL, NULL); } /** \} */ |