Home | Info | Community | Development | myReactOS | Contact Us
ReactOS Development > Doxygensurface.c
Go to the documentation of this file.
00001 /* 00002 * Copyright (C) 2009 Tony Wasserka 00003 * 00004 * This library is free software; you can redistribute it and/or 00005 * modify it under the terms of the GNU Lesser General Public 00006 * License as published by the Free Software Foundation; either 00007 * version 2.1 of the License, or (at your option) any later version. 00008 * 00009 * This library is distributed in the hope that it will be useful, 00010 * but WITHOUT ANY WARRANTY; without even the implied warranty of 00011 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 00012 * Lesser General Public License for more details. 00013 * 00014 * You should have received a copy of the GNU Lesser General Public 00015 * License along with this library; if not, write to the Free Software 00016 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA 00017 * 00018 */ 00019 00020 #include "wine/debug.h" 00021 #include "wine/unicode.h" 00022 #include "d3dx9_36_private.h" 00023 00024 WINE_DEFAULT_DEBUG_CHANNEL(d3dx); 00025 00026 00027 /************************************************************ 00028 * D3DXGetImageInfoFromFileInMemory 00029 * 00030 * Fills a D3DXIMAGE_INFO structure with info about an image 00031 * 00032 * PARAMS 00033 * data [I] pointer to the image file data 00034 * datasize [I] size of the passed data 00035 * info [O] pointer to the destination structure 00036 * 00037 * RETURNS 00038 * Success: D3D_OK, if info is not NULL and data and datasize make up a valid image file or 00039 * if info is NULL and data and datasize are not NULL 00040 * Failure: D3DXERR_INVALIDDATA, if data is no valid image file and datasize and info are not NULL 00041 * D3DERR_INVALIDCALL, if data is NULL or 00042 * if datasize is 0 00043 * 00044 * NOTES 00045 * datasize may be bigger than the actual file size 00046 * 00047 */ 00048 HRESULT WINAPI D3DXGetImageInfoFromFileInMemory(LPCVOID data, UINT datasize, D3DXIMAGE_INFO *info) 00049 { 00050 FIXME("(%p, %d, %p): stub\n", data, datasize, info); 00051 00052 if(data && datasize && !info) return D3D_OK; 00053 if( !data || !datasize ) return D3DERR_INVALIDCALL; 00054 00055 return E_NOTIMPL; 00056 } 00057 00058 /************************************************************ 00059 * D3DXGetImageInfoFromFile 00060 * 00061 * RETURNS 00062 * Success: D3D_OK, if we successfully load a valid image file or 00063 * if we successfully load a file which is no valid image and info is NULL 00064 * Failure: D3DXERR_INVALIDDATA, if we fail to load file or 00065 * if file is not a valid image file and info is not NULL 00066 * D3DERR_INVALIDCALL, if file is NULL 00067 * 00068 */ 00069 HRESULT WINAPI D3DXGetImageInfoFromFileA(LPCSTR file, D3DXIMAGE_INFO *info) 00070 { 00071 LPWSTR widename; 00072 HRESULT hr; 00073 int strlength; 00074 TRACE("(void): relay\n"); 00075 00076 if( !file ) return D3DERR_INVALIDCALL; 00077 00078 strlength = MultiByteToWideChar(CP_ACP, 0, file, -1, NULL, 0); 00079 widename = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, strlength * sizeof(WCHAR)); 00080 MultiByteToWideChar(CP_ACP, 0, file, -1, widename, strlength); 00081 00082 hr = D3DXGetImageInfoFromFileW(widename, info); 00083 HeapFree(GetProcessHeap(), 0, widename); 00084 00085 return hr; 00086 } 00087 00088 HRESULT WINAPI D3DXGetImageInfoFromFileW(LPCWSTR file, D3DXIMAGE_INFO *info) 00089 { 00090 HRESULT hr; 00091 DWORD size; 00092 LPVOID buffer; 00093 TRACE("(void): relay\n"); 00094 00095 if( !file ) return D3DERR_INVALIDCALL; 00096 00097 hr = map_view_of_file(file, &buffer, &size); 00098 if(FAILED(hr)) return D3DXERR_INVALIDDATA; 00099 00100 hr = D3DXGetImageInfoFromFileInMemory(buffer, size, info); 00101 UnmapViewOfFile(buffer); 00102 00103 return hr; 00104 } 00105 00106 /************************************************************ 00107 * D3DXGetImageInfoFromResource 00108 * 00109 * RETURNS 00110 * Success: D3D_OK, if resource is a valid image file 00111 * Failure: D3DXERR_INVALIDDATA, if resource is no valid image file or NULL or 00112 * if we fail to load resource 00113 * 00114 */ 00115 HRESULT WINAPI D3DXGetImageInfoFromResourceA(HMODULE module, LPCSTR resource, D3DXIMAGE_INFO *info) 00116 { 00117 HRSRC resinfo; 00118 TRACE("(void)\n"); 00119 00120 resinfo = FindResourceA(module, resource, (LPCSTR)RT_RCDATA); 00121 if(resinfo) { 00122 LPVOID buffer; 00123 HRESULT hr; 00124 DWORD size; 00125 00126 hr = load_resource_into_memory(module, resinfo, &buffer, &size); 00127 if(FAILED(hr)) return D3DXERR_INVALIDDATA; 00128 return D3DXGetImageInfoFromFileInMemory(buffer, size, info); 00129 } 00130 00131 resinfo = FindResourceA(module, resource, (LPCSTR)RT_BITMAP); 00132 if(resinfo) { 00133 FIXME("Implement loading bitmaps from resource type RT_BITMAP\n"); 00134 return E_NOTIMPL; 00135 } 00136 return D3DXERR_INVALIDDATA; 00137 } 00138 00139 HRESULT WINAPI D3DXGetImageInfoFromResourceW(HMODULE module, LPCWSTR resource, D3DXIMAGE_INFO *info) 00140 { 00141 HRSRC resinfo; 00142 TRACE("(void)\n"); 00143 00144 resinfo = FindResourceW(module, resource, (LPCWSTR)RT_RCDATA); 00145 if(resinfo) { 00146 LPVOID buffer; 00147 HRESULT hr; 00148 DWORD size; 00149 00150 hr = load_resource_into_memory(module, resinfo, &buffer, &size); 00151 if(FAILED(hr)) return D3DXERR_INVALIDDATA; 00152 return D3DXGetImageInfoFromFileInMemory(buffer, size, info); 00153 } 00154 00155 resinfo = FindResourceW(module, resource, (LPCWSTR)RT_BITMAP); 00156 if(resinfo) { 00157 FIXME("Implement loading bitmaps from resource type RT_BITMAP\n"); 00158 return E_NOTIMPL; 00159 } 00160 return D3DXERR_INVALIDDATA; 00161 } 00162 00163 /************************************************************ 00164 * D3DXLoadSurfaceFromFileInMemory 00165 * 00166 * Loads data from a given buffer into a surface and fills a given 00167 * D3DXIMAGE_INFO structure with info about the source data. 00168 * 00169 * PARAMS 00170 * pDestSurface [I] pointer to the surface 00171 * pDestPalette [I] palette to use 00172 * pDestRect [I] to be filled area of the surface 00173 * pSrcData [I] pointer to the source data 00174 * SrcDataSize [I] size of the source data in bytes 00175 * pSrcRect [I] area of the source data to load 00176 * dwFilter [I] filter to apply on stretching 00177 * Colorkey [I] colorkey 00178 * pSrcInfo [O] pointer to a D3DXIMAGE_INFO structure 00179 * 00180 * RETURNS 00181 * Success: D3D_OK 00182 * Failure: D3DERR_INVALIDCALL, if pDestSurface or pSrcData or SrcDataSize are NULL 00183 * D3DXERR_INVALIDDATA, if pSrcData is no valid image file 00184 * 00185 */ 00186 HRESULT WINAPI D3DXLoadSurfaceFromFileInMemory(LPDIRECT3DSURFACE9 pDestSurface, 00187 CONST PALETTEENTRY *pDestPalette, 00188 CONST RECT *pDestRect, 00189 LPCVOID pSrcData, 00190 UINT SrcDataSize, 00191 CONST RECT *pSrcRect, 00192 DWORD dwFilter, 00193 D3DCOLOR Colorkey, 00194 D3DXIMAGE_INFO *pSrcInfo) 00195 { 00196 FIXME("(%p, %p, %p, %p, %d, %p, %d, %x, %p): stub\n", pDestSurface, pDestPalette, 00197 pDestRect, pSrcData, SrcDataSize, pSrcRect, dwFilter, Colorkey, pSrcInfo); 00198 00199 if( !pDestSurface || !pSrcData | !SrcDataSize ) return D3DERR_INVALIDCALL; 00200 return E_NOTIMPL; 00201 } 00202 00203 /************************************************************ 00204 * D3DXLoadSurfaceFromFile 00205 */ 00206 HRESULT WINAPI D3DXLoadSurfaceFromFileA(LPDIRECT3DSURFACE9 pDestSurface, 00207 CONST PALETTEENTRY *pDestPalette, 00208 CONST RECT *pDestRect, 00209 LPCSTR pSrcFile, 00210 CONST RECT *pSrcRect, 00211 DWORD dwFilter, 00212 D3DCOLOR Colorkey, 00213 D3DXIMAGE_INFO *pSrcInfo) 00214 { 00215 LPWSTR pWidename; 00216 HRESULT hr; 00217 int strlength; 00218 TRACE("(void): relay\n"); 00219 00220 if( !pSrcFile || !pDestSurface ) return D3DERR_INVALIDCALL; 00221 00222 strlength = MultiByteToWideChar(CP_ACP, 0, pSrcFile, -1, NULL, 0); 00223 pWidename = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, strlength * sizeof(WCHAR)); 00224 MultiByteToWideChar(CP_ACP, 0, pSrcFile, -1, pWidename, strlength); 00225 00226 hr = D3DXLoadSurfaceFromFileW(pDestSurface, pDestPalette, pDestRect, pWidename, pSrcRect, dwFilter, Colorkey, pSrcInfo); 00227 HeapFree(GetProcessHeap(), 0, pWidename); 00228 00229 return hr; 00230 } 00231 00232 HRESULT WINAPI D3DXLoadSurfaceFromFileW(LPDIRECT3DSURFACE9 pDestSurface, 00233 CONST PALETTEENTRY *pDestPalette, 00234 CONST RECT *pDestRect, 00235 LPCWSTR pSrcFile, 00236 CONST RECT *pSrcRect, 00237 DWORD Filter, 00238 D3DCOLOR Colorkey, 00239 D3DXIMAGE_INFO *pSrcInfo) 00240 { 00241 HRESULT hr; 00242 DWORD dwSize; 00243 LPVOID pBuffer; 00244 TRACE("(void): relay\n"); 00245 00246 if( !pSrcFile || !pDestSurface ) return D3DERR_INVALIDCALL; 00247 00248 hr = map_view_of_file(pSrcFile, &pBuffer, &dwSize); 00249 if(FAILED(hr)) return D3DXERR_INVALIDDATA; 00250 00251 hr = D3DXLoadSurfaceFromFileInMemory(pDestSurface, pDestPalette, pDestRect, pBuffer, dwSize, pSrcRect, Filter, Colorkey, pSrcInfo); 00252 UnmapViewOfFile(pBuffer); 00253 00254 return hr; 00255 } 00256 00257 /************************************************************ 00258 * D3DXLoadSurfaceFromResource 00259 */ 00260 HRESULT WINAPI D3DXLoadSurfaceFromResourceA(LPDIRECT3DSURFACE9 pDestSurface, 00261 CONST PALETTEENTRY *pDestPalette, 00262 CONST RECT *pDestRect, 00263 HMODULE hSrcModule, 00264 LPCSTR pResource, 00265 CONST RECT *pSrcRect, 00266 DWORD dwFilter, 00267 D3DCOLOR Colorkey, 00268 D3DXIMAGE_INFO *pSrcInfo) 00269 { 00270 HRSRC hResInfo; 00271 TRACE("(void): relay\n"); 00272 00273 if( !pDestSurface ) return D3DERR_INVALIDCALL; 00274 00275 hResInfo = FindResourceA(hSrcModule, pResource, (LPCSTR)RT_RCDATA); 00276 if(hResInfo) { 00277 LPVOID pBuffer; 00278 HRESULT hr; 00279 DWORD dwSize; 00280 00281 hr = load_resource_into_memory(hSrcModule, hResInfo, &pBuffer, &dwSize); 00282 if(FAILED(hr)) return D3DXERR_INVALIDDATA; 00283 return D3DXLoadSurfaceFromFileInMemory(pDestSurface, pDestPalette, pDestRect, pBuffer, dwSize, pSrcRect, dwFilter, Colorkey, pSrcInfo); 00284 } 00285 00286 hResInfo = FindResourceA(hSrcModule, pResource, (LPCSTR)RT_BITMAP); 00287 if(hResInfo) { 00288 FIXME("Implement loading bitmaps from resource type RT_BITMAP\n"); 00289 return E_NOTIMPL; 00290 } 00291 return D3DXERR_INVALIDDATA; 00292 } 00293 00294 HRESULT WINAPI D3DXLoadSurfaceFromResourceW(LPDIRECT3DSURFACE9 pDestSurface, 00295 CONST PALETTEENTRY *pDestPalette, 00296 CONST RECT *pDestRect, 00297 HMODULE hSrcModule, 00298 LPCWSTR pResource, 00299 CONST RECT *pSrcRect, 00300 DWORD dwFilter, 00301 D3DCOLOR Colorkey, 00302 D3DXIMAGE_INFO *pSrcInfo) 00303 { 00304 HRSRC hResInfo; 00305 TRACE("(void): relay\n"); 00306 00307 if( !pDestSurface ) return D3DERR_INVALIDCALL; 00308 00309 hResInfo = FindResourceW(hSrcModule, pResource, (LPCWSTR)RT_RCDATA); 00310 if(hResInfo) { 00311 LPVOID pBuffer; 00312 HRESULT hr; 00313 DWORD dwSize; 00314 00315 hr = load_resource_into_memory(hSrcModule, hResInfo, &pBuffer, &dwSize); 00316 if(FAILED(hr)) return D3DXERR_INVALIDDATA; 00317 return D3DXLoadSurfaceFromFileInMemory(pDestSurface, pDestPalette, pDestRect, pBuffer, dwSize, pSrcRect, dwFilter, Colorkey, pSrcInfo); 00318 } 00319 00320 hResInfo = FindResourceW(hSrcModule, pResource, (LPCWSTR)RT_BITMAP); 00321 if(hResInfo) { 00322 FIXME("Implement loading bitmaps from resource type RT_BITMAP\n"); 00323 return E_NOTIMPL; 00324 } 00325 return D3DXERR_INVALIDDATA; 00326 } 00327 00328 00329 /************************************************************ 00330 * copy_simple_data 00331 * 00332 * Copies the source buffer to the destination buffer, performing 00333 * any necessary format conversion and color keying. 00334 * Works only for ARGB formats with 1 - 4 bytes per pixel. 00335 */ 00336 static void copy_simple_data(CONST BYTE *src, UINT srcpitch, POINT srcsize, CONST PixelFormatDesc *srcformat, 00337 CONST BYTE *dest, UINT destpitch, POINT destsize, CONST PixelFormatDesc *destformat, 00338 DWORD dwFilter) 00339 { 00340 DWORD srcshift[4], destshift[4]; 00341 DWORD srcmask[4], destmask[4]; 00342 BOOL process_channel[4]; 00343 DWORD channels[4]; 00344 DWORD channelmask = 0; 00345 00346 UINT minwidth, minheight; 00347 BYTE *srcptr, *destptr; 00348 UINT i, x, y; 00349 00350 ZeroMemory(channels, sizeof(channels)); 00351 ZeroMemory(process_channel, sizeof(process_channel)); 00352 00353 for(i = 0;i < 4;i++) { 00354 /* srcshift is used to extract the _relevant_ components */ 00355 srcshift[i] = srcformat->shift[i] + max( srcformat->bits[i] - destformat->bits[i], 0); 00356 00357 /* destshift is used to move the components to the correct position */ 00358 destshift[i] = destformat->shift[i] + max(destformat->bits[i] - srcformat->bits[i], 0); 00359 00360 srcmask[i] = ((1 << srcformat->bits[i]) - 1) << srcformat->shift[i]; 00361 destmask[i] = ((1 << destformat->bits[i]) - 1) << destformat->shift[i]; 00362 00363 /* channelmask specifies bits which aren't used in the source format but in the destination one */ 00364 if(destformat->bits[i]) { 00365 if(srcformat->bits[i]) process_channel[i] = TRUE; 00366 else channelmask |= destmask[i]; 00367 } 00368 } 00369 00370 minwidth = (srcsize.x < destsize.x) ? srcsize.x : destsize.x; 00371 minheight = (srcsize.y < destsize.y) ? srcsize.y : destsize.y; 00372 00373 for(y = 0;y < minheight;y++) { 00374 srcptr = (BYTE*)( src + y * srcpitch); 00375 destptr = (BYTE*)(dest + y * destpitch); 00376 for(x = 0;x < minwidth;x++) { 00377 /* extract source color components */ 00378 if(srcformat->type == FORMAT_ARGB) { 00379 const DWORD col = *(DWORD*)srcptr; 00380 for(i = 0;i < 4;i++) 00381 if(process_channel[i]) 00382 channels[i] = (col & srcmask[i]) >> srcshift[i]; 00383 } 00384 00385 /* recombine the components */ 00386 if(destformat->type == FORMAT_ARGB) { 00387 DWORD* const pixel = (DWORD*)destptr; 00388 *pixel = 0; 00389 00390 for(i = 0;i < 4;i++) { 00391 if(process_channel[i]) { 00392 /* necessary to make sure that e.g. an X4R4G4B4 white maps to an R8G8B8 white instead of 0xf0f0f0 */ 00393 signed int shift; 00394 for(shift = destshift[i]; shift > destformat->shift[i]; shift -= srcformat->bits[i]) *pixel |= channels[i] << shift; 00395 *pixel |= (channels[i] >> (destformat->shift[i] - shift)) << destformat->shift[i]; 00396 } 00397 } 00398 *pixel |= channelmask; /* new channels are set to their maximal value */ 00399 } 00400 srcptr += srcformat->bytes_per_pixel; 00401 destptr += destformat->bytes_per_pixel; 00402 } 00403 } 00404 } 00405 00406 /************************************************************ 00407 * D3DXLoadSurfaceFromMemory 00408 * 00409 * Loads data from a given memory chunk into a surface, 00410 * applying any of the specified filters. 00411 * 00412 * PARAMS 00413 * pDestSurface [I] pointer to the surface 00414 * pDestPalette [I] palette to use 00415 * pDestRect [I] to be filled area of the surface 00416 * pSrcMemory [I] pointer to the source data 00417 * SrcFormat [I] format of the source pixel data 00418 * SrcPitch [I] number of bytes in a row 00419 * pSrcPalette [I] palette used in the source image 00420 * pSrcRect [I] area of the source data to load 00421 * dwFilter [I] filter to apply on stretching 00422 * Colorkey [I] colorkey 00423 * 00424 * RETURNS 00425 * Success: D3D_OK, if we successfully load the pixel data into our surface or 00426 * if pSrcMemory is NULL but the other parameters are valid 00427 * Failure: D3DERR_INVALIDCALL, if pDestSurface, SrcPitch or pSrcRect are NULL or 00428 * if SrcFormat is an invalid format (other than D3DFMT_UNKNOWN) 00429 * D3DXERR_INVALIDDATA, if we fail to lock pDestSurface 00430 * E_FAIL, if SrcFormat is D3DFMT_UNKNOWN or the dimensions of pSrcRect are invalid 00431 * 00432 * NOTES 00433 * pSrcRect specifies the dimensions of the source data; 00434 * negative values for pSrcRect are allowed as we're only looking at the width and height anyway. 00435 * 00436 */ 00437 HRESULT WINAPI D3DXLoadSurfaceFromMemory(LPDIRECT3DSURFACE9 pDestSurface, 00438 CONST PALETTEENTRY *pDestPalette, 00439 CONST RECT *pDestRect, 00440 LPCVOID pSrcMemory, 00441 D3DFORMAT SrcFormat, 00442 UINT SrcPitch, 00443 CONST PALETTEENTRY *pSrcPalette, 00444 CONST RECT *pSrcRect, 00445 DWORD dwFilter, 00446 D3DCOLOR Colorkey) 00447 { 00448 CONST PixelFormatDesc *srcformatdesc, *destformatdesc; 00449 D3DSURFACE_DESC surfdesc; 00450 D3DLOCKED_RECT lockrect; 00451 POINT srcsize, destsize; 00452 HRESULT hr; 00453 TRACE("(void)\n"); 00454 00455 if( !pDestSurface || !pSrcMemory || !pSrcRect ) return D3DERR_INVALIDCALL; 00456 if(SrcFormat == D3DFMT_UNKNOWN || pSrcRect->left >= pSrcRect->right || pSrcRect->top >= pSrcRect->bottom) return E_FAIL; 00457 00458 if(dwFilter != D3DX_FILTER_NONE) return E_NOTIMPL; 00459 00460 IDirect3DSurface9_GetDesc(pDestSurface, &surfdesc); 00461 00462 srcformatdesc = get_format_info(SrcFormat); 00463 destformatdesc = get_format_info(surfdesc.Format); 00464 if( srcformatdesc->type == FORMAT_UNKNOWN || srcformatdesc->bytes_per_pixel > 4) return E_NOTIMPL; 00465 if(destformatdesc->type == FORMAT_UNKNOWN || destformatdesc->bytes_per_pixel > 4) return E_NOTIMPL; 00466 00467 srcsize.x = pSrcRect->right - pSrcRect->left; 00468 srcsize.y = pSrcRect->bottom - pSrcRect->top; 00469 if( !pDestRect ) { 00470 destsize.x = surfdesc.Width; 00471 destsize.y = surfdesc.Height; 00472 } else { 00473 destsize.x = pDestRect->right - pDestRect->left; 00474 destsize.y = pDestRect->bottom - pDestRect->top; 00475 } 00476 00477 hr = IDirect3DSurface9_LockRect(pDestSurface, &lockrect, pDestRect, 0); 00478 if(FAILED(hr)) return D3DXERR_INVALIDDATA; 00479 00480 copy_simple_data((CONST BYTE*)pSrcMemory, SrcPitch, srcsize, srcformatdesc, 00481 (CONST BYTE*)lockrect.pBits, lockrect.Pitch, destsize, destformatdesc, 00482 dwFilter); 00483 00484 IDirect3DSurface9_UnlockRect(pDestSurface); 00485 return D3D_OK; 00486 } 00487 00488 /************************************************************ 00489 * D3DXLoadSurfaceFromSurface 00490 * 00491 * Copies the contents from one surface to another, performing any required 00492 * format conversion, resizing or filtering. 00493 * 00494 * PARAMS 00495 * pDestSurface [I] pointer to the destination surface 00496 * pDestPalette [I] palette to use 00497 * pDestRect [I] to be filled area of the surface 00498 * pSrcSurface [I] pointer to the source surface 00499 * pSrcPalette [I] palette used for the source surface 00500 * pSrcRect [I] area of the source data to load 00501 * dwFilter [I] filter to apply on resizing 00502 * Colorkey [I] any ARGB value or 0 to disable color-keying 00503 * 00504 * RETURNS 00505 * Success: D3D_OK 00506 * Failure: D3DERR_INVALIDCALL, if pDestSurface or pSrcSurface are NULL 00507 * D3DXERR_INVALIDDATA, if one of the surfaces is not lockable 00508 * 00509 */ 00510 HRESULT WINAPI D3DXLoadSurfaceFromSurface(LPDIRECT3DSURFACE9 pDestSurface, 00511 CONST PALETTEENTRY *pDestPalette, 00512 CONST RECT *pDestRect, 00513 LPDIRECT3DSURFACE9 pSrcSurface, 00514 CONST PALETTEENTRY *pSrcPalette, 00515 CONST RECT *pSrcRect, 00516 DWORD dwFilter, 00517 D3DCOLOR Colorkey) 00518 { 00519 RECT rect; 00520 D3DLOCKED_RECT lock; 00521 D3DSURFACE_DESC SrcDesc; 00522 HRESULT hr; 00523 TRACE("(void): relay\n"); 00524 00525 if( !pDestSurface || !pSrcSurface ) return D3DERR_INVALIDCALL; 00526 00527 IDirect3DSurface9_GetDesc(pSrcSurface, &SrcDesc); 00528 00529 if( !pSrcRect ) SetRect(&rect, 0, 0, SrcDesc.Width, SrcDesc.Height); 00530 else rect = *pSrcRect; 00531 00532 hr = IDirect3DSurface9_LockRect(pSrcSurface, &lock, NULL, D3DLOCK_READONLY); 00533 if(FAILED(hr)) return D3DXERR_INVALIDDATA; 00534 00535 hr = D3DXLoadSurfaceFromMemory(pDestSurface, pDestPalette, pDestRect, 00536 lock.pBits, SrcDesc.Format, lock.Pitch, 00537 pSrcPalette, &rect, dwFilter, Colorkey); 00538 00539 IDirect3DSurface9_UnlockRect(pSrcSurface); 00540 return hr; 00541 } Generated on Sun May 27 2012 04:22:04 for ReactOS by
1.7.6.1
|