fb.c File Reference

#include <stdlib.h>
#include <unistd.h>
#include <str.h>
#include <ddi.h>
#include <sysinfo.h>
#include <align.h>
#include <as.h>
#include <ipc/fb.h>
#include <ipc/ns.h>
#include <ipc/services.h>
#include <kernel/errno.h>
#include <kernel/genarch/fb/visuals.h>
#include <io/color.h>
#include <io/style.h>
#include <async.h>
#include <fibril.h>
#include <bool.h>
#include <stdio.h>
#include <byteorder.h>
#include <io/screenbuffer.h>
#include "font-8x16.h"
#include "fb.h"
#include "main.h"
#include "ppm.h"
#include "pointer.xbm"
#include "pointer_mask.xbm"

Go to the source code of this file.

Data Structures

struct  animation_t
struct  bb_cell_t
 Backbuffer character cell. More...
struct  pixmap_t
struct  viewport_t

Defines

#define BB_POS(vport, col, row)   ((row) * vport->cols + (col))
#define BLUE(x, bits)   (((x) >> (8 - (bits))) & ((1 << (bits)) - 1))
#define COL2X(col)   ((col) * FONT_WIDTH)
#define DEFAULT_BGCOLOR   0xf0f0f0
#define DEFAULT_FGCOLOR   0x000000
#define FB_POS(x, y)   ((y) * screen.scanline + (x) * screen.pixelbytes)
#define GLYPH_POS(glyph, y, cursor)   (((glyph) + (cursor) * FONT_GLYPHS) * screen.glyphbytes + (y) * screen.glyphscanline)
#define GLYPH_UNAVAIL   '?'
#define GREEN(x, bits)   (((x) >> (8 + 8 - (bits))) & ((1 << (bits)) - 1))
#define MAX_ANIM_LEN   8
#define MAX_ANIMATIONS   4
#define MAX_PIXMAPS   256
 Maximum number of saved pixmaps.
#define MAX_VIEWPORTS   128
 Viewport is a rectangular area on the screen.
#define RED(x, bits)   (((x) >> (8 + 8 + 8 - (bits))) & ((1 << (bits)) - 1))
#define ROW2Y(row)   ((row) * FONT_SCANLINES)
#define X2COL(x)   ((x) / FONT_WIDTH)
#define Y2ROW(y)   ((y) / FONT_SCANLINES)

Typedefs

typedef void(*) dg_t (unsigned int x, unsigned int y, bool cursor, uint8_t *glyphs, uint32_t glyph, uint32_t fg_color, uint32_t bg_color)
 Function to draw a glyph.
typedef void(*) mask_conv_t (void *, bool)
 Function to render a bit mask.
typedef void(*) rgb_conv_t (void *, uint32_t)
 Function to render a pixel from a RGB value.

Functions

static int anim_handle (ipc_callid_t callid, ipc_call_t *call, int vp)
static void anims_tick (void)
 Tick animation one step forward.
static void backbuf_clear (bb_cell_t *backbuf, size_t len, uint32_t fg_color, uint32_t bg_color)
static void bgr_0888 (void *dst, uint32_t rgb)
static void bgr_323 (void *dst, uint32_t rgb)
static void bgr_888 (void *dst, uint32_t rgb)
static void bgr_8880 (void *dst, uint32_t rgb)
static void copy_vp_to_pixmap (viewport_t *vport, pixmap_t *pmap)
static void cursor_blink (viewport_t *vport)
 Invert cursor, if it is enabled.
static void cursor_hide (viewport_t *vport)
 Hide cursor if it is shown.
static void cursor_show (viewport_t *vport)
 Show cursor if cursor showing is enabled.
static void draw_char (viewport_t *vport, wchar_t c, unsigned int col, unsigned int row)
 Draw character at given position relative to viewport.
static void draw_filled_rect (unsigned int x0, unsigned int y0, unsigned int x1, unsigned int y1, uint32_t color)
 Draw a filled rectangle.
static void draw_glyph_aligned (unsigned int x, unsigned int y, bool cursor, uint8_t *glyphs, uint32_t glyph, uint32_t fg_color, uint32_t bg_color)
 Draw a glyph, takes advantage of alignment.
static void draw_glyph_fallback (unsigned int x, unsigned int y, bool cursor, uint8_t *glyphs, uint32_t glyph, uint32_t fg_color, uint32_t bg_color)
 Draw a glyph, fallback version.
static int draw_pixmap (int vp, int pm)
 Draw pixmap on screen.
static void draw_text_data (viewport_t *vport, keyfield_t *data, unsigned int x, unsigned int y, unsigned int w, unsigned int h)
 Draw text data to viewport.
static void draw_vp_glyph (viewport_t *vport, bool cursor, unsigned int col, unsigned int row)
 Draw glyph at specified position in viewport.
static void fb_client_connection (ipc_callid_t iid, ipc_call_t *icall)
 Function for handling connections to FB.
int fb_init (void)
 Initialization of framebuffer.
static int fb_set_color (viewport_t *vport, sysarg_t fg_color, sysarg_t bg_color, sysarg_t attr)
static int fb_set_style (viewport_t *vport, sysarg_t style)
static int find_free_pixmap (void)
 Return first free pixmap.
static void mask_0888 (void *dst, bool mask)
static void mask_323 (void *dst, bool mask)
static void mask_555 (void *dst, bool mask)
static void mask_565 (void *dst, bool mask)
static void mask_888 (void *dst, bool mask)
static void mask_8880 (void *dst, bool mask)
static void mouse_hide (void)
static void mouse_move (unsigned int x, unsigned int y)
static void mouse_show (void)
static int pixmap_handle (ipc_callid_t callid, ipc_call_t *call, int vp)
 Handler for messages concerning pixmap handling.
static void putpixel (void *data, unsigned int x, unsigned int y, uint32_t color)
static void putpixel_pixmap (void *data, unsigned int x, unsigned int y, uint32_t color)
static void render_glyphs (void)
 Render glyphs.
static void rgb_0888 (void *dst, uint32_t rgb)
static void rgb_555_be (void *dst, uint32_t rgb)
static void rgb_555_le (void *dst, uint32_t rgb)
static void rgb_565_be (void *dst, uint32_t rgb)
static void rgb_565_le (void *dst, uint32_t rgb)
static void rgb_888 (void *dst, uint32_t rgb)
static void rgb_8880 (void *dst, uint32_t rgb)
static int rgb_from_attr (attr_rgb_t *rgb, const attrs_t *a)
static int rgb_from_idx (attr_rgb_t *rgb, sysarg_t fg_color, sysarg_t bg_color, sysarg_t flags)
static int rgb_from_style (attr_rgb_t *rgb, int style)
static int save_vp_to_pixmap (viewport_t *vport)
 Save viewport to pixmap.
static bool screen_init (void *addr, unsigned int xres, unsigned int yres, unsigned int scan, unsigned int visual)
 Initialize framebuffer as a chardev output device.
static int shm2pixmap (unsigned char *shm, size_t size)
 Create a new pixmap and return appropriate ID.
static bool shm_handle (ipc_callid_t callid, ipc_call_t *call, int vp)
 Handle shared memory communication calls.
static void vport_clear (viewport_t *vport)
 Clear viewport.
static int vport_create (unsigned int x, unsigned int y, unsigned int width, unsigned int height)
 Create new viewport.
static void vport_redraw (viewport_t *vport)
 Redraw viewport.
static void vport_scroll (viewport_t *vport, int lines)
 Scroll viewport by the specified number of lines.

Variables

static animation_t animations [MAX_ANIMATIONS]
static bool anims_enabled
static bool client_connected = false
 Allow only 1 connection.
static uint32_t color_table [16]
static pixmap_t pixmaps [MAX_PIXMAPS]
static bool pointer_enabled
static int pointer_pixmap = -1
static bool pointer_shown
static int pointer_vport = -1
static unsigned int pointer_x
static unsigned int pointer_y
static viewport_t viewports [128]


Detailed Description

Definition in file fb.c.


Variable Documentation

uint8_t* glyphs

Pre-rendered mask for rendering glyphs.

Specific for the visual.

Definition at line 103 of file fb.c.


Generated on Thu Jun 2 07:45:55 2011 for HelenOS/USB by  doxygen 1.4.7