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