[Bf-blender-cvs] SVN commit: /data/svn/bf-blender [48081] trunk/blender/source/blender/ editors: Mark context as const when it' s possible and avoid typecasts from const bContext* to bContext*
Sergey Sharybin
sergey.vfx at gmail.com
Tue Jun 19 16:09:48 CEST 2012
Revision: 48081
http://projects.blender.org/scm/viewvc.php?view=rev&root=bf-blender&revision=48081
Author: nazgul
Date: 2012-06-19 14:09:44 +0000 (Tue, 19 Jun 2012)
Log Message:
-----------
Mark context as const when it's possible and avoid typecasts from const bContext* to bContext*
Modified Paths:
--------------
trunk/blender/source/blender/editors/include/ED_clip.h
trunk/blender/source/blender/editors/mask/mask_add.c
trunk/blender/source/blender/editors/mask/mask_draw.c
trunk/blender/source/blender/editors/mask/mask_edit.c
trunk/blender/source/blender/editors/mask/mask_intern.h
trunk/blender/source/blender/editors/mask/mask_ops.c
trunk/blender/source/blender/editors/space_clip/clip_editor.c
trunk/blender/source/blender/editors/space_clip/space_clip.c
Modified: trunk/blender/source/blender/editors/include/ED_clip.h
===================================================================
--- trunk/blender/source/blender/editors/include/ED_clip.h 2012-06-19 13:52:41 UTC (rev 48080)
+++ trunk/blender/source/blender/editors/include/ED_clip.h 2012-06-19 14:09:44 UTC (rev 48081)
@@ -70,9 +70,9 @@
int ED_clip_view_selection(struct SpaceClip *sc, struct ARegion *ar, int fit);
void ED_clip_point_undistorted_pos(SpaceClip * sc, const float co[2], float r_co[2]);
-void ED_clip_point_stable_pos(struct bContext *C, float x, float y, float *xr, float *yr);
-void ED_clip_point_stable_pos__reverse(SpaceClip * sc, ARegion *ar, const float co[2], float r_co[2]);
-void ED_clip_mouse_pos(struct bContext *C, struct wmEvent *event, float co[2]);
+void ED_clip_point_stable_pos(const struct bContext *C, float x, float y, float *xr, float *yr);
+void ED_clip_point_stable_pos__reverse(SpaceClip *sc, ARegion *ar, const float co[2], float r_co[2]);
+void ED_clip_mouse_pos(const struct bContext *C, struct wmEvent *event, float co[2]);
int ED_space_clip_texture_buffer_supported(struct SpaceClip *sc);
int ED_space_clip_load_movieclip_buffer(struct SpaceClip *sc, struct ImBuf *ibuf);
Modified: trunk/blender/source/blender/editors/mask/mask_add.c
===================================================================
--- trunk/blender/source/blender/editors/mask/mask_add.c 2012-06-19 13:52:41 UTC (rev 48080)
+++ trunk/blender/source/blender/editors/mask/mask_add.c 2012-06-19 14:09:44 UTC (rev 48081)
@@ -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 @@
/******************** 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 @@
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 @@
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 @@
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;
Modified: trunk/blender/source/blender/editors/mask/mask_draw.c
===================================================================
--- trunk/blender/source/blender/editors/mask/mask_draw.c 2012-06-19 13:52:41 UTC (rev 48080)
+++ trunk/blender/source/blender/editors/mask/mask_draw.c 2012-06-19 14:09:44 UTC (rev 48081)
@@ -441,10 +441,7 @@
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);
}
Modified: trunk/blender/source/blender/editors/mask/mask_edit.c
===================================================================
--- trunk/blender/source/blender/editors/mask/mask_edit.c 2012-06-19 13:52:41 UTC (rev 48080)
+++ trunk/blender/source/blender/editors/mask/mask_edit.c 2012-06-19 14:09:44 UTC (rev 48081)
@@ -76,7 +76,7 @@
/********************** 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 @@
/* 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 @@
*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 @@
*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 @@
*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_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);
Modified: trunk/blender/source/blender/editors/mask/mask_intern.h
===================================================================
--- trunk/blender/source/blender/editors/mask/mask_intern.h 2012-06-19 13:52:41 UTC (rev 48080)
+++ trunk/blender/source/blender/editors/mask/mask_intern.h 2012-06-19 14:09:44 UTC (rev 48081)
@@ -61,12 +61,12 @@
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 @@
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);
Modified: trunk/blender/source/blender/editors/mask/mask_ops.c
===================================================================
--- trunk/blender/source/blender/editors/mask/mask_ops.c 2012-06-19 13:52:41 UTC (rev 48080)
+++ trunk/blender/source/blender/editors/mask/mask_ops.c 2012-06-19 14:09:44 UTC (rev 48081)
@@ -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 @@
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)
{
Modified: trunk/blender/source/blender/editors/space_clip/clip_editor.c
===================================================================
--- trunk/blender/source/blender/editors/space_clip/clip_editor.c 2012-06-19 13:52:41 UTC (rev 48080)
+++ trunk/blender/source/blender/editors/space_clip/clip_editor.c 2012-06-19 14:09:44 UTC (rev 48081)
@@ -446,7 +446,7 @@
}
}
-void ED_clip_point_stable_pos(bContext *C, float x, float y, float *xr, float *yr)
+void ED_clip_point_stable_pos(const bContext *C, float x, float y, float *xr, float *yr)
{
ARegion *ar = CTX_wm_region(C);
SpaceClip *sc = CTX_wm_space_clip(C);
@@ -506,7 +506,7 @@
r_co[1] = (pos[1] * height * zoomy) + (float)sy;
}
-void ED_clip_mouse_pos(bContext *C, wmEvent *event, float co[2])
+void ED_clip_mouse_pos(const bContext *C, wmEvent *event, float co[2])
{
ED_clip_point_stable_pos(C, event->mval[0], event->mval[1], &co[0], &co[1]);
}
Modified: trunk/blender/source/blender/editors/space_clip/space_clip.c
@@ Diff output truncated at 10240 characters. @@
More information about the Bf-blender-cvs
mailing list