So my Zig based PinePhone OS finally has touch screen working
Now I do some UI stuff to make testing easier. First job, buttons! I have the following code, but it seems slow when I used the same code to clear the screen (visible drawing, maybe .25s). I have no way to time this code on device yet.
I wanted to check if I am exposed to anything like bounds checking when doing it this way, and if so, how to avoid without dropping down to assembly again please.
I hope to also get double buffering working, which should hide drawing artifacts, but I would still like to be optimal on this code path, since next I will need all the other pixel-by-pixel drawing primatives.
Any advice very welcome, thanks.
//defined in linker.ld within .data section: LONG(fb0);
export var fb0 = [_]u32{0x80FF0000} ** (720*1440); //red background to framebuffer
var fgColor:u32 = 0x80FFFFFF; //white
pub fn fillRect(sx:usize, sy:usize, width:usize, height:usize) void {
var x: usize = sx;
var y: usize = sy;
const xLimit: usize = sx+width;
const yLimit: usize = sy+height;
while (y < yLimit) {
x = sx;
while (x < xLimit) {
fb0[(y * windowPitch) + x] = fgColor;
x += 1;
}
y += 1;
}
}