Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSergey Sharybin <sergey.vfx@gmail.com>2012-06-19 18:09:44 +0400
committerSergey Sharybin <sergey.vfx@gmail.com>2012-06-19 18:09:44 +0400
commit14a68d3a5f325373e575c28405064c4782a8ff97 (patch)
tree9f419c06944e45d22b989581c34a88babbcf4682 /source/blender/editors/mask
parent7f2d1c01cdbcf1e0934c2f1664eb76986c7bc369 (diff)
Mark context as const when it's possible and avoid typecasts from const bContext* to bContext*
Diffstat (limited to 'source/blender/editors/mask')
-rw-r--r--source/blender/editors/mask/mask_add.c10
-rw-r--r--source/blender/editors/mask/mask_draw.c5
-rw-r--r--source/blender/editors/mask/mask_edit.c12
-rw-r--r--source/blender/editors/mask/mask_intern.h16
-rw-r--r--source/blender/editors/mask/mask_ops.c4
5 files changed, 22 insertions, 25 deletions
diff --git a/source/blender/editors/mask/mask_add.c b/source/blender/editors/mask/mask_add.c
index 0bc9adb6577..c9f6dc0c5fb 100644
--- a/source/blender/editors/mask/mask_add.c
+++ b/source/blender/editors/mask/mask_add.c
@@ -52,7 +52,7 @@
#include "mask_intern.h" /* own include */
-static int find_nearest_diff_point(bContext *C, Mask *mask, const float normal_co[2], int threshold, int feather,
+static int find_nearest_diff_point(const bContext *C, Mask *mask, const float normal_co[2], int threshold, int feather,
MaskLayer **masklay_r, MaskSpline **spline_r, MaskSplinePoint **point_r,
float *u_r, float tangent[2],
const short use_deform)
@@ -176,7 +176,7 @@ static int find_nearest_diff_point(bContext *C, Mask *mask, const float normal_c
/******************** add vertex *********************/
-static void setup_vertex_point(bContext *C, Mask *mask, MaskSpline *spline, MaskSplinePoint *new_point,
+static void setup_vertex_point(const bContext *C, Mask *mask, MaskSpline *spline, MaskSplinePoint *new_point,
const float point_co[2], const float tangent[2], const float u,
MaskSplinePoint *reference_point, const short reference_adjacent)
{
@@ -365,7 +365,7 @@ static void mask_spline_add_point_at_index(MaskSpline *spline, int point_index)
spline->tot_point++;
}
-static int add_vertex_subdivide(bContext *C, Mask *mask, const float co[2])
+static int add_vertex_subdivide(const bContext *C, Mask *mask, const float co[2])
{
MaskLayer *masklay;
MaskSpline *spline;
@@ -399,7 +399,7 @@ static int add_vertex_subdivide(bContext *C, Mask *mask, const float co[2])
return FALSE;
}
-static int add_vertex_extrude(bContext *C, Mask *mask, MaskLayer *masklay, const float co[2])
+static int add_vertex_extrude(const bContext *C, Mask *mask, MaskLayer *masklay, const float co[2])
{
MaskSpline *spline;
MaskSplinePoint *point;
@@ -500,7 +500,7 @@ static int add_vertex_extrude(bContext *C, Mask *mask, MaskLayer *masklay, const
return TRUE;
}
-static int add_vertex_new(bContext *C, Mask *mask, MaskLayer *masklay, const float co[2])
+static int add_vertex_new(const bContext *C, Mask *mask, MaskLayer *masklay, const float co[2])
{
MaskSpline *spline;
MaskSplinePoint *point;
diff --git a/source/blender/editors/mask/mask_draw.c b/source/blender/editors/mask/mask_draw.c
index 678186f0e8c..71d3caf74c5 100644
--- a/source/blender/editors/mask/mask_draw.c
+++ b/source/blender/editors/mask/mask_draw.c
@@ -441,10 +441,7 @@ void ED_mask_draw(const bContext *C,
if (!mask)
return;
- /* TODO: for now, in the future better to make sure all utility functions
- * are using const specifier for non-changing pointers
- */
- ED_mask_size((bContext *)C, &width, &height);
+ ED_mask_size(C, &width, &height);
draw_masklays(mask, draw_flag, draw_type, width, height);
}
diff --git a/source/blender/editors/mask/mask_edit.c b/source/blender/editors/mask/mask_edit.c
index 52711c8da55..3396f664820 100644
--- a/source/blender/editors/mask/mask_edit.c
+++ b/source/blender/editors/mask/mask_edit.c
@@ -76,7 +76,7 @@ int ED_maskedit_mask_poll(bContext *C)
/********************** registration *********************/
-void ED_mask_mouse_pos(bContext *C, wmEvent *event, float co[2])
+void ED_mask_mouse_pos(const bContext *C, wmEvent *event, float co[2])
{
SpaceClip *sc = CTX_wm_space_clip(C);
@@ -92,7 +92,7 @@ void ED_mask_mouse_pos(bContext *C, wmEvent *event, float co[2])
/* input: x/y - mval space
* output: xr/yr - mask point space */
-void ED_mask_point_pos(bContext *C, float x, float y, float *xr, float *yr)
+void ED_mask_point_pos(const bContext *C, float x, float y, float *xr, float *yr)
{
SpaceClip *sc = CTX_wm_space_clip(C);
float co[2];
@@ -110,7 +110,7 @@ void ED_mask_point_pos(bContext *C, float x, float y, float *xr, float *yr)
*yr = co[1];
}
-void ED_mask_point_pos__reverse(bContext *C, float x, float y, float *xr, float *yr)
+void ED_mask_point_pos__reverse(const bContext *C, float x, float y, float *xr, float *yr)
{
SpaceClip *sc = CTX_wm_space_clip(C);
ARegion *ar = CTX_wm_region(C);
@@ -132,7 +132,7 @@ void ED_mask_point_pos__reverse(bContext *C, float x, float y, float *xr, float
*yr = co[1];
}
-void ED_mask_size(bContext *C, int *width, int *height)
+void ED_mask_size(const bContext *C, int *width, int *height)
{
ScrArea *sa = CTX_wm_area(C);
if (sa && sa->spacedata.first) {
@@ -154,7 +154,7 @@ void ED_mask_size(bContext *C, int *width, int *height)
*height = 0;
}
-void ED_mask_aspect(bContext *C, float *aspx, float *aspy)
+void ED_mask_aspect(const bContext *C, float *aspx, float *aspy)
{
SpaceClip *sc = CTX_wm_space_clip(C);
@@ -168,7 +168,7 @@ void ED_mask_aspect(bContext *C, float *aspx, float *aspy)
}
}
-void ED_mask_pixelspace_factor(bContext *C, float *scalex, float *scaley)
+void ED_mask_pixelspace_factor(const bContext *C, float *scalex, float *scaley)
{
SpaceClip *sc = CTX_wm_space_clip(C);
diff --git a/source/blender/editors/mask/mask_intern.h b/source/blender/editors/mask/mask_intern.h
index c34558d2a01..408b585bf4c 100644
--- a/source/blender/editors/mask/mask_intern.h
+++ b/source/blender/editors/mask/mask_intern.h
@@ -61,12 +61,12 @@ void MASK_OT_normals_make_consistent(struct wmOperatorType *ot);
void MASK_OT_handle_type_set(struct wmOperatorType *ot);
int ED_mask_feather_find_nearest(
- struct bContext *C, struct Mask *mask, float normal_co[2], int threshold,
+ const struct bContext *C, struct Mask *mask, float normal_co[2], int threshold,
struct MaskLayer **masklay_r, struct MaskSpline **spline_r, struct MaskSplinePoint **point_r,
struct MaskSplinePointUW **uw_r, float *score);
struct MaskSplinePoint *ED_mask_point_find_nearest(
- struct bContext *C, struct Mask *mask, float normal_co[2], int threshold,
+ const struct bContext *C, struct Mask *mask, float normal_co[2], int threshold,
struct MaskLayer **masklay_r, struct MaskSpline **spline_r, int *is_handle_r,
float *score);
@@ -97,14 +97,14 @@ void ED_mask_select_flush_all(struct Mask *mask);
int ED_maskedit_poll(struct bContext *C);
int ED_maskedit_mask_poll(struct bContext *C);
-void ED_mask_size(struct bContext *C, int *width, int *height);
-void ED_mask_aspect(struct bContext *C, float *aspx, float *aspy);
+void ED_mask_size(const struct bContext *C, int *width, int *height);
+void ED_mask_aspect(const struct bContext *C, float *aspx, float *aspy);
-void ED_mask_pixelspace_factor(struct bContext *C, float *scalex, float *scaley);
-void ED_mask_mouse_pos(struct bContext *C, struct wmEvent *event, float co[2]);
+void ED_mask_pixelspace_factor(const struct bContext *C, float *scalex, float *scaley);
+void ED_mask_mouse_pos(const struct bContext *C, struct wmEvent *event, float co[2]);
-void ED_mask_point_pos(struct bContext *C, float x, float y, float *xr, float *yr);
-void ED_mask_point_pos__reverse(struct bContext *C, float x, float y, float *xr, float *yr);
+void ED_mask_point_pos(const struct bContext *C, float x, float y, float *xr, float *yr);
+void ED_mask_point_pos__reverse(const struct bContext *C, float x, float y, float *xr, float *yr);
/* mask_shapekey.c */
void MASK_OT_shape_key_insert(struct wmOperatorType *ot);
diff --git a/source/blender/editors/mask/mask_ops.c b/source/blender/editors/mask/mask_ops.c
index b770e5e9dba..91ba05c1ab2 100644
--- a/source/blender/editors/mask/mask_ops.c
+++ b/source/blender/editors/mask/mask_ops.c
@@ -57,7 +57,7 @@
/******************** utility functions *********************/
-MaskSplinePoint *ED_mask_point_find_nearest(bContext *C, Mask *mask, float normal_co[2], int threshold,
+MaskSplinePoint *ED_mask_point_find_nearest(const bContext *C, Mask *mask, float normal_co[2], int threshold,
MaskLayer **masklay_r, MaskSpline **spline_r, int *is_handle_r,
float *score)
{
@@ -153,7 +153,7 @@ MaskSplinePoint *ED_mask_point_find_nearest(bContext *C, Mask *mask, float norma
return NULL;
}
-int ED_mask_feather_find_nearest(bContext *C, Mask *mask, float normal_co[2], int threshold,
+int ED_mask_feather_find_nearest(const bContext *C, Mask *mask, float normal_co[2], int threshold,
MaskLayer **masklay_r, MaskSpline **spline_r, MaskSplinePoint **point_r,
MaskSplinePointUW **uw_r, float *score)
{