graphics: subregions

This commit is contained in:
K. Lange 2018-11-28 20:39:57 +09:00
parent 623b19d865
commit 6fb381247a
2 changed files with 17 additions and 0 deletions

View File

@ -126,5 +126,6 @@ struct gradient_definition {
extern uint32_t gfx_vertical_gradient_pattern(int32_t x, int32_t y, double alpha, void * extra);
extern gfx_context_t * init_graphics_subregion(gfx_context_t * base, int x, int y, int width, int height);
_End_C_Header

View File

@ -128,6 +128,22 @@ gfx_context_t * init_graphics_fullscreen_double_buffer() {
return out;
}
gfx_context_t * init_graphics_subregion(gfx_context_t * base, int x, int y, int width, int height) {
gfx_context_t * out = malloc(sizeof(gfx_context_t));
out->clips = NULL;
out->depth = 32;
out->width = width;
out->height = height;
out->stride = base->stride;
out->backbuffer = base->buffer + (base->stride * y) + x * 4;
out->buffer = base->buffer + (base->stride * y) + x * 4;
out->size = 0; /* don't allow flip or clear operations */
return out;
}
void reinit_graphics_fullscreen(gfx_context_t * out) {
ioctl(framebuffer_fd, IO_VID_WIDTH, &out->width);