1 /* 2 * Copyright © Microsoft Corporation 3 * 4 * Permission is hereby granted, free of charge, to any person obtaining a 5 * copy of this software and associated documentation files (the "Software"), 6 * to deal in the Software without restriction, including without limitation 7 * the rights to use, copy, modify, merge, publish, distribute, sublicense, 8 * and/or sell copies of the Software, and to permit persons to whom the 9 * Software is furnished to do so, subject to the following conditions: 10 * 11 * The above copyright notice and this permission notice (including the next 12 * paragraph) shall be included in all copies or substantial portions of the 13 * Software. 14 * 15 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL 18 * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING 20 * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS 21 * IN THE SOFTWARE. 22 */ 23 24 /* Certain Win32-like platforms (i.e. Xbox GDK) do not support the GDI library. 25 * stw_gdishim acts as a shim layer to provide the APIs required for gallium. 26 */ 27 28 #ifndef STW_GDISHIM_H 29 #define STW_GDISHIM_H 30 31 #ifdef _GAMING_XBOX 32 33 #include <windows.h> 34 35 /* Handles */ 36 typedef void* HMONITOR; 37 38 /* Stubs */ 39 #define WindowFromDC(hdc) (HWND)hdc 40 #define GetDC(hwnd) (HDC)hwnd 41 #define ReleaseDC(hwnd, hdc) 1 42 43 void StretchDIBits(HDC hdc, unsigned int xDest, unsigned int yDest, unsigned int DestWidth, unsigned int DestHeight, unsigned int xSrc, unsigned int ySrc, unsigned int SrcWidth, unsigned int SrcHeight, void* lpBits, void* lpbmi, unsigned int iUsage, DWORD rop); 44 45 /* Layer plane descriptor */ 46 typedef struct tagLAYERPLANEDESCRIPTOR { // lpd 47 WORD nSize; 48 WORD nVersion; 49 DWORD dwFlags; 50 BYTE iPixelType; 51 BYTE cColorBits; 52 BYTE cRedBits; 53 BYTE cRedShift; 54 BYTE cGreenBits; 55 BYTE cGreenShift; 56 BYTE cBlueBits; 57 BYTE cBlueShift; 58 BYTE cAlphaBits; 59 BYTE cAlphaShift; 60 BYTE cAccumBits; 61 BYTE cAccumRedBits; 62 BYTE cAccumGreenBits; 63 BYTE cAccumBlueBits; 64 BYTE cAccumAlphaBits; 65 BYTE cDepthBits; 66 BYTE cStencilBits; 67 BYTE cAuxBuffers; 68 BYTE iLayerPlane; 69 BYTE bReserved; 70 COLORREF crTransparent; 71 } LAYERPLANEDESCRIPTOR, * PLAYERPLANEDESCRIPTOR, FAR* LPLAYERPLANEDESCRIPTOR; 72 73 /* WGL */ 74 typedef struct _WGLSWAP 75 { 76 HDC hdc; 77 UINT uiFlags; 78 } WGLSWAP; 79 80 #define WGL_SWAPMULTIPLE_MAX 16 81 82 WINGDIAPI DWORD WINAPI 83 wglSwapMultipleBuffers(UINT n, 84 CONST WGLSWAP* ps); 85 86 WINGDIAPI BOOL WINAPI wglDeleteContext(HGLRC); 87 88 /* wglSwapLayerBuffers flags */ 89 #define WGL_SWAP_MAIN_PLANE 0x00000001 90 91 /* Pixel format descriptor */ 92 typedef struct tagPIXELFORMATDESCRIPTOR 93 { 94 WORD nSize; 95 WORD nVersion; 96 DWORD dwFlags; 97 BYTE iPixelType; 98 BYTE cColorBits; 99 BYTE cRedBits; 100 BYTE cRedShift; 101 BYTE cGreenBits; 102 BYTE cGreenShift; 103 BYTE cBlueBits; 104 BYTE cBlueShift; 105 BYTE cAlphaBits; 106 BYTE cAlphaShift; 107 BYTE cAccumBits; 108 BYTE cAccumRedBits; 109 BYTE cAccumGreenBits; 110 BYTE cAccumBlueBits; 111 BYTE cAccumAlphaBits; 112 BYTE cDepthBits; 113 BYTE cStencilBits; 114 BYTE cAuxBuffers; 115 BYTE iLayerType; 116 BYTE bReserved; 117 DWORD dwLayerMask; 118 DWORD dwVisibleMask; 119 DWORD dwDamageMask; 120 } PIXELFORMATDESCRIPTOR, * PPIXELFORMATDESCRIPTOR, FAR* LPPIXELFORMATDESCRIPTOR; 121 122 /* Bitmap Info */ 123 typedef struct tagRGBQUAD { 124 BYTE rgbBlue; 125 BYTE rgbGreen; 126 BYTE rgbRed; 127 BYTE rgbReserved; 128 } RGBQUAD; 129 130 typedef struct tagBITMAPINFO { 131 BITMAPINFOHEADER bmiHeader; 132 RGBQUAD bmiColors[1]; 133 } BITMAPINFO, * LPBITMAPINFO, * PBITMAPINFO; 134 135 /* Glyph Info */ 136 137 typedef struct tagGLYPHMETRICSFLOAT { 138 FLOAT gmfBlackBoxX; 139 FLOAT gmfBlackBoxY; 140 #ifndef _GAMING_XBOX 141 POINTFLOAT gmfptGlyphOrigin; 142 #else 143 FLOAT gmfptGlyphOriginX; 144 FLOAT gmfptGlyphOriginY; 145 #endif 146 FLOAT gmfCellIncX; 147 FLOAT gmfCellIncY; 148 } GLYPHMETRICSFLOAT, *PGLYPHMETRICSFLOAT, *LPGLYPHMETRICSFLOAT; 149 150 /* Bitmap Header */ 151 152 typedef long FXPT2DOT30; 153 154 typedef struct tagCIEXYZ { 155 FXPT2DOT30 ciexyzX; 156 FXPT2DOT30 ciexyzY; 157 FXPT2DOT30 ciexyzZ; 158 } CIEXYZ; 159 160 typedef struct tagICEXYZTRIPLE { 161 CIEXYZ ciexyzRed; 162 CIEXYZ ciexyzGreen; 163 CIEXYZ ciexyzBlue; 164 } CIEXYZTRIPLE; 165 166 typedef struct { 167 DWORD bV5Size; 168 LONG bV5Width; 169 LONG bV5Height; 170 WORD bV5Planes; 171 WORD bV5BitCount; 172 DWORD bV5Compression; 173 DWORD bV5SizeImage; 174 LONG bV5XPelsPerMeter; 175 LONG bV5YPelsPerMeter; 176 DWORD bV5ClrUsed; 177 DWORD bV5ClrImportant; 178 DWORD bV5RedMask; 179 DWORD bV5GreenMask; 180 DWORD bV5BlueMask; 181 DWORD bV5AlphaMask; 182 DWORD bV5CSType; 183 CIEXYZTRIPLE bV5Endpoints; 184 DWORD bV5GammaRed; 185 DWORD bV5GammaGreen; 186 DWORD bV5GammaBlue; 187 DWORD bV5Intent; 188 DWORD bV5ProfileData; 189 DWORD bV5ProfileSize; 190 DWORD bV5Reserved; 191 } BITMAPV5HEADER, *LPBITMAPV5HEADER, *PBITMAPV5HEADER; 192 193 #endif /* _GAMING_XBOX */ 194 195 #endif /* STW_PIXELFORMAT_H */ 196