2 * ReactOS Generic Framebuffer display driver directdraw interface
4 * Copyright (C) 2006 Magnus Olsen
6 * This program is free software; you can redistribute it and/or
7 * modify it under the terms of the GNU General Public License
8 * as published by the Free Software Foundation; either version 2
9 * of the License, or (at your option) any later version.
11 * This program is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 * GNU General Public License for more details.
16 * You should have received a copy of the GNU General Public License
17 * along with this program; if not, write to the Free Software
18 * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
21 /* Here we put in all 2d api for directdraw and redirect some of them to GDI api */
27 DdCanCreateSurface(LPDDHAL_CANCREATESURFACEDATA pccsd
)
30 /* We do not support 3d buffer so we fail here */
31 if ((pccsd
->lpDDSurfaceDesc
->ddsCaps
.dwCaps
& DDSCAPS_ZBUFFER
) &&
32 (pccsd
->lpDDSurfaceDesc
->ddsCaps
.dwCaps
& DDSCAPS_VIDEOMEMORY
))
34 pccsd
->ddRVal
= DDERR_INVALIDPIXELFORMAT
;
35 return DDHAL_DRIVER_HANDLED
;
39 /* Check if another pixel format or not, we fail for now */
40 if (pccsd
->bIsDifferentPixelFormat
)
42 /* check the fourcc diffent FOURCC, but we only support BMP for now */
43 //if(pccsd->lpDDSurfaceDesc->ddpfPixelFormat.dwFlags & DDPF_FOURCC)
45 // /* We do not support other pixel format */
46 // switch (pccsd->lpDDSurfaceDesc->ddpfPixelFormat.dwFourCC)
49 // pccsd->ddRVal = DDERR_INVALIDPIXELFORMAT;
50 // return DDHAL_DRIVER_HANDLED;
53 // /* check the texture support, we do not support testure for now */
54 //else if((pccsd->lpDDSurfaceDesc->ddsCaps.dwCaps & DDSCAPS_TEXTURE))
56 // /* We do not support texture surface */
57 // pccsd->ddRVal = DDERR_INVALIDPIXELFORMAT;
58 // return DDHAL_DRIVER_HANDLED;
62 pccsd
->ddRVal
= DDERR_INVALIDPIXELFORMAT
;
63 return DDHAL_DRIVER_HANDLED
;
66 pccsd
->ddRVal
= DD_OK
;
67 return DDHAL_DRIVER_HANDLED
;
71 DdCreateSurface(PDD_CREATESURFACEDATA pcsd
)
77 pcsd
->ddRVal
= DDERR_GENERIC
;
78 return DDHAL_DRIVER_NOTHANDLED
;
82 for (i
=0; i
<(int)pcsd
->dwSCnt
; i
++)
84 pcsd
->lplpSList
[i
]->lpGbl
->lPitch
= (DWORD
)(pcsd
->lplpSList
[i
]->lpGbl
->wWidth
*
85 (pcsd
->lplpSList
[i
]->lpGbl
->ddpfSurface
.dwRGBBitCount
/ 8));
87 pcsd
->lplpSList
[i
]->lpGbl
->dwBlockSizeX
= pcsd
->lplpSList
[i
]->lpGbl
->lPitch
*
88 (DWORD
)(pcsd
->lplpSList
[i
]->lpGbl
->wHeight
);
90 pcsd
->lplpSList
[i
]->lpGbl
->dwBlockSizeY
= 1;
92 if ( pcsd
->lplpSList
[i
] ->ddsCaps
.dwCaps
& DDSCAPS_PRIMARYSURFACE
)
94 /* We maybe should alloc it with EngAlloc
95 for now we trusting ddraw alloc it */
96 pcsd
->lplpSList
[i
]->lpGbl
->fpVidMem
= 0;
101 /* We maybe should alloc it with EngAlloc
102 for now we trusting ddraw alloc it */
103 pcsd
->lplpSList
[i
]->lpGbl
->fpVidMem
= DDHAL_PLEASEALLOC_BLOCKSIZE
;
106 pcsd
->lpDDSurfaceDesc
->lPitch
= pcsd
->lplpSList
[i
]->lpGbl
->lPitch
;
107 pcsd
->lpDDSurfaceDesc
->dwFlags
|= DDSD_PITCH
;
113 pcsd
->ddRVal
= DD_OK
;
114 return DDHAL_DRIVER_HANDLED
;