nanogui@linuxhacker.org
nanogui@linuxhacker.org
On Thursday, May 20, 1999 1:03 PM, Alex Holden [SMTP:alex@linuxhacker.org] wrote:
> On Thu, 20 May 1999, Greg Haerr wrote:
> > The addition of a single readpixel entry point should allow all the work
> > that's been done with the bogl drivers to be brought in to the nanoX project.
>
> I'll do that next.
I finally got the damned VGA16 readpixel working, thanks to
Brilliant Ben. It turns out I had forgotten to use "volatile". Here is the working
code, to save you some time. It took me 5 hours to figure this damned thing out...
PIXELVAL
ega_readpixel(int x,int y)
{
volatile FARADDR src;
int plane;
PIXELVAL c = 0;
assert (x >= 0 && x < XRES);
assert (y >= 0 && y < YRES);
src = SCRADDR + x / 8 + y * BYTESPERLINE;
for(plane=0; plane<4; ++plane) {
set_read_plane(plane);
if(*src & (0x80 >> (x % 8)))
c |= 1 << plane;
}
return c;
}
The FARADDR and SCRADDR and BYTESPERLINE will be changed in your
version, this is out of my new "portable" C version that will run on anything...
>
> > In addition, the text draw routine needs to subtract the font->height
> > from the y value before displaying, if we want X-like semantics.
>
> I noticed the text was displaced strangely...
>
Take a look at the bog_cfb8_text routine in my 0.5 submission.
It's also documented with a FIXME in server/drivers/scr_bogl.c, in BOGL_drawtext.
I would fix it in there, but then we would have to include the bogl internals
at that level, which I didn't want to do.
BTW, on a whole 'nother level, I think we can dispense with a low-level
text draw routine now anyway, since the upper level needs to perform
text-based clipping, which wasn't implmented in the 0.5 release. I have
solved this problem with a (originally mini-x) scrdev.GetCharBits call
that returns the actual text bits and draws them individually if clipping
requires it.
Again, this is part of a more grandiose design to keep the low-level
simple, especially when the mid-level has to handle it anyway.
Greg
nanogui@linuxhacker.org