From: Joshua Wise Date: Sun, 14 Dec 2008 01:02:58 +0000 (-0500) Subject: Link text into copy_pixels. X-Git-Url: http://git.joshuawise.com/netwatch.git/commitdiff_plain/66cd7e8220e0f7dbb0e43f44f6aab60194548ad0?ds=inline Link text into copy_pixels. --- diff --git a/aseg-paging/Makefile b/aseg-paging/Makefile index 1eeee83..6c0cd76 100644 --- a/aseg-paging/Makefile +++ b/aseg-paging/Makefile @@ -46,7 +46,7 @@ OBJS = ../ich2/smi.o \ ../net/rfb.o \ ../video/tnt2.o \ ../video/fb.o \ - ../video/checksumrect.o \ + ../video/generic.o \ ../video/text.o \ drivers.o \ ../lib/minilib.o \ diff --git a/include/fb.h b/include/fb.h index dd86894..79f05b5 100644 --- a/include/fb.h +++ b/include/fb.h @@ -12,6 +12,7 @@ typedef enum { typedef void (*getvmode_t)(void *); typedef uint32_t (*checksum_rect_t)(int x, int y, int width, int height); +typedef void (*copy_pixels_t)(char *buf, int x, int y, int width, int height); struct vmode { int text:1; @@ -25,6 +26,7 @@ struct fbdevice { void *priv; getvmode_t getvmode; checksum_rect_t checksum_rect; + copy_pixels_t copy_pixels; struct vmode curmode; }; diff --git a/include/text.h b/include/text.h index 9506d40..474e123 100644 --- a/include/text.h +++ b/include/text.h @@ -3,7 +3,7 @@ #include extern void text_init(); -extern void text_render(unsigned char *buf, unsigned int x, unsigned int y, unsigned int w, unsigned int h); +extern void text_render(char *buf, int x, int y, int w, int h); extern uint32_t text_checksum(int x, int y, int w, int h); #endif diff --git a/video/checksumrect.c b/video/generic.c similarity index 63% rename from video/checksumrect.c rename to video/generic.c index f96c033..6168df2 100644 --- a/video/checksumrect.c +++ b/video/generic.c @@ -24,3 +24,16 @@ uint32_t checksum_rect_generic32(int x, int y, int width, int height) { return sum; } +void copy_pixels_generic32(char *buf, int x, int y, int width, int height) +{ + int cx, cy; + unsigned int *ibuf = (unsigned int *)buf; + unsigned int *fbuf; + for (cy = y; cy < (y + height); cy++) + { + fbuf = (unsigned int *)fb->fbaddr; + fbuf += y * (fb->curmode.xres) + x; + for (cx = x; cx < (x + width); cx++) + *(ibuf++) = *(fbuf++); + } +} diff --git a/video/checksumrect.h b/video/generic.h similarity index 63% rename from video/checksumrect.h rename to video/generic.h index 8dd2a6d..64f2b5f 100644 --- a/video/checksumrect.h +++ b/video/generic.h @@ -2,5 +2,6 @@ #define _CHECKSUM_RECT_H uint32_t checksum_rect_generic32(int x, int y, int width, int height); +void copy_pixels_generic32(char *buf, int x, int y, int width, int height); #endif diff --git a/video/text.c b/video/text.c index c9068b9..7197bad 100644 --- a/video/text.c +++ b/video/text.c @@ -20,7 +20,7 @@ void text_init() outb(0x3CF, oldread); } -void text_render(unsigned char *buf, unsigned int x, unsigned int y, unsigned int w, unsigned int h) +void text_render(char *buf, int x, int y, int w, int h) { unsigned char *video = p2v(0xB8000); unsigned int textx = x / 9; @@ -58,6 +58,7 @@ void text_render(unsigned char *buf, unsigned int x, unsigned int y, unsigned in *(buf++) = (at & 0x20) ? 0xFF : 0x00; *(buf++) = (at & 0x40) ? 0xFF : 0x00; } + *(buf++) = 0; } } } diff --git a/video/tnt2.c b/video/tnt2.c index f23a9d7..3827393 100644 --- a/video/tnt2.c +++ b/video/tnt2.c @@ -6,7 +6,7 @@ #include #include -#include "checksumrect.h" +#include "generic.h" static void tnt2_getvmode(void *priv); @@ -31,14 +31,17 @@ static void tnt2_getvmode(void *priv) tnt2_fb.curmode.bytestride = 4; tnt2_fb.curmode.text = 0; tnt2_fb.checksum_rect = checksum_rect_generic32; + tnt2_fb.copy_pixels = copy_pixels_generic32; break; case 0: tnt2_fb.curmode.text = 1; - tnt2_fb.checksum_rect = (checksum_rect_t) text_checksum; + tnt2_fb.checksum_rect = text_checksum; + tnt2_fb.copy_pixels = text_render; break; default: tnt2_fb.curmode.text = 1; - tnt2_fb.checksum_rect = (checksum_rect_t) text_checksum; + tnt2_fb.checksum_rect = text_checksum; + tnt2_fb.copy_pixels = text_render; outputf("Unknown TNT2 format %x", vgard(0x28)); break; }