summaryrefslogtreecommitdiff
path: root/apps/plugins/puzzles/src/drawing.c
diff options
context:
space:
mode:
Diffstat (limited to 'apps/plugins/puzzles/src/drawing.c')
-rw-r--r--apps/plugins/puzzles/src/drawing.c16
1 files changed, 10 insertions, 6 deletions
diff --git a/apps/plugins/puzzles/src/drawing.c b/apps/plugins/puzzles/src/drawing.c
index a8eb8cfd5f..2c8816c31a 100644
--- a/apps/plugins/puzzles/src/drawing.c
+++ b/apps/plugins/puzzles/src/drawing.c
@@ -27,7 +27,11 @@
27#include <stdlib.h> 27#include <stdlib.h>
28#include <string.h> 28#include <string.h>
29#include <assert.h> 29#include <assert.h>
30#include <math.h> 30#ifdef NO_TGMATH_H
31# include <math.h>
32#else
33# include <tgmath.h>
34#endif
31 35
32#include "puzzles.h" 36#include "puzzles.h"
33 37
@@ -90,8 +94,8 @@ void draw_line(drawing *dr, int x1, int y1, int x2, int y2, int colour)
90void draw_thick_line(drawing *dr, float thickness, 94void draw_thick_line(drawing *dr, float thickness,
91 float x1, float y1, float x2, float y2, int colour) 95 float x1, float y1, float x2, float y2, int colour)
92{ 96{
93 if (thickness < 1.0) 97 if (thickness < 1.0F)
94 thickness = 1.0; 98 thickness = 1.0F;
95 if (dr->api->draw_thick_line) { 99 if (dr->api->draw_thick_line) {
96 dr->api->draw_thick_line(dr->handle, thickness, 100 dr->api->draw_thick_line(dr->handle, thickness,
97 x1, y1, x2, y2, colour); 101 x1, y1, x2, y2, colour);
@@ -101,8 +105,8 @@ void draw_thick_line(drawing *dr, float thickness,
101 * polygon rendering uses integer coordinates. 105 * polygon rendering uses integer coordinates.
102 */ 106 */
103 float len = sqrt((x2 - x1)*(x2 - x1) + (y2 - y1)*(y2 - y1)); 107 float len = sqrt((x2 - x1)*(x2 - x1) + (y2 - y1)*(y2 - y1));
104 float tvhatx = (x2 - x1)/len * (thickness/2 - 0.2); 108 float tvhatx = (x2 - x1)/len * (thickness/2 - 0.2F);
105 float tvhaty = (y2 - y1)/len * (thickness/2 - 0.2); 109 float tvhaty = (y2 - y1)/len * (thickness/2 - 0.2F);
106 int p[8]; 110 int p[8];
107 111
108 p[0] = x1 - tvhaty; 112 p[0] = x1 - tvhaty;
@@ -117,7 +121,7 @@ void draw_thick_line(drawing *dr, float thickness,
117 } 121 }
118} 122}
119 123
120void draw_polygon(drawing *dr, int *coords, int npoints, 124void draw_polygon(drawing *dr, const int *coords, int npoints,
121 int fillcolour, int outlinecolour) 125 int fillcolour, int outlinecolour)
122{ 126{
123 dr->api->draw_polygon(dr->handle, coords, npoints, fillcolour, 127 dr->api->draw_polygon(dr->handle, coords, npoints, fillcolour,