Make some GimpCoords* params const
Add const to GimpCoords* params in GimpBrush::select_brush() and want_null_motio().
This commit is contained in:
@ -76,11 +76,11 @@ static gchar * gimp_brush_get_description (GimpViewable *vie
|
||||
static const gchar * gimp_brush_get_extension (GimpData *data);
|
||||
|
||||
static GimpBrush * gimp_brush_real_select_brush (GimpBrush *brush,
|
||||
GimpCoords *last_coords,
|
||||
GimpCoords *cur_coords);
|
||||
const GimpCoords *last_coords,
|
||||
const GimpCoords *current_coords);
|
||||
static gboolean gimp_brush_real_want_null_motion (GimpBrush *brush,
|
||||
GimpCoords *last_coords,
|
||||
GimpCoords *cur_coords);
|
||||
const GimpCoords *last_coords,
|
||||
const GimpCoords *current_coords);
|
||||
|
||||
static gchar * gimp_brush_get_checksum (GimpTagged *tagged);
|
||||
|
||||
@ -356,17 +356,17 @@ gimp_brush_get_extension (GimpData *data)
|
||||
}
|
||||
|
||||
static GimpBrush *
|
||||
gimp_brush_real_select_brush (GimpBrush *brush,
|
||||
GimpCoords *last_coords,
|
||||
GimpCoords *cur_coords)
|
||||
gimp_brush_real_select_brush (GimpBrush *brush,
|
||||
const GimpCoords *last_coords,
|
||||
const GimpCoords *current_coords)
|
||||
{
|
||||
return brush;
|
||||
}
|
||||
|
||||
static gboolean
|
||||
gimp_brush_real_want_null_motion (GimpBrush *brush,
|
||||
GimpCoords *last_coords,
|
||||
GimpCoords *cur_coords)
|
||||
gimp_brush_real_want_null_motion (GimpBrush *brush,
|
||||
const GimpCoords *last_coords,
|
||||
const GimpCoords *current_coords)
|
||||
{
|
||||
return TRUE;
|
||||
}
|
||||
@ -429,31 +429,31 @@ gimp_brush_get_standard (void)
|
||||
}
|
||||
|
||||
GimpBrush *
|
||||
gimp_brush_select_brush (GimpBrush *brush,
|
||||
GimpCoords *last_coords,
|
||||
GimpCoords *cur_coords)
|
||||
gimp_brush_select_brush (GimpBrush *brush,
|
||||
const GimpCoords *last_coords,
|
||||
const GimpCoords *current_coords)
|
||||
{
|
||||
g_return_val_if_fail (GIMP_IS_BRUSH (brush), NULL);
|
||||
g_return_val_if_fail (last_coords != NULL, NULL);
|
||||
g_return_val_if_fail (cur_coords != NULL, NULL);
|
||||
g_return_val_if_fail (current_coords != NULL, NULL);
|
||||
|
||||
return GIMP_BRUSH_GET_CLASS (brush)->select_brush (brush,
|
||||
last_coords,
|
||||
cur_coords);
|
||||
current_coords);
|
||||
}
|
||||
|
||||
gboolean
|
||||
gimp_brush_want_null_motion (GimpBrush *brush,
|
||||
GimpCoords *last_coords,
|
||||
GimpCoords *cur_coords)
|
||||
gimp_brush_want_null_motion (GimpBrush *brush,
|
||||
const GimpCoords *last_coords,
|
||||
const GimpCoords *current_coords)
|
||||
{
|
||||
g_return_val_if_fail (GIMP_IS_BRUSH (brush), FALSE);
|
||||
g_return_val_if_fail (last_coords != NULL, FALSE);
|
||||
g_return_val_if_fail (cur_coords != NULL, FALSE);
|
||||
g_return_val_if_fail (current_coords != NULL, FALSE);
|
||||
|
||||
return GIMP_BRUSH_GET_CLASS (brush)->want_null_motion (brush,
|
||||
last_coords,
|
||||
cur_coords);
|
||||
current_coords);
|
||||
}
|
||||
|
||||
void
|
||||
|
@ -50,29 +50,29 @@ struct _GimpBrushClass
|
||||
GimpDataClass parent_class;
|
||||
|
||||
/* virtual functions */
|
||||
GimpBrush * (* select_brush) (GimpBrush *brush,
|
||||
GimpCoords *last_coords,
|
||||
GimpCoords *cur_coords);
|
||||
gboolean (* want_null_motion) (GimpBrush *brush,
|
||||
GimpCoords *last_coords,
|
||||
GimpCoords *cur_coords);
|
||||
void (* transform_size) (GimpBrush *brush,
|
||||
gdouble scale_x,
|
||||
gdouble scale_y,
|
||||
gdouble angle,
|
||||
gint *width,
|
||||
gint *height);
|
||||
TempBuf * (* transform_mask) (GimpBrush *brush,
|
||||
gdouble scale_x,
|
||||
gdouble scale_y,
|
||||
gdouble angle);
|
||||
TempBuf * (* transform_pixmap) (GimpBrush *brush,
|
||||
gdouble scale_x,
|
||||
gdouble scale_y,
|
||||
gdouble angle);
|
||||
GimpBrush * (* select_brush) (GimpBrush *brush,
|
||||
const GimpCoords *last_coords,
|
||||
const GimpCoords *current_coords);
|
||||
gboolean (* want_null_motion) (GimpBrush *brush,
|
||||
const GimpCoords *last_coords,
|
||||
const GimpCoords *current_coords);
|
||||
void (* transform_size) (GimpBrush *brush,
|
||||
gdouble scale_x,
|
||||
gdouble scale_y,
|
||||
gdouble angle,
|
||||
gint *width,
|
||||
gint *height);
|
||||
TempBuf * (* transform_mask) (GimpBrush *brush,
|
||||
gdouble scale_x,
|
||||
gdouble scale_y,
|
||||
gdouble angle);
|
||||
TempBuf * (* transform_pixmap) (GimpBrush *brush,
|
||||
gdouble scale_x,
|
||||
gdouble scale_y,
|
||||
gdouble angle);
|
||||
|
||||
/* signals */
|
||||
void (* spacing_changed) (GimpBrush *brush);
|
||||
void (* spacing_changed) (GimpBrush *brush);
|
||||
};
|
||||
|
||||
|
||||
@ -82,11 +82,11 @@ GimpData * gimp_brush_new (const gchar *name);
|
||||
GimpData * gimp_brush_get_standard (void);
|
||||
|
||||
GimpBrush * gimp_brush_select_brush (GimpBrush *brush,
|
||||
GimpCoords *last_coords,
|
||||
GimpCoords *cur_coords);
|
||||
const GimpCoords *last_coords,
|
||||
const GimpCoords *current_coords);
|
||||
gboolean gimp_brush_want_null_motion (GimpBrush *brush,
|
||||
GimpCoords *last_coords,
|
||||
GimpCoords *cur_coords);
|
||||
const GimpCoords *last_coords,
|
||||
const GimpCoords *current_coords);
|
||||
|
||||
/* Gets width and height of a transformed mask of the brush, for provided parameters. */
|
||||
void gimp_brush_transform_size (GimpBrush *brush,
|
||||
|
@ -30,24 +30,24 @@
|
||||
#include "gimpbrushpipe-load.h"
|
||||
|
||||
|
||||
static void gimp_brush_pipe_finalize (GObject *object);
|
||||
static void gimp_brush_pipe_finalize (GObject *object);
|
||||
|
||||
static gint64 gimp_brush_pipe_get_memsize (GimpObject *object,
|
||||
gint64 *gui_size);
|
||||
static gint64 gimp_brush_pipe_get_memsize (GimpObject *object,
|
||||
gint64 *gui_size);
|
||||
|
||||
static gboolean gimp_brush_pipe_get_popup_size (GimpViewable *viewable,
|
||||
gint width,
|
||||
gint height,
|
||||
gboolean dot_for_dot,
|
||||
gint *popup_width,
|
||||
gint *popup_height);
|
||||
static gboolean gimp_brush_pipe_get_popup_size (GimpViewable *viewable,
|
||||
gint width,
|
||||
gint height,
|
||||
gboolean dot_for_dot,
|
||||
gint *popup_width,
|
||||
gint *popup_height);
|
||||
|
||||
static GimpBrush * gimp_brush_pipe_select_brush (GimpBrush *brush,
|
||||
GimpCoords *last_coords,
|
||||
GimpCoords *cur_coords);
|
||||
static gboolean gimp_brush_pipe_want_null_motion (GimpBrush *brush,
|
||||
GimpCoords *last_coords,
|
||||
GimpCoords *cur_coords);
|
||||
static GimpBrush * gimp_brush_pipe_select_brush (GimpBrush *brush,
|
||||
const GimpCoords *last_coords,
|
||||
const GimpCoords *current_coords);
|
||||
static gboolean gimp_brush_pipe_want_null_motion (GimpBrush *brush,
|
||||
const GimpCoords *last_coords,
|
||||
const GimpCoords *current_coords);
|
||||
|
||||
|
||||
G_DEFINE_TYPE (GimpBrushPipe, gimp_brush_pipe, GIMP_TYPE_BRUSH);
|
||||
@ -163,9 +163,9 @@ gimp_brush_pipe_get_popup_size (GimpViewable *viewable,
|
||||
}
|
||||
|
||||
static GimpBrush *
|
||||
gimp_brush_pipe_select_brush (GimpBrush *brush,
|
||||
GimpCoords *last_coords,
|
||||
GimpCoords *cur_coords)
|
||||
gimp_brush_pipe_select_brush (GimpBrush *brush,
|
||||
const GimpCoords *last_coords,
|
||||
const GimpCoords *current_coords)
|
||||
{
|
||||
GimpBrushPipe *pipe = GIMP_BRUSH_PIPE (brush);
|
||||
gint i, brushix, ix;
|
||||
@ -189,8 +189,8 @@ gimp_brush_pipe_select_brush (GimpBrush *brush,
|
||||
break;
|
||||
|
||||
case PIPE_SELECT_ANGULAR:
|
||||
angle = atan2 (cur_coords->y - last_coords->y,
|
||||
cur_coords->x - last_coords->x);
|
||||
angle = atan2 (current_coords->y - last_coords->y,
|
||||
current_coords->x - last_coords->x);
|
||||
/* Offset angle to be compatible with PSP tubes */
|
||||
angle += G_PI_2;
|
||||
/* Map it to the [0..2*G_PI) interval */
|
||||
@ -202,8 +202,8 @@ gimp_brush_pipe_select_brush (GimpBrush *brush,
|
||||
break;
|
||||
|
||||
case PIPE_SELECT_VELOCITY:
|
||||
velocity = sqrt (SQR (cur_coords->x - last_coords->x) +
|
||||
SQR (cur_coords->y - last_coords->y));
|
||||
velocity = sqrt (SQR (current_coords->x - last_coords->x) +
|
||||
SQR (current_coords->y - last_coords->y));
|
||||
|
||||
/* I don't know how much velocity is enough velocity. I will assume 0 to
|
||||
brush' saved spacing (converted to pixels) to be 'enough' velocity */
|
||||
@ -216,15 +216,15 @@ gimp_brush_pipe_select_brush (GimpBrush *brush,
|
||||
break;
|
||||
|
||||
case PIPE_SELECT_PRESSURE:
|
||||
ix = RINT (cur_coords->pressure * (pipe->rank[i] - 1));
|
||||
ix = RINT (current_coords->pressure * (pipe->rank[i] - 1));
|
||||
break;
|
||||
|
||||
case PIPE_SELECT_TILT_X:
|
||||
ix = RINT (cur_coords->xtilt / 2.0 * pipe->rank[i]) + pipe->rank[i] / 2;
|
||||
ix = RINT (current_coords->xtilt / 2.0 * pipe->rank[i]) + pipe->rank[i] / 2;
|
||||
break;
|
||||
|
||||
case PIPE_SELECT_TILT_Y:
|
||||
ix = RINT (cur_coords->ytilt / 2.0 * pipe->rank[i]) + pipe->rank[i] / 2;
|
||||
ix = RINT (current_coords->ytilt / 2.0 * pipe->rank[i]) + pipe->rank[i] / 2;
|
||||
break;
|
||||
|
||||
case PIPE_SELECT_CONSTANT:
|
||||
@ -246,9 +246,9 @@ gimp_brush_pipe_select_brush (GimpBrush *brush,
|
||||
}
|
||||
|
||||
static gboolean
|
||||
gimp_brush_pipe_want_null_motion (GimpBrush *brush,
|
||||
GimpCoords *last_coords,
|
||||
GimpCoords *cur_coords)
|
||||
gimp_brush_pipe_want_null_motion (GimpBrush *brush,
|
||||
const GimpCoords *last_coords,
|
||||
const GimpCoords *current_coords)
|
||||
{
|
||||
GimpBrushPipe *pipe = GIMP_BRUSH_PIPE (brush);
|
||||
gint i;
|
||||
|
Reference in New Issue
Block a user