Ignore:
Timestamp:
2010-04-23T21:42:26Z (14 years ago)
Author:
Jiri Svoboda <jiri@…>
Branches:
lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
Children:
6c39a907
Parents:
38aaacc2 (diff), 80badbe (diff)
Note: this is a merge changeset, the changes displayed below correspond to the merge itself.
Use the (diff) links above to see all the changes relative to each parent.
Message:

Merge mainline changes.

File:
1 moved

Legend:

Unmodified
Added
Removed
  • uspace/lib/c/include/io/screenbuffer.h

    r38aaacc2 rf4f866c  
    3333 */
    3434
    35 #ifndef SCREENBUFFER_H__
    36 #define SCREENBUFFER_H__
     35#ifndef LIBC_SCREENBUFFER_H__
     36#define LIBC_SCREENBUFFER_H__
    3737
    3838#include <stdint.h>
    3939#include <sys/types.h>
     40#include <ipc/ipc.h>
    4041#include <bool.h>
    4142
    42 #define DEFAULT_FOREGROUND  0x0       /**< default console foreground color */
    43 #define DEFAULT_BACKGROUND  0xf0f0f0  /**< default console background color */
     43typedef enum {
     44        at_style,
     45        at_idx,
     46        at_rgb
     47} attr_type_t;
    4448
    4549typedef struct {
     
    5862} attr_rgb_t;
    5963
     64typedef union {
     65        attr_style_t s;
     66        attr_idx_t i;
     67        attr_rgb_t r;
     68} attr_val_t;
     69
    6070typedef struct {
    61         enum {
    62                 at_style,
    63                 at_idx,
    64                 at_rgb
    65         } t;
    66         union {
    67                 attr_style_t s;
    68                 attr_idx_t i;
    69                 attr_rgb_t r;
    70         } a;
     71        attr_type_t t;
     72        attr_val_t a;
    7173} attrs_t;
    7274
     
    8284        keyfield_t *buffer;      /**< Screen content - characters and
    8385                                      their attributes (used as a circular buffer) */
    84         size_t size_x;           /**< Number of columns  */
    85         size_t size_y;           /**< Number of rows */
     86        ipcarg_t size_x;         /**< Number of columns  */
     87        ipcarg_t size_y;         /**< Number of rows */
    8688       
    8789        /** Coordinates of last printed character for determining cursor position */
    88         size_t position_x;
    89         size_t position_y;
     90        ipcarg_t position_x;
     91        ipcarg_t position_y;
    9092       
    9193        attrs_t attrs;           /**< Current attributes. */
     
    107109 *
    108110 */
    109 static inline keyfield_t *get_field_at(screenbuffer_t *scr, size_t x, size_t y)
     111static inline keyfield_t *get_field_at(screenbuffer_t *scr, ipcarg_t x, ipcarg_t y)
    110112{
    111113        return scr->buffer + x + ((y + scr->top_line) % scr->size_y) * scr->size_x;
     
    120122 *
    121123 */
    122 static inline int attrs_same(attrs_t a1, attrs_t a2)
     124static inline bool attrs_same(attrs_t a1, attrs_t a2)
    123125{
    124126        if (a1.t != a2.t)
    125                 return 0;
     127                return false;
    126128       
    127129        switch (a1.t) {
     
    137139        }
    138140       
    139         return 0;
     141        return false;
    140142}
    141143
     144extern void screenbuffer_putchar(screenbuffer_t *, wchar_t);
     145extern screenbuffer_t *screenbuffer_init(screenbuffer_t *, ipcarg_t, ipcarg_t);
    142146
    143 void screenbuffer_putchar(screenbuffer_t *scr, wchar_t c);
    144 screenbuffer_t *screenbuffer_init(screenbuffer_t *scr, size_t size_x, size_t size_y);
    145 
    146 void screenbuffer_clear(screenbuffer_t *scr);
    147 void screenbuffer_clear_line(screenbuffer_t *scr, size_t line);
    148 void screenbuffer_copy_buffer(screenbuffer_t *scr, keyfield_t *dest);
    149 void screenbuffer_goto(screenbuffer_t *scr, size_t x, size_t y);
    150 void screenbuffer_set_style(screenbuffer_t *scr, uint8_t style);
    151 void screenbuffer_set_color(screenbuffer_t *scr, uint8_t fg_color,
    152     uint8_t bg_color, uint8_t attr);
    153 void screenbuffer_set_rgb_color(screenbuffer_t *scr, uint32_t fg_color,
    154     uint32_t bg_color);
     147extern void screenbuffer_clear(screenbuffer_t *);
     148extern void screenbuffer_clear_line(screenbuffer_t *, ipcarg_t);
     149extern void screenbuffer_copy_buffer(screenbuffer_t *, keyfield_t *);
     150extern void screenbuffer_goto(screenbuffer_t *, ipcarg_t, ipcarg_t);
     151extern void screenbuffer_set_style(screenbuffer_t *, uint8_t);
     152extern void screenbuffer_set_color(screenbuffer_t *, uint8_t, uint8_t, uint8_t);
     153extern void screenbuffer_set_rgb_color(screenbuffer_t *, uint32_t, uint32_t);
    155154
    156155#endif
Note: See TracChangeset for help on using the changeset viewer.