Fix reading of pixels in (4 and 8-plane) planar modes.

There seems to be no alternative to reading each plane independently using
3 slow i/o's per plane (this delivers 8 nearby pixels, but we don't buffer
the results so run 8 times slower than necessary.

All the code for this was there, but it was ifdefed out and replaced by
simpler code that cannot work in planar modes.  The ifdefed out code
was correct except it was missing a volatile declaration, so compilers
optimized the multiple dummy reads in it to a single read.
This commit is contained in:
bde 2019-03-24 19:27:03 +00:00
parent 2b092124bf
commit ba342886de

View File

@ -148,11 +148,9 @@ VGLGetXY(VGLBitmap *object, int x, int y)
{
int offset;
byte b[4];
#if 0
int i;
u_long color;
byte mask;
#endif
VGLCheckSwitch();
if (x<0 || x>=object->VXsize || y<0 || y>=object->VYsize)
@ -185,17 +183,14 @@ VGLGetXY(VGLBitmap *object, int x, int y)
case VIDBUF4:
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;
color |= (((volatile VGLBitmap *)object)->Bitmap[offset] & mask) ?
(1 << i) : 0;
}
return color;
#endif
}
return 0; /* XXX black? */
}