unittester: Finish implementing 0x01 "Capture Screen Snapshot"
And it's looking like the overscan bounds and offset calculation will need to be correct. Otherwise, things will break. Let's see what happens when I get command 0x02 working...
This commit is contained in:
@@ -101,8 +101,6 @@ This is an easy way to reset the status to 0x04 (no command in flight, not waiti
|
||||
|
||||
### 0x01: Capture Screen Snapshot
|
||||
|
||||
**TODO: IMPLEMENT ME!**
|
||||
|
||||
Captures a snapshot of the current screen state and stores it in the current snapshot buffer.
|
||||
|
||||
The initial state of the screen snapshot buffer has an image area of 0x0, an overscanned area of 0x0, and an image start offset of (0,0).
|
||||
|
@@ -248,7 +248,7 @@ unittester_write(uint16_t port, uint8_t val, UNUSED(void *priv))
|
||||
/* Monitor disabled - clear snapshot */
|
||||
unittester.snap_monitor = 0x00;
|
||||
} else {
|
||||
/* Capture snapshot from monitor */
|
||||
/* Compute bounds for snapshot */
|
||||
const monitor_t *m = &monitors[unittester.snap_monitor - 1];
|
||||
unittester.snap_img_width = m->mon_xsize;
|
||||
unittester.snap_img_height = m->mon_ysize;
|
||||
@@ -256,7 +256,12 @@ unittester_write(uint16_t port, uint8_t val, UNUSED(void *priv))
|
||||
unittester.snap_overscan_height = m->mon_ysize + m->mon_overscan_y;
|
||||
unittester.snap_img_xoffs = (m->mon_overscan_x >> 1);
|
||||
unittester.snap_img_yoffs = (m->mon_overscan_y >> 1);
|
||||
/* TODO: Actually take snapshot! --GM */
|
||||
/* Take snapshot */
|
||||
for (size_t y = 0; y < unittester.snap_img_height; y++) {
|
||||
for (size_t x = 0; x < unittester.snap_img_width; x++) {
|
||||
unittester_screen_buffer->line[y][x] = m->target_buffer->line[y][x];
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/* We have 12 bytes to read. */
|
||||
|
Reference in New Issue
Block a user