libdragon
libdragon copied to clipboard
vi_move_output() not working as documented + some vi_* bikeshedding
The x/y parameters of vi_move_output() are never used. I belive the function should be something like this:
void vi_move_output(int x, int y)
{
int x0, y0, x1, y1;
__get_output(&x0, &y0, &x1, &y1);
int w = x1 - x0, h = y1 - y0;
vi_write_begin();
vi_set_output(x, y, x + w, y + h);
vi_write_end();
}
And just my 2cents: The vi_move_output(), vi_scroll_output(), vi_*_borders() functions are IMHO not that useful and/or maybe not the right abstraction.
For reference, my VI options screen just looks like this:
So I'd rather have a function that sets the offset position and scale from the default.
struct {
int x0, y0, x1, y1;
} vi_pos;
void render_init(void) {
// display_init(...);
vi_get_output(&vi_pos.x0, &vi_pos.y0, &vi_pos.x1, &vi_pos.y1);
}
void render_set_output(int x, int y, int sx, int sy) {
int x0 = vi_pos.x0 + x - sx;
int y0 = vi_pos.y0 + y - sy;
int x1 = vi_pos.x1 + x + sx;
int y1 = vi_pos.y1 + y + sy;
vi_set_output(x0, y0, x1, y1);
}
This way, render_set_output(0, 0, 0, 0) does nothing (great!) and everything else is based on the default. This was trivial to implement on top of the API, but IMHO it would be the right convenience API inside libdragon.