msvcrt: Use per thread locale in many functions.
[wine] / dlls / d3dx9_36 / texture.c
1 /*
2  * Copyright 2010 Christian Costa
3  *
4  * This library is free software; you can redistribute it and/or
5  * modify it under the terms of the GNU Lesser General Public
6  * License as published by the Free Software Foundation; either
7  * version 2.1 of the License, or (at your option) any later version.
8  *
9  * This library is distributed in the hope that it will be useful,
10  * but WITHOUT ANY WARRANTY; without even the implied warranty of
11  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
12  * Lesser General Public License for more details.
13  *
14  * You should have received a copy of the GNU Lesser General Public
15  * License along with this library; if not, write to the Free Software
16  * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
17  */
18
19 #include "wine/debug.h"
20 #include "d3dx9_36_private.h"
21
22 WINE_DEFAULT_DEBUG_CHANNEL(d3dx);
23
24 HRESULT WINAPI D3DXCheckTextureRequirements(LPDIRECT3DDEVICE9 device,
25                                             UINT* width,
26                                             UINT* height,
27                                             UINT* miplevels,
28                                             DWORD usage,
29                                             D3DFORMAT* format,
30                                             D3DPOOL pool)
31 {
32     FIXME("(%p, %p, %p, %p, %u, %p, %u): stub\n", device, width, height, miplevels, usage, format, pool);
33
34     return E_NOTIMPL;
35 }
36
37 HRESULT WINAPI D3DXCreateTexture(LPDIRECT3DDEVICE9 pDevice,
38                                  UINT width,
39                                  UINT height,
40                                  UINT miplevels,
41                                  DWORD usage,
42                                  D3DFORMAT format,
43                                  D3DPOOL pool,
44                                  LPDIRECT3DTEXTURE9 *ppTexture)
45 {
46     FIXME("(%p, %u, %u, %u, %x, %x, %x, %p): semi-stub\n", pDevice, width, height, miplevels, usage, format,
47         pool, ppTexture);
48
49     return IDirect3DDevice9_CreateTexture(pDevice, width, height, miplevels, usage, format, pool, ppTexture, NULL);
50 }
51
52 HRESULT WINAPI D3DXCreateTextureFromFileInMemoryEx(LPDIRECT3DDEVICE9 device,
53                                                    LPCVOID srcdata,
54                                                    UINT srcdatasize,
55                                                    UINT width,
56                                                    UINT height,
57                                                    UINT miplevels,
58                                                    DWORD usage,
59                                                    D3DFORMAT format,
60                                                    D3DPOOL pool,
61                                                    DWORD filter,
62                                                    DWORD mipfilter,
63                                                    D3DCOLOR colorkey,
64                                                    D3DXIMAGE_INFO* srcinfo,
65                                                    PALETTEENTRY* palette,
66                                                    LPDIRECT3DTEXTURE9* texture)
67 {
68     FIXME("(%p, %p, %u, %u, %u, %u, %x, %x, %x, %u, %u, %x, %p, %p, %p): stub\n", device, srcdata, srcdatasize, width,
69         height, miplevels, usage, format, pool, filter, mipfilter, colorkey, srcinfo, palette, texture);
70
71     return E_NOTIMPL;
72 }
73
74 HRESULT WINAPI D3DXCreateTextureFromFileExW(LPDIRECT3DDEVICE9 device,
75                                             LPCWSTR srcfile,
76                                             UINT width,
77                                             UINT height,
78                                             UINT miplevels,
79                                             DWORD usage,
80                                             D3DFORMAT format,
81                                             D3DPOOL pool,
82                                             DWORD filter,
83                                             DWORD mipfilter,
84                                             D3DCOLOR colorkey,
85                                             D3DXIMAGE_INFO *srcinfo,
86                                             PALETTEENTRY *palette,
87                                             LPDIRECT3DTEXTURE9 *texture)
88 {
89     HRESULT hr;
90     DWORD size;
91     LPVOID buffer;
92
93     TRACE("(%p, %p, %u, %u, %u, %x, %x, %x, %u, %u, %x, %p, %p, %p): relay\n", device, debugstr_w(srcfile), width,
94         height, miplevels, usage, format, pool, filter, mipfilter, colorkey, srcinfo, palette, texture);
95
96     if (!srcfile)
97         return D3DERR_INVALIDCALL;
98
99     hr = map_view_of_file(srcfile, &buffer, &size);
100     if (FAILED(hr))
101         return D3DXERR_INVALIDDATA;
102
103     hr = D3DXCreateTextureFromFileInMemoryEx(device, buffer, size, width, height, miplevels, usage, format, pool,
104         filter, mipfilter, colorkey, srcinfo, palette, texture);
105
106     UnmapViewOfFile(buffer);
107
108     return hr;
109 }
110
111 HRESULT WINAPI D3DXCreateTextureFromFileA(LPDIRECT3DDEVICE9 device,
112                                           LPCSTR srcfile,
113                                           LPDIRECT3DTEXTURE9 *texture)
114 {
115     FIXME("(%p, %s, %p): stub\n", device, debugstr_a(srcfile), texture);
116
117     return E_NOTIMPL;
118 }