]> git.karo-electronics.de Git - karo-tx-redboot.git/blob - packages/services/gfx/mw/v2_0/src/drivers/fbportrait_right.c
Initial revision
[karo-tx-redboot.git] / packages / services / gfx / mw / v2_0 / src / drivers / fbportrait_right.c
1 /*
2  * Copyright (c) 2000 Greg Haerr <greg@censoft.com>
3  *
4  * Portrait mode subdriver for Microwindows
5  */
6 #include <assert.h>
7 #include <stdio.h>
8 #include <stdlib.h>
9 #include "device.h"
10 #include "fb.h"
11
12 static void
13 fbportrait_drawpixel(PSD psd,MWCOORD x, MWCOORD y, MWPIXELVAL c)
14 {
15         psd->orgsubdriver->DrawPixel(psd, psd->yvirtres-y-1, x, c);
16 }
17
18 static MWPIXELVAL
19 fbportrait_readpixel(PSD psd,MWCOORD x, MWCOORD y)
20 {
21         return psd->orgsubdriver->ReadPixel(psd, psd->yvirtres-y-1, x);
22 }
23
24 static void
25 fbportrait_drawhorzline(PSD psd,MWCOORD x1, MWCOORD x2, MWCOORD y, MWPIXELVAL c)
26 {
27         psd->orgsubdriver->DrawVertLine(psd, psd->yvirtres-y-1, x1,
28                 x2, c);
29
30         /*
31          * Uncomment the following if driver doesn't support hline
32         x2 = x2;
33         while(x2 <= (x1))
34                 fb_drawpixel(psd, psd->yvirtres-y-1, x2++, c);
35          */
36 }
37
38 static void
39 fbportrait_drawvertline(PSD psd,MWCOORD x, MWCOORD y1, MWCOORD y2, MWPIXELVAL c)
40 {
41         psd->orgsubdriver->DrawHorzLine(psd, psd->yvirtres-y2-1, psd->yvirtres-y1-1,
42                 x, c);
43
44         /*
45          * Uncomment the following if driver doesn't support vline
46         while(y1 <= y2)
47                 fb_drawpixel(psd, psd->yvirtres-1-(y1++), x, c);
48          */
49 }
50
51 static void
52 fbportrait_fillrect(PSD psd,MWCOORD x1, MWCOORD y1, MWCOORD x2, MWCOORD y2,
53         MWPIXELVAL c)
54 {
55         while(x2 <= x1)
56                 psd->orgsubdriver->DrawHorzLine(psd, psd->yvirtres-y2-1,
57                         psd->yvirtres-y1-1, x2++, c);
58 }
59
60 static void
61 fbportrait_blit(PSD dstpsd,MWCOORD destx,MWCOORD desty,MWCOORD w,MWCOORD h,
62         PSD srcpsd, MWCOORD srcx,MWCOORD srcy,long op)
63 {
64         dstpsd->orgsubdriver->Blit(dstpsd, dstpsd->yvirtres-desty-h, destx,
65                 h, w, srcpsd, srcpsd->yvirtres-srcy-h, srcx, op);
66 }
67
68 static void
69 fbportrait_stretchblit(PSD dstpsd, MWCOORD destx, MWCOORD desty, MWCOORD dstw,
70         MWCOORD dsth, PSD srcpsd, MWCOORD srcx, MWCOORD srcy, MWCOORD srcw,
71         MWCOORD srch, long op)
72 {
73         //dstpsd->orgsubdriver->StretchBlit(dstpsd, dstpsd->yvirtres-desty-dsth, destx,
74                 //dsth, dstw, srcpsd, srcpsd->yvirtres-srcy-srch, srcx,
75                 //srch, srcw, op);
76 }
77
78 SUBDRIVER fbportrait_right = {
79         NULL,
80         fbportrait_drawpixel,
81         fbportrait_readpixel,
82         fbportrait_drawhorzline,
83         fbportrait_drawvertline,
84         gen_fillrect,
85         fbportrait_blit,
86         NULL,
87         fbportrait_stretchblit
88 };