Customized fork of github.com/rxi/lite

macro moment

Changed files
+23 -24
src
+1 -1
src/api/system.c
··· 220 220 # if _WIN32 221 221 int id = MessageBox(0, msg, title, MB_YESNO | MB_ICONWARNING); 222 222 lua_pushboolean(L, id == IDYES); 223 - 224 223 # else 225 224 SDL_MessageBoxButtonData buttons[] = { 226 225 { SDL_MESSAGEBOX_BUTTON_RETURNKEY_DEFAULT, 1, "Yes" }, ··· 236 235 SDL_ShowMessageBox(&data, &buttonid); 237 236 lua_pushboolean(L, buttonid == 1); 238 237 # endif 238 + 239 239 return 1; 240 240 } 241 241
+5 -5
src/rencache.c
··· 218 218 int x2 = (r.x + r.width) / CELL_SIZE; 219 219 int y2 = (r.y + r.height) / CELL_SIZE; 220 220 221 - for (int y = y1; y <= y2; y++) 221 + for (int y = y1 ; y <= y2 ; y++) 222 222 { 223 - for (int x = x1; x <= x2; x++) 223 + for (int x = x1 ; x <= x2 ; x++) 224 224 { 225 225 int idx = cell_idx(x, y); 226 226 hash(&cells[idx], &h, sizeof(h)); ··· 232 232 static void push_rect(RenRect r, int *count) 233 233 { 234 234 /* try to merge with existing rectangle */ 235 - for (int i = *count - 1; i >= 0; i--) 235 + for (int i = *count - 1 ; i >= 0 ; i--) 236 236 { 237 237 RenRect *rp = &rect_buf[i]; 238 238 if (rects_overlap(*rp, r)) ··· 271 271 int rect_count = 0; 272 272 int max_x = screen_rect.width / CELL_SIZE + 1; 273 273 int max_y = screen_rect.height / CELL_SIZE + 1; 274 - for (int y = 0; y < max_y; y++) 274 + for (int y = 0 ; y < max_y; y++) 275 275 { 276 - for (int x = 0; x < max_x; x++) 276 + for (int x = 0 ; x < max_x ; x++) 277 277 { 278 278 /* compare previous and current cell for change */ 279 279 int idx = cell_idx(x, y);
+17 -18
src/renderer.c
··· 232 232 233 233 void ren_free_font(RenFont *font) 234 234 { 235 - for (int i = 0; i < MAX_GLYPHSET; i++) 235 + for (int i = 0 ; i < MAX_GLYPHSET ; i++) 236 236 { 237 237 GlyphSet *set = font->sets[i]; 238 238 if (set) ··· 303 303 } 304 304 305 305 306 - #define rect_draw_loop(expr) do { \ 307 - for (int j = y1; j < y2; j++) \ 306 + #define rect_draw_loop(expr) \ 307 + for (int j = y1 ; j < y2 ; j++) \ 308 + { \ 309 + for (int i = x1 ; i < x2 ; i++) \ 308 310 { \ 309 - for (int i = x1; i < x2; i++) \ 310 - { \ 311 - *d = expr; \ 312 - d++; \ 313 - } \ 314 - d += dr; \ 311 + *d = expr; \ 312 + d++; \ 315 313 } \ 316 - } while (0) 314 + d += dr; \ 315 + } 317 316 318 317 void ren_draw_rect(RenRect rect, RenColor color) 319 318 { ··· 333 332 int dr = surf->w - (x2 - x1); 334 333 335 334 if (color.a == 0xff) 335 + { 336 336 rect_draw_loop(color); 337 + } 337 338 else 339 + { 338 340 rect_draw_loop(blend_pixel(*d, color)); 341 + } 339 342 } 340 343 341 344 ··· 346 349 347 350 /* clip */ 348 351 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; 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; } 357 356 358 357 if (sub->width <= 0 || sub->height <= 0) 359 358 return;