ReactOS  0.4.14-dev-98-gb0d4763
dd.c
Go to the documentation of this file.
1 /*
2  * ReactOS Generic Framebuffer display driver directdraw interface
3  *
4  * Copyright (C) 2006 Magnus Olsen
5  *
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.
10  *
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.
15  *
16  * You should have received a copy of the GNU General Public License along
17  * with this program; if not, write to the Free Software Foundation, Inc.,
18  * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
19  */
20 
21 /* Here we put in all 2d api for directdraw and redirect some of them to GDI api */
22 
23 #include "framebuf.h"
24 
27 {
28 
29  /* We do not support 3d buffer so we fail here */
30  if ((pccsd->lpDDSurfaceDesc->ddsCaps.dwCaps & DDSCAPS_ZBUFFER) &&
31  (pccsd->lpDDSurfaceDesc->ddsCaps.dwCaps & DDSCAPS_VIDEOMEMORY))
32  {
34  return DDHAL_DRIVER_HANDLED;
35  }
36 
37 
38  /* Check if another pixel format or not, we fail for now */
39  if (pccsd->bIsDifferentPixelFormat)
40  {
41  /* check the fourcc diffent FOURCC, but we only support BMP for now */
42  //if(pccsd->lpDDSurfaceDesc->ddpfPixelFormat.dwFlags & DDPF_FOURCC)
43  //{
44  // /* We do not support other pixel format */
45  // switch (pccsd->lpDDSurfaceDesc->ddpfPixelFormat.dwFourCC)
46  // {
47  // default:
48  // pccsd->ddRVal = DDERR_INVALIDPIXELFORMAT;
49  // return DDHAL_DRIVER_HANDLED;
50  // }
51  //}
52  // /* check the texture support, we do not support testure for now */
53  //else if((pccsd->lpDDSurfaceDesc->ddsCaps.dwCaps & DDSCAPS_TEXTURE))
54  //{
55  // /* We do not support texture surface */
56  // pccsd->ddRVal = DDERR_INVALIDPIXELFORMAT;
57  // return DDHAL_DRIVER_HANDLED;
58  //}
59 
60  /* Fail */
62  return DDHAL_DRIVER_HANDLED;
63  }
64 
65  pccsd->ddRVal = DD_OK;
66  return DDHAL_DRIVER_HANDLED;
67 }
68 
71 {
72  int i;
73 
74  if (pcsd->dwSCnt < 1)
75  {
76  pcsd->ddRVal = DDERR_GENERIC;
78  }
79 
80 
81  for (i=0; i<(int)pcsd->dwSCnt; i++)
82  {
83  pcsd->lplpSList[i]->lpGbl->lPitch = (DWORD)(pcsd->lplpSList[i]->lpGbl->wWidth *
84  (pcsd->lplpSList[i]->lpGbl->ddpfSurface.dwRGBBitCount / 8));
85 
86  pcsd->lplpSList[i]->lpGbl->dwBlockSizeX = pcsd->lplpSList[i]->lpGbl->lPitch *
87  (DWORD)(pcsd->lplpSList[i]->lpGbl->wHeight);
88 
89  pcsd->lplpSList[i]->lpGbl->dwBlockSizeY = 1;
90 
92  {
93  /* We maybe should alloc it with EngAlloc
94  for now we trusting ddraw alloc it */
95  pcsd->lplpSList[i]->lpGbl->fpVidMem = 0;
96  }
97  else
98  {
99 
100  /* We maybe should alloc it with EngAlloc
101  for now we trusting ddraw alloc it */
103  }
104 
105  pcsd->lpDDSurfaceDesc->lPitch = pcsd->lplpSList[i]->lpGbl->lPitch;
106  pcsd->lpDDSurfaceDesc->dwFlags |= DDSD_PITCH;
107 
108  } // for i
109 
110 
111 
112  pcsd->ddRVal = DD_OK;
113  return DDHAL_DRIVER_HANDLED;
114 }
DWORD dwCaps
Definition: ddraw.h:727
#define DDHAL_DRIVER_NOTHANDLED
Definition: ddrawi.h:320
DDSCAPS ddsCaps
Definition: ddrawint.h:174
#define CALLBACK
Definition: compat.h:27
#define DDERR_INVALIDPIXELFORMAT
Definition: ddraw.h:80
#define DWORD
Definition: nt_native.h:44
DWORD CALLBACK DdCanCreateSurface(LPDDHAL_CANCREATESURFACEDATA pccsd)
Definition: dd.c:26
PDD_SURFACE_LOCAL * lplpSList
Definition: ddrawint.h:427
#define DDHAL_DRIVER_HANDLED
Definition: ddrawi.h:321
#define DD_OK
Definition: ddraw.h:186
GLsizei GLenum const GLvoid GLsizei GLenum GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLint GLint GLint GLshort GLshort GLshort GLubyte GLubyte GLubyte GLuint GLuint GLuint GLushort GLushort GLushort GLbyte GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLfloat GLint GLint GLint GLint GLshort GLshort GLshort GLshort GLubyte GLubyte GLubyte GLubyte GLuint GLuint GLuint GLuint GLushort GLushort GLushort GLushort GLboolean const GLdouble const GLfloat const GLint const GLshort const GLbyte const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLdouble const GLfloat const GLfloat const GLint const GLint const GLshort const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort GLenum GLenum GLenum GLfloat GLenum GLint GLenum GLenum GLenum GLfloat GLenum GLenum GLint GLenum GLfloat GLenum GLint GLint GLushort GLenum GLenum GLfloat GLenum GLenum GLint GLfloat const GLubyte GLenum GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLint GLint GLsizei GLsizei GLint GLenum GLenum const GLvoid GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLenum const GLdouble GLenum GLenum const GLfloat GLenum GLenum const GLint GLsizei GLuint GLfloat GLuint GLbitfield GLfloat GLint GLuint GLboolean GLenum GLfloat GLenum GLbitfield GLenum GLfloat GLfloat GLint GLint const GLfloat GLenum GLfloat GLfloat GLint GLint GLfloat GLfloat GLint GLint const GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat const GLdouble const GLfloat const GLdouble const GLfloat GLint i
Definition: glfuncs.h:248
#define DDSCAPS_ZBUFFER
Definition: ddraw.h:267
#define DDSCAPS_VIDEOMEMORY
Definition: ddraw.h:264
#define DDERR_GENERIC
Definition: ddraw.h:72
DWORD CALLBACK DdCreateSurface(PDD_CREATESURFACEDATA pcsd)
Definition: dd.c:70
DWORD dwRGBBitCount
Definition: ddraw.h:1075
unsigned long DWORD
Definition: ntddk_ex.h:95
LPDDSURFACEDESC lpDDSurfaceDesc
Definition: ddrawi.h:785
DDPIXELFORMAT ddpfSurface
Definition: ddrawint.h:156
PDD_SURFACE_GLOBAL lpGbl
Definition: ddrawint.h:172
#define DDSCAPS_PRIMARYSURFACE
Definition: ddraw.h:258
DDSURFACEDESC * lpDDSurfaceDesc
Definition: ddrawint.h:426
#define DDHAL_PLEASEALLOC_BLOCKSIZE
Definition: ddrawi.h:650
FLATPTR fpVidMem
Definition: ddrawint.h:146
#define DDSD_PITCH
Definition: ddraw.h:211
unsigned int(__cdecl typeof(jpeg_read_scanlines))(struct jpeg_decompress_struct *
Definition: typeof.h:31