this repo has no description
0
fork

Configure Feed

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

#509: check cursor bounds

nesbox d3dd567e d07ad7fd

+10 -9
+10 -9
src/studio/studio.c
··· 1957 1957 const tic_palette* pal = &bank->palette.scn; 1958 1958 const tic_tile* tile = &bank->sprites.data[tic->ram.vram.vars.cursor.sprite]; 1959 1959 1960 - u32 *dst = tic->screen + (m->x - hot.x) + (m->y - hot.y) * TIC80_FULLWIDTH, 1961 - *end = tic->screen + TIC80_FULLWIDTH * TIC80_FULLHEIGHT; 1960 + tic_point s = {m->x - hot.x, m->y - hot.y}; 1961 + u32* dst = tic->screen + TIC80_FULLWIDTH * s.y + s.x; 1962 1962 1963 - for(s32 src = 0; src != TIC_SPRITESIZE * TIC_SPRITESIZE; dst += TIC80_FULLWIDTH - TIC_SPRITESIZE) 1964 - for(s32 i = 0; i != TIC_SPRITESIZE; ++i, ++dst) 1965 - { 1966 - u8 c = tic_tool_peek4(tile->data, src++); 1967 - if(dst < end && c) 1968 - *dst = tic_rgba(&pal->colors[c]); 1969 - } 1963 + for(s32 y = s.y, endy = MIN(y + TIC_SPRITESIZE, TIC80_FULLHEIGHT), i = 0; y != endy; ++y, dst += TIC80_FULLWIDTH - TIC_SPRITESIZE) 1964 + for(s32 x = s.x, endx = x + TIC_SPRITESIZE; x != endx; ++x, ++i, ++dst) 1965 + if(x < TIC80_FULLWIDTH) 1966 + { 1967 + u8 c = tic_tool_peek4(tile->data, i); 1968 + if(c) 1969 + *dst = tic_rgba(&pal->colors[c]); 1970 + } 1970 1971 } 1971 1972 } 1972 1973