3 ms·
Q1 Rectangle copy. Needs to know if overlapping ranges and/or NULL pointers need to be handled. It can be reduced to FromMaxY-FromMinY+1 memcpy()'s and some poi
by burnt-resistor 5mo ago
Q1 Rectangle copy. Needs to know if overlapping ranges and/or NULL pointers need to be handled. It can be reduced to FromMaxY-FromMinY+1 memcpy()'s and some pointer math using strength reduction to replace unnecessary multiplies with adds.
Q2 String copy. Also needs to know if overlapping ranges and/or NULL pointers need to be handled. Must assume ASCIIZ in src. (DOS also had $-terminated strings and Pascal had length & pointer strings.) Pretty easy.
Q3 Flood fill. Keep filling towards either end of the current scanline while the pixel value is the same. Look up and down one scanline with the same width as the filled segment for additional scanline segments that are the same, and recursively begin the algorithm again for each.
Q4 Circle draw. IIRC needs a trig data table to avoid floating point. The current x position needs to be tracked and for each line in y, the length of the current line part to advance x needs to be calculated. Calculate one quarter of the circle and replicate it to all 4 quadrants. I believe the fairest circle rasterization calculation is to subtract half of a pixel width from the radius so that drawing relates to the center of pixels.