2 * Copyright (c) 2000, 2001 Greg Haerr <greg@censoft.com>
4 * Screen Driver Utilities
6 * Microwindows memory device routines
15 /* allocate a memory screen device*/
17 gen_allocatememgc(PSD psd)
21 /* if driver doesn't have blit, fail*/
22 if((psd->flags & PSF_HAVEBLIT) == 0)
25 mempsd = malloc(sizeof(SCREENDEVICE));
29 /* copy passed device get initial values*/
33 mempsd->flags |= PSF_MEMORY;
34 mempsd->flags &= ~PSF_SCREEN;
40 /* initialize memory device with passed parms*/
42 initmemgc(PSD mempsd,MWCOORD w,MWCOORD h,int planes,int bpp,int linelen,
45 assert(mempsd->flags & PSF_MEMORY);
47 /* create mem psd w/h aligned with hw screen w/h*/
48 if (mempsd->portrait & (MWPORTRAIT_LEFT|MWPORTRAIT_RIGHT)) {
57 mempsd->planes = planes;
59 mempsd->linelen = linelen;
65 gen_freememgc(PSD mempsd)
67 assert(mempsd->flags & PSF_MEMORY);
69 /* note: mempsd->addr must be freed elsewhere*/
75 gen_fillrect(PSD psd,MWCOORD x1, MWCOORD y1, MWCOORD x2, MWCOORD y2,
79 psd->DrawHorzLine(psd, x1, x2, y1++, c);
83 * Set subdriver entry points in screen device
84 * Initialize subdriver if init flag is TRUE
88 set_subdriver(PSD psd, PSUBDRIVER subdriver, MWBOOL init)
90 /* set subdriver entry points in screen driver*/
91 psd->DrawPixel = subdriver->DrawPixel;
92 psd->ReadPixel = subdriver->ReadPixel;
93 psd->DrawHorzLine = subdriver->DrawHorzLine;
94 psd->DrawVertLine = subdriver->DrawVertLine;
95 psd->FillRect = subdriver->FillRect;
96 psd->Blit = subdriver->Blit;
97 psd->DrawArea = subdriver->DrawArea;
98 psd->StretchBlit = subdriver->StretchBlit;
100 /* call driver init procedure to calc map size and linelen*/
101 if (init && !subdriver->Init(psd))
106 /* fill in a subdriver struct from passed screen device*/
108 get_subdriver(PSD psd, PSUBDRIVER subdriver)
110 /* set subdriver entry points in screen driver*/
111 subdriver->DrawPixel = psd->DrawPixel;
112 subdriver->ReadPixel = psd->ReadPixel;
113 subdriver->DrawHorzLine = psd->DrawHorzLine;
114 subdriver->DrawVertLine = psd->DrawVertLine;
115 subdriver->FillRect = psd->FillRect;
116 subdriver->Blit = psd->Blit;
117 subdriver->DrawArea = psd->DrawArea;
118 subdriver->StretchBlit = psd->StretchBlit;