28c28
< * $FreeBSD: head/lib/libvgl/simple.c 50476 1999-08-28 00:22:10Z peter $
---
> * $FreeBSD: head/lib/libvgl/simple.c 53013 1999-11-08 11:37:46Z yokota $
40a41,42
> #define min(x, y) (((x) < (y)) ? (x) : (y))
> #define max(x, y) (((x) > (y)) ? (x) : (y))
42d43
<
45a47,48
> int offset;
>
47c50
< if (x>=0 && x<object->Xsize && y>=0 && y<object->Ysize) {
---
> if (x>=0 && x<object->VXsize && y>=0 && y<object->VYsize) {
52c55
< object->Bitmap[y*object->Xsize+x]=(color);
---
> object->Bitmap[y*object->VXsize+x]=(color);
53a57,59
> case VIDBUF8S:
> object->Bitmap[VGLSetSegment(y*object->VXsize+x)]=(color);
> break;
57c63
< object->Bitmap[(unsigned)(object->Xsize/2*y)+(x/4)] = (color);
---
> object->Bitmap[(unsigned)(VGLAdpInfo.va_line_width*y)+(x/4)] = (color);
58a65,67
> case VIDBUF4S:
> offset = VGLSetSegment(y*VGLAdpInfo.va_line_width + x/8);
> goto set_planar;
60,79c69,75
< outb(0x3c4, 0x02); outb(0x3c5, 0x01);
< outb(0x3ce, 0x04); outb(0x3cf, 0x00);
< object->Bitmap[(y*object->Xsize/8+x/8)&0xffff] =
< ( object->Bitmap[(y*object->Xsize/8+x/8)&0xffff] & ~(0x80>>(x%8)) )
< | ((color & 0x01) ? (0x80>>(x%8)) : 0);
< outb(0x3c4, 0x02); outb(0x3c5, 0x02);
< outb(0x3ce, 0x04); outb(0x3cf, 0x01);
< object->Bitmap[(y*object->Xsize/8+x/8)&0xffff] =
< ( object->Bitmap[(y*object->Xsize/8+x/8)&0xffff] & ~(0x80>>(x%8)) )
< | ((color & 0x02) ? (0x80>>(x%8)) : 0);
< outb(0x3c4, 0x02); outb(0x3c5, 0x04);
< outb(0x3ce, 0x04); outb(0x3cf, 0x02);
< object->Bitmap[(y*object->Xsize/8+x/8)&0xffff] =
< ( object->Bitmap[(y*object->Xsize/8+x/8)&0xffff] & ~(0x80>>(x%8)) )
< | ((color & 0x04) ? (0x80>>(x%8)) : 0);
< outb(0x3c4, 0x02); outb(0x3c5, 0x08);
< outb(0x3ce, 0x04); outb(0x3cf, 0x03);
< object->Bitmap[(y*object->Xsize/8+x/8)&0xffff] =
< ( object->Bitmap[(y*object->Xsize/8+x/8)&0xffff] & ~(0x80>>(x%8)) )
< | ((color & 0x08) ? (0x80>>(x%8)) : 0);
---
> offset = y*VGLAdpInfo.va_line_width + x/8;
> set_planar:
> outb(0x3c4, 0x02); outb(0x3c5, 0x0f);
> outb(0x3ce, 0x00); outb(0x3cf, color & 0x0f); /* set/reset */
> outb(0x3ce, 0x01); outb(0x3cf, 0x0f); /* set/reset enable */
> outb(0x3ce, 0x08); outb(0x3cf, 0x80 >> (x%8)); /* bit mask */
> object->Bitmap[offset] |= color;
88a85,91
> int offset;
> #if 0
> int i;
> byte color;
> byte mask;
> #endif
>
89a93,94
> if (x<0 || x>=object->VXsize || y<0 || y>=object->VYsize)
> return 0;
93,94c98,100
< return object->Bitmap[((y*object->Xsize)+x)];
< break;
---
> return object->Bitmap[((y*object->VXsize)+x)];
> case VIDBUF8S:
> return object->Bitmap[VGLSetSegment(y*object->VXsize+x)];
97,98c103,106
< return object->Bitmap[(unsigned)(object->Xsize/2*y)+(x/4)];
< break;
---
> return object->Bitmap[(unsigned)(VGLAdpInfo.va_line_width*y)+(x/4)];
> case VIDBUF4S:
> offset = VGLSetSegment(y*VGLAdpInfo.va_line_width + x/8);
> goto get_planar;
100,101c108,120
< return (object->Bitmap[((y*object->Xsize/8)+x/8)]&(0x80>>(x%8))) ? 1 : 0;
< break;
---
> offset = y*VGLAdpInfo.va_line_width + x/8;
> get_planar:
> #if 1
> return (object->Bitmap[offset]&(0x80>>(x%8))) ? 1 : 0; /* XXX */
> #else
> color = 0;
> mask = 0x80 >> (x%8);
> for (i = 0; i < VGLModeInfo.vi_planes; i++) {
> outb(0x3ce, 0x04); outb(0x3cf, i);
> color |= (object->Bitmap[offset] & mask) ? (1 << i) : 0;
> }
> return color;
> #endif
236a256,258
> int offset;
> int len;
>
242c264
< memset(object->Bitmap, color, object->Xsize*object->Ysize);
---
> memset(object->Bitmap, color, object->VXsize*object->VYsize);
243a266,276
>
> case VIDBUF8S:
> for (offset = 0; offset < object->VXsize*object->VYsize; ) {
> VGLSetSegment(offset);
> len = min(object->VXsize*object->VYsize - offset,
> VGLAdpInfo.va_window_size);
> memset(object->Bitmap, color, len);
> offset += len;
> }
> break;
>
245a279
> outb(0x3c6, 0xff);
247c281
< memset(object->Bitmap, color, object->Xsize*object->Ysize/4);
---
> memset(object->Bitmap, color, VGLAdpInfo.va_line_width*object->VYsize);
250a285
> case VIDBUF4S:
252c287,298
< memset(object->Bitmap, color, object->Xsize/8*object->Ysize);
---
> outb(0x3c4, 0x02); outb(0x3c5, 0x0f);
> outb(0x3ce, 0x05); outb(0x3cf, 0x02); /* mode 2 */
> outb(0x3ce, 0x01); outb(0x3cf, 0x00); /* set/reset enable */
> outb(0x3ce, 0x08); outb(0x3cf, 0xff); /* bit mask */
> for (offset = 0; offset < VGLAdpInfo.va_line_width*object->VYsize; ) {
> VGLSetSegment(offset);
> len = min(object->VXsize*object->VYsize - offset,
> VGLAdpInfo.va_window_size);
> memset(object->Bitmap, color, len);
> offset += len;
> }
> outb(0x3ce, 0x05); outb(0x3cf, 0x00);
< * $FreeBSD: head/lib/libvgl/simple.c 50476 1999-08-28 00:22:10Z peter $
---
> * $FreeBSD: head/lib/libvgl/simple.c 53013 1999-11-08 11:37:46Z yokota $
40a41,42
> #define min(x, y) (((x) < (y)) ? (x) : (y))
> #define max(x, y) (((x) > (y)) ? (x) : (y))
42d43
<
45a47,48
> int offset;
>
47c50
< if (x>=0 && x<object->Xsize && y>=0 && y<object->Ysize) {
---
> if (x>=0 && x<object->VXsize && y>=0 && y<object->VYsize) {
52c55
< object->Bitmap[y*object->Xsize+x]=(color);
---
> object->Bitmap[y*object->VXsize+x]=(color);
53a57,59
> case VIDBUF8S:
> object->Bitmap[VGLSetSegment(y*object->VXsize+x)]=(color);
> break;
57c63
< object->Bitmap[(unsigned)(object->Xsize/2*y)+(x/4)] = (color);
---
> object->Bitmap[(unsigned)(VGLAdpInfo.va_line_width*y)+(x/4)] = (color);
58a65,67
> case VIDBUF4S:
> offset = VGLSetSegment(y*VGLAdpInfo.va_line_width + x/8);
> goto set_planar;
60,79c69,75
< outb(0x3c4, 0x02); outb(0x3c5, 0x01);
< outb(0x3ce, 0x04); outb(0x3cf, 0x00);
< object->Bitmap[(y*object->Xsize/8+x/8)&0xffff] =
< ( object->Bitmap[(y*object->Xsize/8+x/8)&0xffff] & ~(0x80>>(x%8)) )
< | ((color & 0x01) ? (0x80>>(x%8)) : 0);
< outb(0x3c4, 0x02); outb(0x3c5, 0x02);
< outb(0x3ce, 0x04); outb(0x3cf, 0x01);
< object->Bitmap[(y*object->Xsize/8+x/8)&0xffff] =
< ( object->Bitmap[(y*object->Xsize/8+x/8)&0xffff] & ~(0x80>>(x%8)) )
< | ((color & 0x02) ? (0x80>>(x%8)) : 0);
< outb(0x3c4, 0x02); outb(0x3c5, 0x04);
< outb(0x3ce, 0x04); outb(0x3cf, 0x02);
< object->Bitmap[(y*object->Xsize/8+x/8)&0xffff] =
< ( object->Bitmap[(y*object->Xsize/8+x/8)&0xffff] & ~(0x80>>(x%8)) )
< | ((color & 0x04) ? (0x80>>(x%8)) : 0);
< outb(0x3c4, 0x02); outb(0x3c5, 0x08);
< outb(0x3ce, 0x04); outb(0x3cf, 0x03);
< object->Bitmap[(y*object->Xsize/8+x/8)&0xffff] =
< ( object->Bitmap[(y*object->Xsize/8+x/8)&0xffff] & ~(0x80>>(x%8)) )
< | ((color & 0x08) ? (0x80>>(x%8)) : 0);
---
> offset = y*VGLAdpInfo.va_line_width + x/8;
> set_planar:
> outb(0x3c4, 0x02); outb(0x3c5, 0x0f);
> outb(0x3ce, 0x00); outb(0x3cf, color & 0x0f); /* set/reset */
> outb(0x3ce, 0x01); outb(0x3cf, 0x0f); /* set/reset enable */
> outb(0x3ce, 0x08); outb(0x3cf, 0x80 >> (x%8)); /* bit mask */
> object->Bitmap[offset] |= color;
88a85,91
> int offset;
> #if 0
> int i;
> byte color;
> byte mask;
> #endif
>
89a93,94
> if (x<0 || x>=object->VXsize || y<0 || y>=object->VYsize)
> return 0;
93,94c98,100
< return object->Bitmap[((y*object->Xsize)+x)];
< break;
---
> return object->Bitmap[((y*object->VXsize)+x)];
> case VIDBUF8S:
> return object->Bitmap[VGLSetSegment(y*object->VXsize+x)];
97,98c103,106
< return object->Bitmap[(unsigned)(object->Xsize/2*y)+(x/4)];
< break;
---
> return object->Bitmap[(unsigned)(VGLAdpInfo.va_line_width*y)+(x/4)];
> case VIDBUF4S:
> offset = VGLSetSegment(y*VGLAdpInfo.va_line_width + x/8);
> goto get_planar;
100,101c108,120
< return (object->Bitmap[((y*object->Xsize/8)+x/8)]&(0x80>>(x%8))) ? 1 : 0;
< break;
---
> offset = y*VGLAdpInfo.va_line_width + x/8;
> get_planar:
> #if 1
> return (object->Bitmap[offset]&(0x80>>(x%8))) ? 1 : 0; /* XXX */
> #else
> color = 0;
> mask = 0x80 >> (x%8);
> for (i = 0; i < VGLModeInfo.vi_planes; i++) {
> outb(0x3ce, 0x04); outb(0x3cf, i);
> color |= (object->Bitmap[offset] & mask) ? (1 << i) : 0;
> }
> return color;
> #endif
236a256,258
> int offset;
> int len;
>
242c264
< memset(object->Bitmap, color, object->Xsize*object->Ysize);
---
> memset(object->Bitmap, color, object->VXsize*object->VYsize);
243a266,276
>
> case VIDBUF8S:
> for (offset = 0; offset < object->VXsize*object->VYsize; ) {
> VGLSetSegment(offset);
> len = min(object->VXsize*object->VYsize - offset,
> VGLAdpInfo.va_window_size);
> memset(object->Bitmap, color, len);
> offset += len;
> }
> break;
>
245a279
> outb(0x3c6, 0xff);
247c281
< memset(object->Bitmap, color, object->Xsize*object->Ysize/4);
---
> memset(object->Bitmap, color, VGLAdpInfo.va_line_width*object->VYsize);
250a285
> case VIDBUF4S:
252c287,298
< memset(object->Bitmap, color, object->Xsize/8*object->Ysize);
---
> outb(0x3c4, 0x02); outb(0x3c5, 0x0f);
> outb(0x3ce, 0x05); outb(0x3cf, 0x02); /* mode 2 */
> outb(0x3ce, 0x01); outb(0x3cf, 0x00); /* set/reset enable */
> outb(0x3ce, 0x08); outb(0x3cf, 0xff); /* bit mask */
> for (offset = 0; offset < VGLAdpInfo.va_line_width*object->VYsize; ) {
> VGLSetSegment(offset);
> len = min(object->VXsize*object->VYsize - offset,
> VGLAdpInfo.va_window_size);
> memset(object->Bitmap, color, len);
> offset += len;
> }
> outb(0x3ce, 0x05); outb(0x3cf, 0x00);