Voxia OS v0.0.1
Hobby Project Operating System Targeting x86-64
Loading...
Searching...
No Matches
graphic.c File Reference
#include "graphic.h"
#include "framebuffer.h"
#include "hal/cpu/paging.h"
#include "init/init.h"
#include "libk/debug/debug.h"
#include "memory/entry.h"
#include "memory/memory_utils.h"
#include "memory/vm_manager.h"
#include "str.h"
#include "type.h"
#include "vfs/enum.h"
#include <libk/serial.h>
#include <memory/kalloc.h>
#include <libk/ssfn.h>

Go to the source code of this file.

Macros

#define _STRING_H_
 
#define SSFN_memcmp   memcmp
 
#define SSFN_memset   ssfn_memset
 
#define SSFN_memcpy   ssfn_memcpy
 
#define SSFN_realloc   ssfn_realloc
 
#define SSFN_free   ssfn_free_
 
#define SSFN_IMPLEMENTATION
 

Functions

static void * ssfn_memset (void *__s, int __c, size_t __n)
 
static void * ssfn_memcpy (void *__restrict__ __dest, const void *__restrict__ __src, size_t __n)
 
static void * ssfn_realloc (void *ptr, size_t new_size)
 
static void ssfn_free_ (void *ptr)
 
 INIT (graphic)
 
void putc (char c, int col, int row, uint32_t fg, uint32_t bg)
 
void putc_utf8 (const char *s, int col, int row, uint32_t fg, uint32_t bg)
 
int utf8_char_len (uint8_t c)
 
void put_pixel (int x, int y, uint32_t color)
 
static __inline__ uint8_t blend (uint8_t src, uint8_t d, uint8_t a)
 
void put_pixel_alpha (int x, int y, pixel_t src)
 
void put_pixel_alpha_fast (int x, int y, pixel_t src)
 
void clear_screen (uint32_t color)
 
 __attribute__ ((unused))
 
uint32_t vxGetWidth (void)
 
uint32_t vxGetHeight (void)
 
void vxScroll (int px)
 
uint32_t screen_cols (void)
 
uint32_t screen_rows (void)
 
void fill_rect (int x, int y, int w, int h, uint32_t color)
 

Variables

volatile framebuffer_tg__fb
 
static ssfn_buf_t dst
 
static ssfn_t ssfn_ctx = {0}
 
static boolean_t ssfn_ready = 0
 

Macro Definition Documentation

◆ _STRING_H_

#define _STRING_H_

Definition at line 17 of file graphic.c.

◆ SSFN_free

#define SSFN_free   ssfn_free_

Definition at line 73 of file graphic.c.

◆ SSFN_IMPLEMENTATION

#define SSFN_IMPLEMENTATION

Definition at line 75 of file graphic.c.

◆ SSFN_memcmp

#define SSFN_memcmp   memcmp

Definition at line 19 of file graphic.c.

◆ SSFN_memcpy

#define SSFN_memcpy   ssfn_memcpy

Definition at line 29 of file graphic.c.

◆ SSFN_memset

#define SSFN_memset   ssfn_memset

Definition at line 21 of file graphic.c.

◆ SSFN_realloc

#define SSFN_realloc   ssfn_realloc

Definition at line 72 of file graphic.c.

Function Documentation

◆ __attribute__()

__attribute__ ( (unused) )

Definition at line 295 of file graphic.c.

References g__fb, memcopy(), put_pixel(), x, and y.

◆ blend()

static __inline__ uint8_t blend ( uint8_t src,
uint8_t d,
uint8_t a )
static

Definition at line 201 of file graphic.c.

Referenced by put_pixel_alpha().

◆ clear_screen()

void clear_screen ( uint32_t color)

Definition at line 290 of file graphic.c.

References g__fb, and memset().

Referenced by start_tty().

◆ fill_rect()

void fill_rect ( int x,
int y,
int w,
int h,
uint32_t color )

Definition at line 340 of file graphic.c.

References dst, g__fb, h, x, and y.

◆ INIT()

◆ put_pixel()

void put_pixel ( int x,
int y,
uint32_t color )

Definition at line 192 of file graphic.c.

References pixel_t::a, pixel_t::b, pixel_t::g, g__fb, pixel_t::r, x, and y.

Referenced by __attribute__().

◆ put_pixel_alpha()

void put_pixel_alpha ( int x,
int y,
pixel_t src )

Definition at line 207 of file graphic.c.

References pixel_t::a, pixel_t::b, blend(), pixel_t::g, g__fb, PTR_ADD, pixel_t::r, x, and y.

◆ put_pixel_alpha_fast()

void put_pixel_alpha_fast ( int x,
int y,
pixel_t src )

Definition at line 259 of file graphic.c.

References pixel_t::a, pixel_t::b, pixel_t::g, g__fb, pixel_t::r, x, and y.

◆ putc()

void putc ( char c,
int col,
int row,
uint32_t fg,
uint32_t bg )

Definition at line 151 of file graphic.c.

References dst, FONT_SIZE, serial2_printf(), ssfn_ctx, ssfn_ready, ssfn_render(), and str().

Referenced by put_char_raw(), and tty_check_and_flush().

◆ putc_utf8()

void putc_utf8 ( const char * s,
int col,
int row,
uint32_t fg,
uint32_t bg )

Definition at line 166 of file graphic.c.

References dst, FONT_SIZE, serial2_printf(), ssfn_ctx, ssfn_ready, and ssfn_render().

Referenced by tty_check_and_flush().

◆ screen_cols()

uint32_t screen_cols ( void )

Definition at line 327 of file graphic.c.

References FONT_SIZE, and vxGetWidth().

Referenced by advance_cursor(), and configure_tty().

◆ screen_rows()

uint32_t screen_rows ( void )

Definition at line 333 of file graphic.c.

References FONT_SIZE, h, and vxGetHeight().

Referenced by advance_cursor(), configure_tty(), do_scroll(), and put_char_raw().

◆ ssfn_free_()

static void ssfn_free_ ( void * ptr)
static

Definition at line 67 of file graphic.c.

References kfree2(), and ptr.

◆ ssfn_memcpy()

static void * ssfn_memcpy ( void *__restrict__ __dest,
const void *__restrict__ __src,
size_t __n )
static

Definition at line 30 of file graphic.c.

Referenced by ssfn_realloc(), and vxScroll().

◆ ssfn_memset()

static void * ssfn_memset ( void * __s,
int __c,
size_t __n )
static

Definition at line 22 of file graphic.c.

Referenced by vxScroll().

◆ ssfn_realloc()

static void * ssfn_realloc ( void * ptr,
size_t new_size )
static

Definition at line 41 of file graphic.c.

References kalloc(), KALLOC_REDZONE_SIZE, kfree2(), NULL, ptr, kalloc_metadata_t::size, and ssfn_memcpy().

◆ utf8_char_len()

int utf8_char_len ( uint8_t c)

Definition at line 180 of file graphic.c.

Referenced by tty_check_and_flush().

◆ vxGetHeight()

uint32_t vxGetHeight ( void )

Definition at line 316 of file graphic.c.

References dst.

Referenced by char_ioctl(), and screen_rows().

◆ vxGetWidth()

uint32_t vxGetWidth ( void )

Definition at line 315 of file graphic.c.

References dst.

Referenced by char_ioctl(), and screen_cols().

◆ vxScroll()

void vxScroll ( int px)

Definition at line 318 of file graphic.c.

References dst, ssfn_memcpy(), and ssfn_memset().

Referenced by do_scroll(), and do_scroll().

Variable Documentation

◆ dst

◆ g__fb

volatile framebuffer_t* g__fb

◆ ssfn_ctx

ssfn_t ssfn_ctx = {0}
static

Definition at line 83 of file graphic.c.

Referenced by INIT(), putc(), and putc_utf8().

◆ ssfn_ready

boolean_t ssfn_ready = 0
static

Definition at line 85 of file graphic.c.

Referenced by INIT(), putc(), and putc_utf8().