Skip to content

Commit ababadf

Browse files
committed
guard the malloc and debug defines into implementation block
1 parent 7557452 commit ababadf

File tree

2 files changed

+15
-15
lines changed

2 files changed

+15
-15
lines changed

examples/c/geometry.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -25,15 +25,15 @@ void blend_tile(const pp_tile_t *t) {
2525
}
2626

2727
// draw border of tile for debugging
28-
colour box = create_colour(160, 180, 200, 150);
28+
/*colour box = create_colour(160, 180, 200, 150);
2929
for(int32_t x = t->x; x < t->x + t->w; x++) {
3030
buffer[t->y][x] = blend(buffer[t->y][x], box);
3131
buffer[t->y + t->h][x] = blend(buffer[t->y + t->h][x], box);
3232
}
3333
for(int32_t y = t->y; y < t->y + t->h; y++) {
3434
buffer[y][t->x] = blend(buffer[y][t->x], box);
3535
buffer[y][t->x + t->w] = blend(buffer[y][t->x + t->w], box);
36-
}
36+
}*/
3737
}
3838

3939

pretty-poly.h

Lines changed: 13 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -36,12 +36,6 @@
3636
#include <math.h>
3737
#include <stdbool.h>
3838

39-
#ifndef PP_MALLOC
40-
#define PP_MALLOC(size) malloc(size)
41-
#define PP_REALLOC(p, size) realloc(p, size)
42-
#define PP_FREE(p) free(p)
43-
#endif
44-
4539
#ifndef PP_COORD_TYPE
4640
#define PP_COORD_TYPE float
4741
#endif
@@ -63,12 +57,6 @@
6357
#include "hardware/interp.h"
6458
#endif
6559

66-
#ifdef PP_DEBUG
67-
#define debug(...) printf(__VA_ARGS__)
68-
#else
69-
#define debug(...)
70-
#endif
71-
7260
#ifdef __cplusplus
7361
extern "C" {
7462
#endif
@@ -145,6 +133,18 @@ pp_rect_t pp_polygon_bounds(pp_poly_t *p);
145133

146134
#ifdef PP_IMPLEMENTATION
147135

136+
#ifndef PP_MALLOC
137+
#define PP_MALLOC(size) malloc(size)
138+
#define PP_REALLOC(p, size) realloc(p, size)
139+
#define PP_FREE(p) free(p)
140+
#endif
141+
142+
#ifdef PP_DEBUG
143+
#define debug(...) printf(__VA_ARGS__)
144+
#else
145+
#define debug(...)
146+
#endif
147+
148148
pp_rect_t _pp_clip = (pp_rect_t){-INT_MAX, -INT_MAX, INT_MAX, INT_MAX};
149149
pp_tile_callback_t _pp_tile_callback = NULL;
150150
pp_antialias_t _pp_antialias = PP_AA_X4;
@@ -437,7 +437,7 @@ pp_rect_t render_nodes(pp_rect_t *tb) {
437437

438438
unsigned char* row_data = &tile_buffer[(y >> _pp_antialias) * PP_TILE_BUFFER_SIZE];
439439

440-
for(int i = 0; i < node_counts[y]; i += 2) {
440+
for(uint32_t i = 0; i < node_counts[y]; i += 2) {
441441
int sx = nodes[y][i + 0];
442442
int ex = nodes[y][i + 1];
443443

0 commit comments

Comments
 (0)