From 752ff17265f23d4fa9084368d2a90f66521a98e2 Mon Sep 17 00:00:00 2001 From: Andreas Baumann Date: Sat, 22 Jul 2017 16:14:14 +0200 Subject: separated video driver in a virtual video driver and a specific VGA video driver --- src/drivers/video/video.h | 28 ++++++++++++++++++++++------ 1 file changed, 22 insertions(+), 6 deletions(-) (limited to 'src/drivers/video/video.h') diff --git a/src/drivers/video/video.h b/src/drivers/video/video.h index 6da8e60..8cfebb3 100644 --- a/src/drivers/video/video.h +++ b/src/drivers/video/video.h @@ -23,14 +23,28 @@ typedef struct { driver_t base; unsigned int nof_modes; const video_mode_t *modes[MAX_NOF_VIDEO_MODES]; + const video_mode_t *mode; } video_t; +typedef struct { + int R; + int G; + int B; +} video_rgb_color_t; + typedef struct { driver_vtable_t base; void (*register_mode)( void *obj, const video_mode_t *mode ); bool (*supports_mode)( void *obj, const video_mode_t mode ); bool (*set_mode)( void *obj, const video_mode_t mode ); bool (*switch_mode)( void *obj, const video_mode_t *mode ); + void (*set_pixel)( void *obj, const int x, const int y, const video_rgb_color_t color ); + void (*draw_rectangle)( void *obj, const int x, const int y, const int w, const int h, const video_rgb_color_t color ); + void (*clear_screen)( void *obj, const video_rgb_color_t color ); + void (*draw_char)( void *obj, const unsigned char c, const int x, const int y, const video_rgb_color_t background, const video_rgb_color_t foreground ); + void (*wait_for_retrace)( void *obj ); + void (*use_z_buffer)( void *obj, bool use ); + void (*refresh)( void *obj ); } video_vtable_t; void video_init( video_t *video, interrupt_t *interrupt, void *context ); @@ -46,12 +60,6 @@ bool video_supports_mode( void *obj, const video_mode_t mode ); bool video_set_mode( void *obj, const video_mode_t mode ); bool video_switch_mode( void *obj, const video_mode_t *mode ); -typedef struct { - int R; - int G; - int B; -} video_rgb_color_t; - extern const video_rgb_color_t VIDEO_RGB_COLOR_BLACK; extern const video_rgb_color_t VIDEO_RGB_COLOR_BLUE; extern const video_rgb_color_t VIDEO_RGB_COLOR_GREEN; @@ -64,4 +72,12 @@ extern const video_rgb_color_t VIDEO_RGB_COLOR_WHITE; video_rgb_color_t video_make_rgb_color( const int R, const int G, const int B ); +void video_set_pixel( void *obj, const int x, const int y, const video_rgb_color_t color ); +void video_draw_rectangle( void *obj, const int x, const int y, const int w, const int h, const video_rgb_color_t color ); +void video_clear_screen( void *obj, const video_rgb_color_t color ); +void video_draw_char( void *obj, const unsigned char c, const int x, const int y, const video_rgb_color_t background, const video_rgb_color_t foreground ); +void video_wait_for_retrace( void *obj ); +void video_use_z_buffer( void *obj, bool use ); +void video_refresh( void *obj ); + #endif // VIDEO_H -- cgit v1.2.3-54-g00ecf