Add 'const' to the draw_polygon coords array parameter.

Thanks to Mouse for spotting that it was missing.
This commit is contained in:
Simon Tatham
2021-09-13 11:04:59 +01:00
parent d204978391
commit 88358f0643
8 changed files with 12 additions and 12 deletions

View File

@ -1935,7 +1935,7 @@ This function may be used for both drawing and printing.
\S{drawing-draw-polygon} \cw{draw_polygon()} \S{drawing-draw-polygon} \cw{draw_polygon()}
\c void draw_polygon(drawing *dr, int *coords, int npoints, \c void draw_polygon(drawing *dr, const int *coords, int npoints,
\c int fillcolour, int outlinecolour); \c int fillcolour, int outlinecolour);
Draws an outlined or filled polygon in the puzzle window. Draws an outlined or filled polygon in the puzzle window.
@ -2497,7 +2497,7 @@ function; see \k{drawing-draw-line}.
\S{drawingapi-draw-polygon} \cw{draw_polygon()} \S{drawingapi-draw-polygon} \cw{draw_polygon()}
\c void (*draw_polygon)(void *handle, int *coords, int npoints, \c void (*draw_polygon)(void *handle, const int *coords, int npoints,
\c int fillcolour, int outlinecolour); \c int fillcolour, int outlinecolour);
This function behaves exactly like the back end \cw{draw_polygon()} This function behaves exactly like the back end \cw{draw_polygon()}

View File

@ -117,7 +117,7 @@ void draw_thick_line(drawing *dr, float thickness,
} }
} }
void draw_polygon(drawing *dr, int *coords, int npoints, void draw_polygon(drawing *dr, const int *coords, int npoints,
int fillcolour, int outlinecolour) int fillcolour, int outlinecolour)
{ {
dr->api->draw_polygon(dr->handle, coords, npoints, fillcolour, dr->api->draw_polygon(dr->handle, coords, npoints, fillcolour,

6
gtk.c
View File

@ -571,7 +571,7 @@ static void do_draw_thick_line(frontend *fe, float thickness,
cairo_restore(fe->cr); cairo_restore(fe->cr);
} }
static void do_draw_poly(frontend *fe, int *coords, int npoints, static void do_draw_poly(frontend *fe, const int *coords, int npoints,
int fillcolour, int outlinecolour) int fillcolour, int outlinecolour)
{ {
int i; int i;
@ -832,7 +832,7 @@ static void do_draw_thick_line(frontend *fe, float thickness,
save.join_style); save.join_style);
} }
static void do_draw_poly(frontend *fe, int *coords, int npoints, static void do_draw_poly(frontend *fe, const int *coords, int npoints,
int fillcolour, int outlinecolour) int fillcolour, int outlinecolour)
{ {
GdkPoint *points = snewn(npoints, GdkPoint); GdkPoint *points = snewn(npoints, GdkPoint);
@ -1206,7 +1206,7 @@ void gtk_draw_thick_line(void *handle, float thickness,
do_draw_thick_line(fe, thickness, x1, y1, x2, y2); do_draw_thick_line(fe, thickness, x1, y1, x2, y2);
} }
void gtk_draw_poly(void *handle, int *coords, int npoints, void gtk_draw_poly(void *handle, const int *coords, int npoints,
int fillcolour, int outlinecolour) int fillcolour, int outlinecolour)
{ {
frontend *fe = (frontend *)handle; frontend *fe = (frontend *)handle;

View File

@ -15,7 +15,7 @@ void draw_rect(drawing *dr, int x, int y, int w, int h, int colour) {}
void draw_line(drawing *dr, int x1, int y1, int x2, int y2, int colour) {} void draw_line(drawing *dr, int x1, int y1, int x2, int y2, int colour) {}
void draw_thick_line(drawing *dr, float thickness, void draw_thick_line(drawing *dr, float thickness,
float x1, float y1, float x2, float y2, int colour) {} float x1, float y1, float x2, float y2, int colour) {}
void draw_polygon(drawing *dr, int *coords, int npoints, void draw_polygon(drawing *dr, const int *coords, int npoints,
int fillcolour, int outlinecolour) {} int fillcolour, int outlinecolour) {}
void draw_circle(drawing *dr, int cx, int cy, int radius, void draw_circle(drawing *dr, int cx, int cy, int radius,
int fillcolour, int outlinecolour) {} int fillcolour, int outlinecolour) {}

2
osx.m
View File

@ -1344,7 +1344,7 @@ struct frontend {
/* /*
* Drawing routines called by the midend. * Drawing routines called by the midend.
*/ */
static void osx_draw_polygon(void *handle, int *coords, int npoints, static void osx_draw_polygon(void *handle, const int *coords, int npoints,
int fillcolour, int outlinecolour) int fillcolour, int outlinecolour)
{ {
frontend *fe = (frontend *)handle; frontend *fe = (frontend *)handle;

2
ps.c
View File

@ -157,7 +157,7 @@ static void ps_draw_line(void *handle, int x1, int y1, int x2, int y2,
ps_stroke(ps, colour); ps_stroke(ps, colour);
} }
static void ps_draw_polygon(void *handle, int *coords, int npoints, static void ps_draw_polygon(void *handle, const int *coords, int npoints,
int fillcolour, int outlinecolour) int fillcolour, int outlinecolour)
{ {
psdata *ps = (psdata *)handle; psdata *ps = (psdata *)handle;

View File

@ -248,7 +248,7 @@ void draw_text(drawing *dr, int x, int y, int fonttype, int fontsize,
int align, int colour, const char *text); int align, int colour, const char *text);
void draw_rect(drawing *dr, int x, int y, int w, int h, int colour); void draw_rect(drawing *dr, int x, int y, int w, int h, int colour);
void draw_line(drawing *dr, int x1, int y1, int x2, int y2, int colour); void draw_line(drawing *dr, int x1, int y1, int x2, int y2, int colour);
void draw_polygon(drawing *dr, int *coords, int npoints, void draw_polygon(drawing *dr, const int *coords, int npoints,
int fillcolour, int outlinecolour); int fillcolour, int outlinecolour);
void draw_circle(drawing *dr, int cx, int cy, int radius, void draw_circle(drawing *dr, int cx, int cy, int radius,
int fillcolour, int outlinecolour); int fillcolour, int outlinecolour);
@ -700,7 +700,7 @@ struct drawing_api {
void (*draw_rect)(void *handle, int x, int y, int w, int h, int colour); void (*draw_rect)(void *handle, int x, int y, int w, int h, int colour);
void (*draw_line)(void *handle, int x1, int y1, int x2, int y2, void (*draw_line)(void *handle, int x1, int y1, int x2, int y2,
int colour); int colour);
void (*draw_polygon)(void *handle, int *coords, int npoints, void (*draw_polygon)(void *handle, const int *coords, int npoints,
int fillcolour, int outlinecolour); int fillcolour, int outlinecolour);
void (*draw_circle)(void *handle, int cx, int cy, int radius, void (*draw_circle)(void *handle, int cx, int cy, int radius,
int fillcolour, int outlinecolour); int fillcolour, int outlinecolour);

View File

@ -627,7 +627,7 @@ static void win_draw_circle(void *handle, int cx, int cy, int radius,
win_reset_pen(fe); win_reset_pen(fe);
} }
static void win_draw_polygon(void *handle, int *coords, int npoints, static void win_draw_polygon(void *handle, const int *coords, int npoints,
int fillcolour, int outlinecolour) int fillcolour, int outlinecolour)
{ {
frontend *fe = (frontend *)handle; frontend *fe = (frontend *)handle;