From 66cd7e8220e0f7dbb0e43f44f6aab60194548ad0 Mon Sep 17 00:00:00 2001 From: Joshua Wise Date: Sat, 13 Dec 2008 20:02:58 -0500 Subject: [PATCH] Link text into copy_pixels. --- aseg-paging/Makefile | 2 +- include/fb.h | 2 ++ include/text.h | 2 +- video/{checksumrect.c => generic.c} | 13 +++++++++++++ video/{checksumrect.h => generic.h} | 1 + video/text.c | 3 ++- video/tnt2.c | 9 ++++++--- 7 files changed, 26 insertions(+), 6 deletions(-) rename video/{checksumrect.c => generic.c} (63%) rename video/{checksumrect.h => generic.h} (63%) 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; } -- 2.39.2