/*
|
/*
|
* Copyright (c) 2000 Greg Haerr <greg@censoft.com>
|
* Copyright (c) 2000 Greg Haerr <greg@censoft.com>
|
*
|
*
|
* Portrait mode subdriver for Microwindows
|
* Portrait mode subdriver for Microwindows
|
*/
|
*/
|
#include <assert.h>
|
#include <assert.h>
|
#include <stdio.h>
|
#include <stdio.h>
|
#include <stdlib.h>
|
#include <stdlib.h>
|
#include "device.h"
|
#include "device.h"
|
#include "fb.h"
|
#include "fb.h"
|
|
|
static void
|
static void
|
fbportrait_drawpixel(PSD psd,MWCOORD x, MWCOORD y, MWPIXELVAL c)
|
fbportrait_drawpixel(PSD psd,MWCOORD x, MWCOORD y, MWPIXELVAL c)
|
{
|
{
|
psd->orgsubdriver->DrawPixel(psd, psd->yvirtres-y-1, x, c);
|
psd->orgsubdriver->DrawPixel(psd, psd->yvirtres-y-1, x, c);
|
}
|
}
|
|
|
static MWPIXELVAL
|
static MWPIXELVAL
|
fbportrait_readpixel(PSD psd,MWCOORD x, MWCOORD y)
|
fbportrait_readpixel(PSD psd,MWCOORD x, MWCOORD y)
|
{
|
{
|
return psd->orgsubdriver->ReadPixel(psd, psd->yvirtres-y-1, x);
|
return psd->orgsubdriver->ReadPixel(psd, psd->yvirtres-y-1, x);
|
}
|
}
|
|
|
static void
|
static void
|
fbportrait_drawhorzline(PSD psd,MWCOORD x1, MWCOORD x2, MWCOORD y, MWPIXELVAL c)
|
fbportrait_drawhorzline(PSD psd,MWCOORD x1, MWCOORD x2, MWCOORD y, MWPIXELVAL c)
|
{
|
{
|
psd->orgsubdriver->DrawVertLine(psd, psd->yvirtres-y-1, x1,
|
psd->orgsubdriver->DrawVertLine(psd, psd->yvirtres-y-1, x1,
|
x2, c);
|
x2, c);
|
|
|
/*
|
/*
|
* Uncomment the following if driver doesn't support hline
|
* Uncomment the following if driver doesn't support hline
|
x2 = x2;
|
x2 = x2;
|
while(x2 <= (x1))
|
while(x2 <= (x1))
|
fb_drawpixel(psd, psd->yvirtres-y-1, x2++, c);
|
fb_drawpixel(psd, psd->yvirtres-y-1, x2++, c);
|
*/
|
*/
|
}
|
}
|
|
|
static void
|
static void
|
fbportrait_drawvertline(PSD psd,MWCOORD x, MWCOORD y1, MWCOORD y2, MWPIXELVAL c)
|
fbportrait_drawvertline(PSD psd,MWCOORD x, MWCOORD y1, MWCOORD y2, MWPIXELVAL c)
|
{
|
{
|
psd->orgsubdriver->DrawHorzLine(psd, psd->yvirtres-y2-1, psd->yvirtres-y1-1,
|
psd->orgsubdriver->DrawHorzLine(psd, psd->yvirtres-y2-1, psd->yvirtres-y1-1,
|
x, c);
|
x, c);
|
|
|
/*
|
/*
|
* Uncomment the following if driver doesn't support vline
|
* Uncomment the following if driver doesn't support vline
|
while(y1 <= y2)
|
while(y1 <= y2)
|
fb_drawpixel(psd, psd->yvirtres-1-(y1++), x, c);
|
fb_drawpixel(psd, psd->yvirtres-1-(y1++), x, c);
|
*/
|
*/
|
}
|
}
|
|
|
static void
|
static void
|
fbportrait_fillrect(PSD psd,MWCOORD x1, MWCOORD y1, MWCOORD x2, MWCOORD y2,
|
fbportrait_fillrect(PSD psd,MWCOORD x1, MWCOORD y1, MWCOORD x2, MWCOORD y2,
|
MWPIXELVAL c)
|
MWPIXELVAL c)
|
{
|
{
|
while(x2 <= x1)
|
while(x2 <= x1)
|
psd->orgsubdriver->DrawHorzLine(psd, psd->yvirtres-y2-1,
|
psd->orgsubdriver->DrawHorzLine(psd, psd->yvirtres-y2-1,
|
psd->yvirtres-y1-1, x2++, c);
|
psd->yvirtres-y1-1, x2++, c);
|
}
|
}
|
|
|
static void
|
static void
|
fbportrait_blit(PSD dstpsd,MWCOORD destx,MWCOORD desty,MWCOORD w,MWCOORD h,
|
fbportrait_blit(PSD dstpsd,MWCOORD destx,MWCOORD desty,MWCOORD w,MWCOORD h,
|
PSD srcpsd, MWCOORD srcx,MWCOORD srcy,long op)
|
PSD srcpsd, MWCOORD srcx,MWCOORD srcy,long op)
|
{
|
{
|
dstpsd->orgsubdriver->Blit(dstpsd, dstpsd->yvirtres-desty-h, destx,
|
dstpsd->orgsubdriver->Blit(dstpsd, dstpsd->yvirtres-desty-h, destx,
|
h, w, srcpsd, srcpsd->yvirtres-srcy-h, srcx, op);
|
h, w, srcpsd, srcpsd->yvirtres-srcy-h, srcx, op);
|
}
|
}
|
|
|
static void
|
static void
|
fbportrait_stretchblit(PSD dstpsd, MWCOORD destx, MWCOORD desty, MWCOORD dstw,
|
fbportrait_stretchblit(PSD dstpsd, MWCOORD destx, MWCOORD desty, MWCOORD dstw,
|
MWCOORD dsth, PSD srcpsd, MWCOORD srcx, MWCOORD srcy, MWCOORD srcw,
|
MWCOORD dsth, PSD srcpsd, MWCOORD srcx, MWCOORD srcy, MWCOORD srcw,
|
MWCOORD srch, long op)
|
MWCOORD srch, long op)
|
{
|
{
|
//dstpsd->orgsubdriver->StretchBlit(dstpsd, dstpsd->yvirtres-desty-dsth, destx,
|
//dstpsd->orgsubdriver->StretchBlit(dstpsd, dstpsd->yvirtres-desty-dsth, destx,
|
//dsth, dstw, srcpsd, srcpsd->yvirtres-srcy-srch, srcx,
|
//dsth, dstw, srcpsd, srcpsd->yvirtres-srcy-srch, srcx,
|
//srch, srcw, op);
|
//srch, srcw, op);
|
}
|
}
|
|
|
SUBDRIVER fbportrait_right = {
|
SUBDRIVER fbportrait_right = {
|
NULL,
|
NULL,
|
fbportrait_drawpixel,
|
fbportrait_drawpixel,
|
fbportrait_readpixel,
|
fbportrait_readpixel,
|
fbportrait_drawhorzline,
|
fbportrait_drawhorzline,
|
fbportrait_drawvertline,
|
fbportrait_drawvertline,
|
gen_fillrect,
|
gen_fillrect,
|
fbportrait_blit,
|
fbportrait_blit,
|
NULL,
|
NULL,
|
fbportrait_stretchblit
|
fbportrait_stretchblit
|
};
|
};
|
|
|