1
0
mirror of git://projects.qi-hardware.com/ben-blinkenlights.git synced 2025-04-21 12:27:27 +03:00

ubb-vga2: non-contiguous allocation of frame buffer memory

- ubb-vga.h (calloc_phys_vec), physmem.c: non-contiguous memory allocator
  (for now, without really considering any mapping to physical memory)
- Makefile (OBJS): added physmem.o
- ubb-vga.h (grabfb), grabfb.c (grabfb): API change for non-contiguous
  frame buffer
- ubb-vga.h (ppmimg), ppmimg.c (convert, ppmimg): API change for
  non-contiguous frame buffer
- ubb-vga.h (tstimg), tstimg.c (pixel, color_bars, grill, grid, sides,
  dot, line45, arc, printc, text, ctext, tstimg): API change for
  non-contiguous frame buffer
- tstimg.c (tstimg): we no longer need to clear the frame buffer
- ubb-vga.c (frame, session, main): use a vector of line buffers instead
  of a contiguous frame buffer
This commit is contained in:
Werner Almesberger
2011-04-29 13:04:02 -03:00
parent 71c9c7dd78
commit 623f3ccbe3
7 changed files with 77 additions and 39 deletions

View File

@@ -40,11 +40,11 @@
#define WHITE 0xf
static void pixel(void *f, int xres, int x, int y, uint8_t c)
static void pixel(void **f, int xres, int x, int y, uint8_t c)
{
uint8_t *p;
p = f+((y*xres+x) >> 1);
p = f[y]+(x >> 1);
if (x & 1)
*p = (*p & 0xf0) | c;
else
@@ -61,7 +61,7 @@ static void pixel(void *f, int xres, int x, int y, uint8_t c)
#define CBAR_Y1 0.75
static void color_bars(void *f, int xres, int yres, ...)
static void color_bars(void **f, int xres, int yres, ...)
{
int i, x, y;
uint8_t c;
@@ -81,7 +81,7 @@ static void color_bars(void *f, int xres, int yres, ...)
#define GRID 50
static void grill(void *f, int ares, int bres, int swap)
static void grill(void **f, int ares, int bres, int swap)
{
int n, o;
int i, a, b;
@@ -119,7 +119,7 @@ static void grill(void *f, int ares, int bres, int swap)
}
static void grid(void *f, int xres, int yres)
static void grid(void **f, int xres, int yres)
{
grill(f, xres, yres, 0);
grill(f, yres, xres, 1);
@@ -129,7 +129,7 @@ static void grid(void *f, int xres, int yres)
/* ----- Diagonal lines meeting at the sides ------------------------------- */
static void sides(void *f, int xres, int yres)
static void sides(void **f, int xres, int yres)
{
int i;
@@ -151,7 +151,7 @@ static void sides(void *f, int xres, int yres)
/* ----- Text -------------------------------------------------------------- */
static void dot(void *f, int xres, int x, int y, int color, int side)
static void dot(void **f, int xres, int x, int y, int color, int side)
{
int xi, yi;
@@ -161,7 +161,7 @@ static void dot(void *f, int xres, int x, int y, int color, int side)
}
static void line45(void *f, int xres, int x, int y, int dx, int dy, int n,
static void line45(void **f, int xres, int x, int y, int dx, int dy, int n,
uint8_t color, int side)
{
while (n--) {
@@ -173,7 +173,7 @@ static void line45(void *f, int xres, int x, int y, int dx, int dy, int n,
}
static void arc(void *f, int xres, int x, int y, int n, int q,
static void arc(void **f, int xres, int x, int y, int n, int q,
uint8_t color, int side)
{
int dx, dy;
@@ -192,7 +192,7 @@ static void arc(void *f, int xres, int x, int y, int n, int q,
}
static void printc(void *f, int xres, int x, int y, char c, int n,
static void printc(void **f, int xres, int x, int y, char c, int n,
uint8_t color, int side)
{
switch (c) {
@@ -299,7 +299,7 @@ static void printc(void *f, int xres, int x, int y, char c, int n,
}
static void text(void *f, int xres, int x, int y, const char *s, int n,
static void text(void **f, int xres, int x, int y, const char *s, int n,
uint8_t color, int side)
{
while (*s) {
@@ -311,7 +311,7 @@ static void text(void *f, int xres, int x, int y, const char *s, int n,
static void ctext(void *f, int xres, int x, int y, const char *s, int n,
static void ctext(void **f, int xres, int x, int y, const char *s, int n,
uint8_t color, int side)
{
text(f, xres, x+n*(1-3*(int) strlen(s))/2, y-2*n, s, n, color, side);
@@ -321,11 +321,10 @@ static void ctext(void *f, int xres, int x, int y, const char *s, int n,
/* ----- Generate the test image ------------------------------------------- */
void tstimg(void *f, int xres, int yres)
void tstimg(void **f, int xres, int yres)
{
char buf[20];
memset(f, 0, xres*yres/2);
grid(f, xres, yres);
sides(f, xres, yres);
color_bars(f, xres, yres);