+9
-1
.editorconfig
+9
-1
.editorconfig
···
1
root = true
2
3
+
[*.{c,h}]
4
charset = utf-8
5
end_of_line = lf
6
indent_style = tab
7
insert_final_newline = true
8
trim_trailing_whitespace = true
9
+
10
+
[*.{lua}]
11
+
charset = utf-8
12
+
end_of_line = lf
13
+
indent_style = space
14
+
indent_size = 2
15
+
insert_final_newline = true
16
+
trim_trailing_whitespace = true
+1
-1
src/api/system.c
+1
-1
src/api/system.c
···
220
# if _WIN32
221
int id = MessageBox(0, msg, title, MB_YESNO | MB_ICONWARNING);
222
lua_pushboolean(L, id == IDYES);
223
-
224
# else
225
SDL_MessageBoxButtonData buttons[] = {
226
{ SDL_MESSAGEBOX_BUTTON_RETURNKEY_DEFAULT, 1, "Yes" },
···
236
SDL_ShowMessageBox(&data, &buttonid);
237
lua_pushboolean(L, buttonid == 1);
238
# endif
239
return 1;
240
}
241
···
220
# if _WIN32
221
int id = MessageBox(0, msg, title, MB_YESNO | MB_ICONWARNING);
222
lua_pushboolean(L, id == IDYES);
223
# else
224
SDL_MessageBoxButtonData buttons[] = {
225
{ SDL_MESSAGEBOX_BUTTON_RETURNKEY_DEFAULT, 1, "Yes" },
···
235
SDL_ShowMessageBox(&data, &buttonid);
236
lua_pushboolean(L, buttonid == 1);
237
# endif
238
+
239
return 1;
240
}
241
+1
-1
src/main.c
+1
-1
src/main.c
+6
-6
src/rencache.c
+6
-6
src/rencache.c
···
117
}
118
else
119
{
120
-
*prev = (Command *)(((char*) *prev) + (*prev)->size);
121
}
122
123
return *prev != ((Command *)(command_buf + command_buf_idx));
···
218
int x2 = (r.x + r.width) / CELL_SIZE;
219
int y2 = (r.y + r.height) / CELL_SIZE;
220
221
-
for (int y = y1; y <= y2; y++)
222
{
223
-
for (int x = x1; x <= x2; x++)
224
{
225
int idx = cell_idx(x, y);
226
hash(&cells[idx], &h, sizeof(h));
···
232
static void push_rect(RenRect r, int *count)
233
{
234
/* try to merge with existing rectangle */
235
-
for (int i = *count - 1; i >= 0; i--)
236
{
237
RenRect *rp = &rect_buf[i];
238
if (rects_overlap(*rp, r))
···
271
int rect_count = 0;
272
int max_x = screen_rect.width / CELL_SIZE + 1;
273
int max_y = screen_rect.height / CELL_SIZE + 1;
274
-
for (int y = 0; y < max_y; y++)
275
{
276
-
for (int x = 0; x < max_x; x++)
277
{
278
/* compare previous and current cell for change */
279
int idx = cell_idx(x, y);
···
117
}
118
else
119
{
120
+
*prev = (Command *)(((char *)*prev) + (*prev)->size);
121
}
122
123
return *prev != ((Command *)(command_buf + command_buf_idx));
···
218
int x2 = (r.x + r.width) / CELL_SIZE;
219
int y2 = (r.y + r.height) / CELL_SIZE;
220
221
+
for (int y = y1 ; y <= y2 ; y++)
222
{
223
+
for (int x = x1 ; x <= x2 ; x++)
224
{
225
int idx = cell_idx(x, y);
226
hash(&cells[idx], &h, sizeof(h));
···
232
static void push_rect(RenRect r, int *count)
233
{
234
/* try to merge with existing rectangle */
235
+
for (int i = *count - 1 ; i >= 0 ; i--)
236
{
237
RenRect *rp = &rect_buf[i];
238
if (rects_overlap(*rp, r))
···
271
int rect_count = 0;
272
int max_x = screen_rect.width / CELL_SIZE + 1;
273
int max_y = screen_rect.height / CELL_SIZE + 1;
274
+
for (int y = 0 ; y < max_y; y++)
275
{
276
+
for (int x = 0 ; x < max_x ; x++)
277
{
278
/* compare previous and current cell for change */
279
int idx = cell_idx(x, y);
+18
-19
src/renderer.c
+18
-19
src/renderer.c
···
162
/* convert 8bit data to 32bit */
163
for (int i = width * height - 1; i >= 0; i--)
164
{
165
-
uint8_t n = *((uint8_t*) set->image->pixels + i);
166
set->image->pixels[i] = (RenColor) { .r = 255, .g = 255, .b = 255, .a = n };
167
}
168
···
232
233
void ren_free_font(RenFont *font)
234
{
235
-
for (int i = 0; i < MAX_GLYPHSET; i++)
236
{
237
GlyphSet *set = font->sets[i];
238
if (set)
···
303
}
304
305
306
-
#define rect_draw_loop(expr) do { \
307
-
for (int j = y1; j < y2; j++) \
308
{ \
309
-
for (int i = x1; i < x2; i++) \
310
-
{ \
311
-
*d = expr; \
312
-
d++; \
313
-
} \
314
-
d += dr; \
315
} \
316
-
} while (0)
317
318
void ren_draw_rect(RenRect rect, RenColor color)
319
{
···
333
int dr = surf->w - (x2 - x1);
334
335
if (color.a == 0xff)
336
rect_draw_loop(color);
337
else
338
rect_draw_loop(blend_pixel(*d, color));
339
}
340
341
···
346
347
/* clip */
348
int n;
349
-
if ((n = clip.left - x) > 0)
350
-
sub->width -= n; sub->x += n; x += n;
351
-
if ((n = clip.top - y) > 0)
352
-
sub->height -= n; sub->y += n; y += n;
353
-
if ((n = x + sub->width - clip.right ) > 0)
354
-
sub->width -= n;
355
-
if ((n = y + sub->height - clip.bottom) > 0)
356
-
sub->height -= n;
357
358
if (sub->width <= 0 || sub->height <= 0)
359
return;
···
162
/* convert 8bit data to 32bit */
163
for (int i = width * height - 1; i >= 0; i--)
164
{
165
+
uint8_t n = *((uint8_t *)set->image->pixels + i);
166
set->image->pixels[i] = (RenColor) { .r = 255, .g = 255, .b = 255, .a = n };
167
}
168
···
232
233
void ren_free_font(RenFont *font)
234
{
235
+
for (int i = 0 ; i < MAX_GLYPHSET ; i++)
236
{
237
GlyphSet *set = font->sets[i];
238
if (set)
···
303
}
304
305
306
+
#define rect_draw_loop(expr) \
307
+
for (int j = y1 ; j < y2 ; j++) \
308
+
{ \
309
+
for (int i = x1 ; i < x2 ; i++) \
310
{ \
311
+
*d = expr; \
312
+
d++; \
313
} \
314
+
d += dr; \
315
+
}
316
317
void ren_draw_rect(RenRect rect, RenColor color)
318
{
···
332
int dr = surf->w - (x2 - x1);
333
334
if (color.a == 0xff)
335
+
{
336
rect_draw_loop(color);
337
+
}
338
else
339
+
{
340
rect_draw_loop(blend_pixel(*d, color));
341
+
}
342
}
343
344
···
349
350
/* clip */
351
int n;
352
+
if ((n = clip.left - x) > 0) { sub->width -= n; sub->x += n; x += n; }
353
+
if ((n = clip.top - y) > 0) { sub->height -= n; sub->y += n; y += n; }
354
+
if ((n = x + sub->width - clip.right ) > 0) { sub->width -= n; }
355
+
if ((n = y + sub->height - clip.bottom) > 0) { sub->height -= n; }
356
357
if (sub->width <= 0 || sub->height <= 0)
358
return;