this repo has no description
0
fork

Configure Feed

Select the types of activity you want to include in your feed.

Merge pull request #1119 from asiekierka/optimizations

minor rendering optimizations

authored by

Vadim Grigoruk and committed by
GitHub
4ca9a2b7 11a5eb2f

+21 -3
+4 -2
src/surf.c
··· 288 288 289 289 s32 ym = Height * i + y - surf->menu.pos*MENU_HEIGHT - surf->menu.anim + (MENU_HEIGHT - TIC_FONT_HEIGHT)/2; 290 290 291 - tic_api_print(tic, name, x + MAIN_OFFSET, ym + 1, tic_color_0, false, 1, false); 292 - tic_api_print(tic, name, x + MAIN_OFFSET, ym, tic_color_12, false, 1, false); 291 + if (ym > (-(TIC_FONT_HEIGHT + 1)) && ym <= TIC80_HEIGHT) { 292 + tic_api_print(tic, name, x + MAIN_OFFSET, ym + 1, tic_color_0, false, 1, false); 293 + tic_api_print(tic, name, x + MAIN_OFFSET, ym, tic_color_12, false, 1, false); 294 + } 293 295 } 294 296 } 295 297
+17 -1
src/tic.c
··· 278 278 } 279 279 280 280 281 + #define EARLY_CLIP(x, y, width, height) \ 282 + ( \ 283 + (((y)+(height)-1) < machine->state.clip.t) \ 284 + || (((x)+(width)-1) < machine->state.clip.l) \ 285 + || ((y) >= machine->state.clip.b) \ 286 + || ((x) >= machine->state.clip.r) \ 287 + ) 288 + 281 289 static void drawHLine(tic_machine* machine, s32 x, s32 y, s32 width, u8 color) 282 290 { 283 291 if(y < machine->state.clip.t || machine->state.clip.b <= y) return; 292 + 284 293 s32 xl = MAX(x, machine->state.clip.l); 285 294 s32 xr = MIN(x + width, machine->state.clip.r); 295 + 286 296 machine->state.drawhline(&machine->memory, xl, xr, y, color); 287 297 } 288 298 289 299 static void drawVLine(tic_machine* machine, s32 x, s32 y, s32 height, u8 color) 290 300 { 291 - if(x < 0 || x >= TIC80_WIDTH) return; 301 + if(x < machine->state.clip.l || machine->state.clip.r <= x) return; 292 302 293 303 s32 yl = y < 0 ? 0 : y; 294 304 s32 yr = y + height >= TIC80_HEIGHT ? TIC80_HEIGHT : y + height; ··· 360 370 } 361 371 return; 362 372 } 373 + 374 + if (EARLY_CLIP(x, y, TIC_SPRITESIZE * scale, TIC_SPRITESIZE * scale)) return; 363 375 364 376 for(s32 py=0; py < TIC_SPRITESIZE; py++, y+=scale) 365 377 { ··· 395 407 396 408 const tic_flip vert_horz_flip = tic_horz_flip | tic_vert_flip; 397 409 410 + if (EARLY_CLIP(x, y, w * step, h * step)) return; 411 + 398 412 for(s32 i = 0; i < w; i++) 399 413 { 400 414 for(s32 j = 0; j < h; j++) ··· 481 495 } 482 496 } 483 497 s32 width = end - start; 498 + 499 + if (EARLY_CLIP(x, y, Size * scale, Size * scale)) return width; 484 500 485 501 s32 colStart = start, colStep = 1, rowStart = 0 , rowStep = 1; 486 502