[D3DRM] Sync with Wine Staging 1.7.55. CORE-10536
[reactos.git] / reactos / dll / directx / wine / d3drm / texture.c
1 /*
2 * Implementation of IDirect3DRMTextureX interfaces
3 *
4 * Copyright 2012 Christian Costa
5 *
6 * This library is free software; you can redistribute it and/or
7 * modify it under the terms of the GNU Lesser General Public
8 * License as published by the Free Software Foundation; either
9 * version 2.1 of the License, or (at your option) any later version.
10 *
11 * This library 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 GNU
14 * Lesser General Public License for more details.
15 *
16 * You should have received a copy of the GNU Lesser General Public
17 * License along with this library; if not, write to the Free Software
18 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
19 */
20
21 #include "d3drm_private.h"
22
23 struct d3drm_texture
24 {
25 IDirect3DRMTexture IDirect3DRMTexture_iface;
26 IDirect3DRMTexture2 IDirect3DRMTexture2_iface;
27 IDirect3DRMTexture3 IDirect3DRMTexture3_iface;
28 LONG ref;
29 DWORD app_data;
30 };
31
32 static inline struct d3drm_texture *impl_from_IDirect3DRMTexture(IDirect3DRMTexture *iface)
33 {
34 return CONTAINING_RECORD(iface, struct d3drm_texture, IDirect3DRMTexture_iface);
35 }
36
37 static inline struct d3drm_texture *impl_from_IDirect3DRMTexture2(IDirect3DRMTexture2 *iface)
38 {
39 return CONTAINING_RECORD(iface, struct d3drm_texture, IDirect3DRMTexture2_iface);
40 }
41
42 static inline struct d3drm_texture *impl_from_IDirect3DRMTexture3(IDirect3DRMTexture3 *iface)
43 {
44 return CONTAINING_RECORD(iface, struct d3drm_texture, IDirect3DRMTexture3_iface);
45 }
46
47 static HRESULT WINAPI d3drm_texture1_QueryInterface(IDirect3DRMTexture *iface, REFIID riid, void **out)
48 {
49 struct d3drm_texture *texture = impl_from_IDirect3DRMTexture(iface);
50
51 TRACE("iface %p, riid %s, out %p.\n", iface, debugstr_guid(riid), out);
52
53 return IDirect3DRMTexture3_QueryInterface(&texture->IDirect3DRMTexture3_iface, riid, out);
54 }
55
56 static ULONG WINAPI d3drm_texture1_AddRef(IDirect3DRMTexture *iface)
57 {
58 struct d3drm_texture *texture = impl_from_IDirect3DRMTexture(iface);
59
60 TRACE("iface %p.\n", iface);
61
62 return IDirect3DRMTexture3_AddRef(&texture->IDirect3DRMTexture3_iface);
63 }
64
65 static ULONG WINAPI d3drm_texture1_Release(IDirect3DRMTexture *iface)
66 {
67 struct d3drm_texture *texture = impl_from_IDirect3DRMTexture(iface);
68
69 TRACE("iface %p.\n", iface);
70
71 return IDirect3DRMTexture3_Release(&texture->IDirect3DRMTexture3_iface);
72 }
73
74 static HRESULT WINAPI d3drm_texture1_Clone(IDirect3DRMTexture *iface,
75 IUnknown *outer, REFIID iid, void **out)
76 {
77 struct d3drm_texture *texture = impl_from_IDirect3DRMTexture(iface);
78
79 TRACE("iface %p, outer %p, iid %s, out %p.\n", iface, outer, debugstr_guid(iid), out);
80
81 return IDirect3DRMTexture3_Clone(&texture->IDirect3DRMTexture3_iface, outer, iid, out);
82 }
83
84 static HRESULT WINAPI d3drm_texture1_AddDestroyCallback(IDirect3DRMTexture *iface,
85 D3DRMOBJECTCALLBACK cb, void *ctx)
86 {
87 FIXME("iface %p, cb %p, ctx %p stub!\n", iface, cb, ctx);
88
89 return E_NOTIMPL;
90 }
91
92 static HRESULT WINAPI d3drm_texture1_DeleteDestroyCallback(IDirect3DRMTexture *iface,
93 D3DRMOBJECTCALLBACK cb, void *ctx)
94 {
95 FIXME("iface %p, cb %p, ctx %p stub!\n", iface, cb, ctx);
96
97 return E_NOTIMPL;
98 }
99
100 static HRESULT WINAPI d3drm_texture1_SetAppData(IDirect3DRMTexture *iface, DWORD data)
101 {
102 struct d3drm_texture *texture = impl_from_IDirect3DRMTexture(iface);
103
104 TRACE("iface %p, data %#x.\n", iface, data);
105
106 return IDirect3DRMTexture3_SetAppData(&texture->IDirect3DRMTexture3_iface, data);
107 }
108
109 static DWORD WINAPI d3drm_texture1_GetAppData(IDirect3DRMTexture *iface)
110 {
111 struct d3drm_texture *texture = impl_from_IDirect3DRMTexture(iface);
112
113 TRACE("iface %p.\n", iface);
114
115 return IDirect3DRMTexture3_GetAppData(&texture->IDirect3DRMTexture3_iface);
116 }
117
118 static HRESULT WINAPI d3drm_texture1_SetName(IDirect3DRMTexture *iface, const char *name)
119 {
120 struct d3drm_texture *texture = impl_from_IDirect3DRMTexture(iface);
121
122 TRACE("iface %p, name %s.\n", iface, debugstr_a(name));
123
124 return IDirect3DRMTexture3_SetName(&texture->IDirect3DRMTexture3_iface, name);
125 }
126
127 static HRESULT WINAPI d3drm_texture1_GetName(IDirect3DRMTexture *iface, DWORD *size, char *name)
128 {
129 struct d3drm_texture *texture = impl_from_IDirect3DRMTexture(iface);
130
131 TRACE("iface %p, size %p, name %p.\n", iface, size, name);
132
133 return IDirect3DRMTexture3_GetName(&texture->IDirect3DRMTexture3_iface, size, name);
134 }
135
136 static HRESULT WINAPI d3drm_texture1_GetClassName(IDirect3DRMTexture *iface, DWORD *size, char *name)
137 {
138 struct d3drm_texture *texture = impl_from_IDirect3DRMTexture(iface);
139
140 TRACE("iface %p, size %p, name %p.\n", iface, size, name);
141
142 return IDirect3DRMTexture3_GetClassName(&texture->IDirect3DRMTexture3_iface, size, name);
143 }
144
145 static HRESULT WINAPI d3drm_texture1_InitFromFile(IDirect3DRMTexture *iface, const char *filename)
146 {
147 FIXME("iface %p, filename %s stub!\n", iface, debugstr_a(filename));
148
149 return E_NOTIMPL;
150 }
151
152 static HRESULT WINAPI d3drm_texture1_InitFromSurface(IDirect3DRMTexture *iface,
153 IDirectDrawSurface *surface)
154 {
155 FIXME("iface %p, surface %p stub!\n", iface, surface);
156
157 return E_NOTIMPL;
158 }
159
160 static HRESULT WINAPI d3drm_texture1_InitFromResource(IDirect3DRMTexture *iface, HRSRC resource)
161 {
162 FIXME("iface %p, resource %p stub!\n", iface, resource);
163
164 return E_NOTIMPL;
165 }
166
167 static HRESULT WINAPI d3drm_texture1_Changed(IDirect3DRMTexture *iface, BOOL pixels, BOOL palette)
168 {
169 FIXME("iface %p, pixels %#x, palette %#x stub!\n", iface, pixels, palette);
170
171 return E_NOTIMPL;
172 }
173
174 static HRESULT WINAPI d3drm_texture1_SetColors(IDirect3DRMTexture *iface, DWORD max_colors)
175 {
176 struct d3drm_texture *texture = impl_from_IDirect3DRMTexture(iface);
177
178 TRACE("iface %p, max_colors %u.\n", iface, max_colors);
179
180 return IDirect3DRMTexture3_SetColors(&texture->IDirect3DRMTexture3_iface, max_colors);
181 }
182
183 static HRESULT WINAPI d3drm_texture1_SetShades(IDirect3DRMTexture *iface, DWORD max_shades)
184 {
185 struct d3drm_texture *texture = impl_from_IDirect3DRMTexture(iface);
186
187 TRACE("iface %p, max_shades %u.\n", iface, max_shades);
188
189 return IDirect3DRMTexture3_SetShades(&texture->IDirect3DRMTexture3_iface, max_shades);
190 }
191
192 static HRESULT WINAPI d3drm_texture1_SetDecalSize(IDirect3DRMTexture *iface, D3DVALUE width, D3DVALUE height)
193 {
194 struct d3drm_texture *texture = impl_from_IDirect3DRMTexture(iface);
195
196 TRACE("iface %p, width %.8e, height %.8e stub!\n", iface, width, height);
197
198 return IDirect3DRMTexture3_SetDecalSize(&texture->IDirect3DRMTexture3_iface, width, height);
199 }
200
201 static HRESULT WINAPI d3drm_texture1_SetDecalOrigin(IDirect3DRMTexture *iface, LONG x, LONG y)
202 {
203 struct d3drm_texture *texture = impl_from_IDirect3DRMTexture(iface);
204
205 TRACE("iface %p, x %d, y %d.\n", iface, x, y);
206
207 return IDirect3DRMTexture3_SetDecalOrigin(&texture->IDirect3DRMTexture3_iface, x, y);
208 }
209
210 static HRESULT WINAPI d3drm_texture1_SetDecalScale(IDirect3DRMTexture *iface, DWORD scale)
211 {
212 struct d3drm_texture *texture = impl_from_IDirect3DRMTexture(iface);
213
214 TRACE("iface %p, scale %u.\n", iface, scale);
215
216 return IDirect3DRMTexture3_SetDecalScale(&texture->IDirect3DRMTexture3_iface, scale);
217 }
218
219 static HRESULT WINAPI d3drm_texture1_SetDecalTransparency(IDirect3DRMTexture *iface, BOOL transparency)
220 {
221 struct d3drm_texture *texture = impl_from_IDirect3DRMTexture(iface);
222
223 TRACE("iface %p, transparency %#x.\n", iface, transparency);
224
225 return IDirect3DRMTexture3_SetDecalTransparency(&texture->IDirect3DRMTexture3_iface, transparency);
226 }
227
228 static HRESULT WINAPI d3drm_texture1_SetDecalTransparentColor(IDirect3DRMTexture *iface, D3DCOLOR color)
229 {
230 struct d3drm_texture *texture = impl_from_IDirect3DRMTexture(iface);
231
232 TRACE("iface %p, color 0x%08x.\n", iface, color);
233
234 return IDirect3DRMTexture3_SetDecalTransparentColor(&texture->IDirect3DRMTexture3_iface, color);
235 }
236
237 static HRESULT WINAPI d3drm_texture1_GetDecalSize(IDirect3DRMTexture *iface, D3DVALUE *width, D3DVALUE *height)
238 {
239 struct d3drm_texture *texture = impl_from_IDirect3DRMTexture(iface);
240
241 TRACE("iface %p, width %p, height %p.\n", iface, width, height);
242
243 return IDirect3DRMTexture3_GetDecalSize(&texture->IDirect3DRMTexture3_iface, width, height);
244 }
245
246 static HRESULT WINAPI d3drm_texture1_GetDecalOrigin(IDirect3DRMTexture *iface, LONG *x, LONG *y)
247 {
248 struct d3drm_texture *texture = impl_from_IDirect3DRMTexture(iface);
249
250 TRACE("iface %p, x %p, y %p.\n", iface, x, y);
251
252 return IDirect3DRMTexture3_GetDecalOrigin(&texture->IDirect3DRMTexture3_iface, x, y);
253 }
254
255 static D3DRMIMAGE * WINAPI d3drm_texture1_GetImage(IDirect3DRMTexture *iface)
256 {
257 struct d3drm_texture *texture = impl_from_IDirect3DRMTexture(iface);
258
259 TRACE("iface %p.\n", iface);
260
261 return IDirect3DRMTexture3_GetImage(&texture->IDirect3DRMTexture3_iface);
262 }
263
264 static DWORD WINAPI d3drm_texture1_GetShades(IDirect3DRMTexture *iface)
265 {
266 struct d3drm_texture *texture = impl_from_IDirect3DRMTexture(iface);
267
268 TRACE("iface %p.\n", iface);
269
270 return IDirect3DRMTexture3_GetShades(&texture->IDirect3DRMTexture3_iface);
271 }
272
273 static DWORD WINAPI d3drm_texture1_GetColors(IDirect3DRMTexture *iface)
274 {
275 struct d3drm_texture *texture = impl_from_IDirect3DRMTexture(iface);
276
277 TRACE("iface %p.\n", iface);
278
279 return IDirect3DRMTexture3_GetColors(&texture->IDirect3DRMTexture3_iface);
280 }
281
282 static DWORD WINAPI d3drm_texture1_GetDecalScale(IDirect3DRMTexture *iface)
283 {
284 struct d3drm_texture *texture = impl_from_IDirect3DRMTexture(iface);
285
286 TRACE("iface %p.\n", iface);
287
288 return IDirect3DRMTexture3_GetDecalScale(&texture->IDirect3DRMTexture3_iface);
289 }
290
291 static BOOL WINAPI d3drm_texture1_GetDecalTransparency(IDirect3DRMTexture *iface)
292 {
293 struct d3drm_texture *texture = impl_from_IDirect3DRMTexture(iface);
294
295 TRACE("iface %p.\n", iface);
296
297 return IDirect3DRMTexture3_GetDecalTransparency(&texture->IDirect3DRMTexture3_iface);
298 }
299
300 static D3DCOLOR WINAPI d3drm_texture1_GetDecalTransparentColor(IDirect3DRMTexture *iface)
301 {
302 struct d3drm_texture *texture = impl_from_IDirect3DRMTexture(iface);
303
304 TRACE("iface %p.\n", iface);
305
306 return IDirect3DRMTexture3_GetDecalTransparentColor(&texture->IDirect3DRMTexture3_iface);
307 }
308
309 static const struct IDirect3DRMTextureVtbl d3drm_texture1_vtbl =
310 {
311 d3drm_texture1_QueryInterface,
312 d3drm_texture1_AddRef,
313 d3drm_texture1_Release,
314 d3drm_texture1_Clone,
315 d3drm_texture1_AddDestroyCallback,
316 d3drm_texture1_DeleteDestroyCallback,
317 d3drm_texture1_SetAppData,
318 d3drm_texture1_GetAppData,
319 d3drm_texture1_SetName,
320 d3drm_texture1_GetName,
321 d3drm_texture1_GetClassName,
322 d3drm_texture1_InitFromFile,
323 d3drm_texture1_InitFromSurface,
324 d3drm_texture1_InitFromResource,
325 d3drm_texture1_Changed,
326 d3drm_texture1_SetColors,
327 d3drm_texture1_SetShades,
328 d3drm_texture1_SetDecalSize,
329 d3drm_texture1_SetDecalOrigin,
330 d3drm_texture1_SetDecalScale,
331 d3drm_texture1_SetDecalTransparency,
332 d3drm_texture1_SetDecalTransparentColor,
333 d3drm_texture1_GetDecalSize,
334 d3drm_texture1_GetDecalOrigin,
335 d3drm_texture1_GetImage,
336 d3drm_texture1_GetShades,
337 d3drm_texture1_GetColors,
338 d3drm_texture1_GetDecalScale,
339 d3drm_texture1_GetDecalTransparency,
340 d3drm_texture1_GetDecalTransparentColor,
341 };
342
343 static HRESULT WINAPI d3drm_texture2_QueryInterface(IDirect3DRMTexture2 *iface, REFIID riid, void **out)
344 {
345 struct d3drm_texture *texture = impl_from_IDirect3DRMTexture2(iface);
346
347 TRACE("iface %p, riid %s, out %p.\n", iface, debugstr_guid(riid), out);
348
349 return IDirect3DRMTexture3_QueryInterface(&texture->IDirect3DRMTexture3_iface, riid, out);
350 }
351
352 static ULONG WINAPI d3drm_texture2_AddRef(IDirect3DRMTexture2 *iface)
353 {
354 struct d3drm_texture *texture = impl_from_IDirect3DRMTexture2(iface);
355
356 TRACE("iface %p.\n", iface);
357
358 return IDirect3DRMTexture3_AddRef(&texture->IDirect3DRMTexture3_iface);
359 }
360
361 static ULONG WINAPI d3drm_texture2_Release(IDirect3DRMTexture2 *iface)
362 {
363 struct d3drm_texture *texture = impl_from_IDirect3DRMTexture2(iface);
364
365 TRACE("iface %p.\n", iface);
366
367 return IDirect3DRMTexture3_Release(&texture->IDirect3DRMTexture3_iface);
368 }
369
370 static HRESULT WINAPI d3drm_texture2_Clone(IDirect3DRMTexture2 *iface,
371 IUnknown *outer, REFIID iid, void **out)
372 {
373 struct d3drm_texture *texture = impl_from_IDirect3DRMTexture2(iface);
374
375 TRACE("iface %p, outer %p, iid %s, out %p.\n", iface, outer, debugstr_guid(iid), out);
376
377 return IDirect3DRMTexture3_Clone(&texture->IDirect3DRMTexture3_iface, outer, iid, out);
378 }
379
380 static HRESULT WINAPI d3drm_texture2_AddDestroyCallback(IDirect3DRMTexture2 *iface,
381 D3DRMOBJECTCALLBACK cb, void *ctx)
382 {
383 FIXME("iface %p, cb %p, ctx %p stub!\n", iface, cb, ctx);
384
385 return E_NOTIMPL;
386 }
387
388 static HRESULT WINAPI d3drm_texture2_DeleteDestroyCallback(IDirect3DRMTexture2 *iface,
389 D3DRMOBJECTCALLBACK cb, void *ctx)
390 {
391 FIXME("iface %p, cb %p, ctx %p stub!\n", iface, cb, ctx);
392
393 return E_NOTIMPL;
394 }
395
396 static HRESULT WINAPI d3drm_texture2_SetAppData(IDirect3DRMTexture2 *iface, DWORD data)
397 {
398 struct d3drm_texture *texture = impl_from_IDirect3DRMTexture2(iface);
399
400 TRACE("iface %p, data %#x.\n", iface, data);
401
402 return IDirect3DRMTexture3_SetAppData(&texture->IDirect3DRMTexture3_iface, data);
403 }
404
405 static DWORD WINAPI d3drm_texture2_GetAppData(IDirect3DRMTexture2 *iface)
406 {
407 struct d3drm_texture *texture = impl_from_IDirect3DRMTexture2(iface);
408
409 TRACE("iface %p.\n", iface);
410
411 return IDirect3DRMTexture3_GetAppData(&texture->IDirect3DRMTexture3_iface);
412 }
413
414 static HRESULT WINAPI d3drm_texture2_SetName(IDirect3DRMTexture2 *iface, const char *name)
415 {
416 struct d3drm_texture *texture = impl_from_IDirect3DRMTexture2(iface);
417
418 TRACE("iface %p, name %s.\n", iface, debugstr_a(name));
419
420 return IDirect3DRMTexture3_SetName(&texture->IDirect3DRMTexture3_iface, name);
421 }
422
423 static HRESULT WINAPI d3drm_texture2_GetName(IDirect3DRMTexture2 *iface, DWORD *size, char *name)
424 {
425 struct d3drm_texture *texture = impl_from_IDirect3DRMTexture2(iface);
426
427 TRACE("iface %p, size %p, name %p.\n", iface, size, name);
428
429 return IDirect3DRMTexture3_GetName(&texture->IDirect3DRMTexture3_iface, size, name);
430 }
431
432 static HRESULT WINAPI d3drm_texture2_GetClassName(IDirect3DRMTexture2 *iface, DWORD *size, char *name)
433 {
434 struct d3drm_texture *texture = impl_from_IDirect3DRMTexture2(iface);
435
436 TRACE("iface %p, size %p, name %p.\n", iface, size, name);
437
438 return IDirect3DRMTexture3_GetClassName(&texture->IDirect3DRMTexture3_iface, size, name);
439 }
440
441 static HRESULT WINAPI d3drm_texture2_InitFromFile(IDirect3DRMTexture2 *iface, const char *filename)
442 {
443 FIXME("iface %p, filename %s stub!\n", iface, debugstr_a(filename));
444
445 return E_NOTIMPL;
446 }
447
448 static HRESULT WINAPI d3drm_texture2_InitFromSurface(IDirect3DRMTexture2 *iface,
449 IDirectDrawSurface *surface)
450 {
451 FIXME("iface %p, surface %p stub!\n", iface, surface);
452
453 return E_NOTIMPL;
454 }
455
456 static HRESULT WINAPI d3drm_texture2_InitFromResource(IDirect3DRMTexture2 *iface, HRSRC resource)
457 {
458 FIXME("iface %p, resource %p stub!\n", iface, resource);
459
460 return E_NOTIMPL;
461 }
462
463 static HRESULT WINAPI d3drm_texture2_Changed(IDirect3DRMTexture2 *iface, BOOL pixels, BOOL palette)
464 {
465 FIXME("iface %p, pixels %#x, palette %#x stub!\n", iface, pixels, palette);
466
467 return E_NOTIMPL;
468 }
469
470 static HRESULT WINAPI d3drm_texture2_SetColors(IDirect3DRMTexture2 *iface, DWORD max_colors)
471 {
472 struct d3drm_texture *texture = impl_from_IDirect3DRMTexture2(iface);
473
474 TRACE("iface %p, max_colors %u.\n", iface, max_colors);
475
476 return IDirect3DRMTexture3_SetColors(&texture->IDirect3DRMTexture3_iface, max_colors);
477 }
478
479 static HRESULT WINAPI d3drm_texture2_SetShades(IDirect3DRMTexture2 *iface, DWORD max_shades)
480 {
481 struct d3drm_texture *texture = impl_from_IDirect3DRMTexture2(iface);
482
483 TRACE("iface %p, max_shades %u.\n", iface, max_shades);
484
485 return IDirect3DRMTexture3_SetShades(&texture->IDirect3DRMTexture3_iface, max_shades);
486 }
487
488 static HRESULT WINAPI d3drm_texture2_SetDecalSize(IDirect3DRMTexture2 *iface, D3DVALUE width, D3DVALUE height)
489 {
490 struct d3drm_texture *texture = impl_from_IDirect3DRMTexture2(iface);
491
492 TRACE("iface %p, width %.8e, height %.8e stub!\n", iface, width, height);
493
494 return IDirect3DRMTexture3_SetDecalSize(&texture->IDirect3DRMTexture3_iface, width, height);
495 }
496
497 static HRESULT WINAPI d3drm_texture2_SetDecalOrigin(IDirect3DRMTexture2 *iface, LONG x, LONG y)
498 {
499 struct d3drm_texture *texture = impl_from_IDirect3DRMTexture2(iface);
500
501 TRACE("iface %p, x %d, y %d.\n", iface, x, y);
502
503 return IDirect3DRMTexture3_SetDecalOrigin(&texture->IDirect3DRMTexture3_iface, x, y);
504 }
505
506 static HRESULT WINAPI d3drm_texture2_SetDecalScale(IDirect3DRMTexture2 *iface, DWORD scale)
507 {
508 struct d3drm_texture *texture = impl_from_IDirect3DRMTexture2(iface);
509
510 TRACE("iface %p, scale %u.\n", iface, scale);
511
512 return IDirect3DRMTexture3_SetDecalScale(&texture->IDirect3DRMTexture3_iface, scale);
513 }
514
515 static HRESULT WINAPI d3drm_texture2_SetDecalTransparency(IDirect3DRMTexture2 *iface, BOOL transparency)
516 {
517 struct d3drm_texture *texture = impl_from_IDirect3DRMTexture2(iface);
518
519 TRACE("iface %p, transparency %#x.\n", iface, transparency);
520
521 return IDirect3DRMTexture3_SetDecalTransparency(&texture->IDirect3DRMTexture3_iface, transparency);
522 }
523
524 static HRESULT WINAPI d3drm_texture2_SetDecalTransparentColor(IDirect3DRMTexture2 *iface, D3DCOLOR color)
525 {
526 struct d3drm_texture *texture = impl_from_IDirect3DRMTexture2(iface);
527
528 TRACE("iface %p, color 0x%08x.\n", iface, color);
529
530 return IDirect3DRMTexture3_SetDecalTransparentColor(&texture->IDirect3DRMTexture3_iface, color);
531 }
532
533 static HRESULT WINAPI d3drm_texture2_GetDecalSize(IDirect3DRMTexture2 *iface, D3DVALUE *width, D3DVALUE *height)
534 {
535 struct d3drm_texture *texture = impl_from_IDirect3DRMTexture2(iface);
536
537 TRACE("iface %p, width %p, height %p.\n", iface, width, height);
538
539 return IDirect3DRMTexture3_GetDecalSize(&texture->IDirect3DRMTexture3_iface, width, height);
540 }
541
542 static HRESULT WINAPI d3drm_texture2_GetDecalOrigin(IDirect3DRMTexture2 *iface, LONG *x, LONG *y)
543 {
544 struct d3drm_texture *texture = impl_from_IDirect3DRMTexture2(iface);
545
546 TRACE("iface %p, x %p, y %p.\n", iface, x, y);
547
548 return IDirect3DRMTexture3_GetDecalOrigin(&texture->IDirect3DRMTexture3_iface, x, y);
549 }
550
551 static D3DRMIMAGE * WINAPI d3drm_texture2_GetImage(IDirect3DRMTexture2 *iface)
552 {
553 struct d3drm_texture *texture = impl_from_IDirect3DRMTexture2(iface);
554
555 TRACE("iface %p.\n", iface);
556
557 return IDirect3DRMTexture3_GetImage(&texture->IDirect3DRMTexture3_iface);
558 }
559
560 static DWORD WINAPI d3drm_texture2_GetShades(IDirect3DRMTexture2 *iface)
561 {
562 struct d3drm_texture *texture = impl_from_IDirect3DRMTexture2(iface);
563
564 TRACE("iface %p.\n", iface);
565
566 return IDirect3DRMTexture3_GetShades(&texture->IDirect3DRMTexture3_iface);
567 }
568
569 static DWORD WINAPI d3drm_texture2_GetColors(IDirect3DRMTexture2 *iface)
570 {
571 struct d3drm_texture *texture = impl_from_IDirect3DRMTexture2(iface);
572
573 TRACE("iface %p.\n", iface);
574
575 return IDirect3DRMTexture3_GetColors(&texture->IDirect3DRMTexture3_iface);
576 }
577
578 static DWORD WINAPI d3drm_texture2_GetDecalScale(IDirect3DRMTexture2 *iface)
579 {
580 struct d3drm_texture *texture = impl_from_IDirect3DRMTexture2(iface);
581
582 TRACE("iface %p.\n", iface);
583
584 return IDirect3DRMTexture3_GetDecalScale(&texture->IDirect3DRMTexture3_iface);
585 }
586
587 static BOOL WINAPI d3drm_texture2_GetDecalTransparency(IDirect3DRMTexture2 *iface)
588 {
589 struct d3drm_texture *texture = impl_from_IDirect3DRMTexture2(iface);
590
591 TRACE("iface %p.\n", iface);
592
593 return IDirect3DRMTexture3_GetDecalTransparency(&texture->IDirect3DRMTexture3_iface);
594 }
595
596 static D3DCOLOR WINAPI d3drm_texture2_GetDecalTransparentColor(IDirect3DRMTexture2 *iface)
597 {
598 struct d3drm_texture *texture = impl_from_IDirect3DRMTexture2(iface);
599
600 TRACE("iface %p.\n", iface);
601
602 return IDirect3DRMTexture3_GetDecalTransparentColor(&texture->IDirect3DRMTexture3_iface);
603 }
604
605 static HRESULT WINAPI d3drm_texture2_InitFromImage(IDirect3DRMTexture2 *iface, D3DRMIMAGE *image)
606 {
607 FIXME("iface %p, image %p stub!\n", iface, image);
608
609 return E_NOTIMPL;
610 }
611
612 static HRESULT WINAPI d3drm_texture2_InitFromResource2(IDirect3DRMTexture2 *iface,
613 HMODULE module, const char *name, const char *type)
614 {
615 FIXME("iface %p, module %p, name %s, type %s stub!\n",
616 iface, module, debugstr_a(name), debugstr_a(type));
617
618 return E_NOTIMPL;
619 }
620
621 static HRESULT WINAPI d3drm_texture2_GenerateMIPMap(IDirect3DRMTexture2 *iface, DWORD flags)
622 {
623 struct d3drm_texture *texture = impl_from_IDirect3DRMTexture2(iface);
624
625 TRACE("iface %p, flags %#x.\n", iface, flags);
626
627 return IDirect3DRMTexture3_GenerateMIPMap(&texture->IDirect3DRMTexture3_iface, flags);
628 }
629
630 static const struct IDirect3DRMTexture2Vtbl d3drm_texture2_vtbl =
631 {
632 d3drm_texture2_QueryInterface,
633 d3drm_texture2_AddRef,
634 d3drm_texture2_Release,
635 d3drm_texture2_Clone,
636 d3drm_texture2_AddDestroyCallback,
637 d3drm_texture2_DeleteDestroyCallback,
638 d3drm_texture2_SetAppData,
639 d3drm_texture2_GetAppData,
640 d3drm_texture2_SetName,
641 d3drm_texture2_GetName,
642 d3drm_texture2_GetClassName,
643 d3drm_texture2_InitFromFile,
644 d3drm_texture2_InitFromSurface,
645 d3drm_texture2_InitFromResource,
646 d3drm_texture2_Changed,
647 d3drm_texture2_SetColors,
648 d3drm_texture2_SetShades,
649 d3drm_texture2_SetDecalSize,
650 d3drm_texture2_SetDecalOrigin,
651 d3drm_texture2_SetDecalScale,
652 d3drm_texture2_SetDecalTransparency,
653 d3drm_texture2_SetDecalTransparentColor,
654 d3drm_texture2_GetDecalSize,
655 d3drm_texture2_GetDecalOrigin,
656 d3drm_texture2_GetImage,
657 d3drm_texture2_GetShades,
658 d3drm_texture2_GetColors,
659 d3drm_texture2_GetDecalScale,
660 d3drm_texture2_GetDecalTransparency,
661 d3drm_texture2_GetDecalTransparentColor,
662 d3drm_texture2_InitFromImage,
663 d3drm_texture2_InitFromResource2,
664 d3drm_texture2_GenerateMIPMap,
665 };
666
667 static HRESULT WINAPI d3drm_texture3_QueryInterface(IDirect3DRMTexture3 *iface, REFIID riid, void **out)
668 {
669 struct d3drm_texture *texture = impl_from_IDirect3DRMTexture3(iface);
670
671 TRACE("iface %p, riid %s, out %p.\n", iface, debugstr_guid(riid), out);
672
673 if (IsEqualGUID(riid, &IID_IDirect3DRMTexture2)
674 || IsEqualGUID(riid, &IID_IDirect3DRMTexture)
675 || IsEqualGUID(riid, &IID_IUnknown))
676 {
677 *out = &texture->IDirect3DRMTexture2_iface;
678 }
679 else if (IsEqualGUID(riid, &IID_IDirect3DRMTexture3))
680 {
681 *out = &texture->IDirect3DRMTexture3_iface;
682 }
683 else
684 {
685 *out = NULL;
686 WARN("%s not implemented, returning E_NOINTERFACE.\n", debugstr_guid(riid));
687 return E_NOINTERFACE;
688 }
689
690 IUnknown_AddRef((IUnknown *)*out);
691 return S_OK;
692 }
693
694 static ULONG WINAPI d3drm_texture3_AddRef(IDirect3DRMTexture3 *iface)
695 {
696 struct d3drm_texture *texture = impl_from_IDirect3DRMTexture3(iface);
697 ULONG refcount = InterlockedIncrement(&texture->ref);
698
699 TRACE("%p increasing refcount to %u.\n", iface, refcount);
700
701 return refcount;
702 }
703
704 static ULONG WINAPI d3drm_texture3_Release(IDirect3DRMTexture3 *iface)
705 {
706 struct d3drm_texture *texture = impl_from_IDirect3DRMTexture3(iface);
707 ULONG refcount = InterlockedDecrement(&texture->ref);
708
709 TRACE("%p decreasing refcount to %u.\n", iface, refcount);
710
711 if (!refcount)
712 HeapFree(GetProcessHeap(), 0, texture);
713
714 return refcount;
715 }
716
717 static HRESULT WINAPI d3drm_texture3_Clone(IDirect3DRMTexture3 *iface,
718 IUnknown *outer, REFIID iid, void **out)
719 {
720 FIXME("iface %p, outer %p, iid %s, out %p stub!\n", iface, outer, debugstr_guid(iid), out);
721
722 return E_NOTIMPL;
723 }
724
725 static HRESULT WINAPI d3drm_texture3_AddDestroyCallback(IDirect3DRMTexture3 *iface,
726 D3DRMOBJECTCALLBACK cb, void *ctx)
727 {
728 FIXME("iface %p, cb %p, ctx %p stub!\n", iface, cb, ctx);
729
730 return E_NOTIMPL;
731 }
732
733 static HRESULT WINAPI d3drm_texture3_DeleteDestroyCallback(IDirect3DRMTexture3 *iface,
734 D3DRMOBJECTCALLBACK cb, void *ctx)
735 {
736 FIXME("iface %p, cb %p, ctx %p stub!\n", iface, cb, ctx);
737
738 return E_NOTIMPL;
739 }
740
741 static HRESULT WINAPI d3drm_texture3_SetAppData(IDirect3DRMTexture3 *iface, DWORD data)
742 {
743 struct d3drm_texture *texture = impl_from_IDirect3DRMTexture3(iface);
744
745 TRACE("iface %p, data %#x.\n", iface, data);
746
747 texture->app_data = data;
748
749 return D3DRM_OK;
750 }
751
752 static DWORD WINAPI d3drm_texture3_GetAppData(IDirect3DRMTexture3 *iface)
753 {
754 struct d3drm_texture *texture = impl_from_IDirect3DRMTexture3(iface);
755
756 TRACE("iface %p.\n", iface);
757
758 return texture->app_data;
759 }
760
761 static HRESULT WINAPI d3drm_texture3_SetName(IDirect3DRMTexture3 *iface, const char *name)
762 {
763 FIXME("iface %p, name %s stub!\n", iface, debugstr_a(name));
764
765 return E_NOTIMPL;
766 }
767
768 static HRESULT WINAPI d3drm_texture3_GetName(IDirect3DRMTexture3 *iface, DWORD *size, char *name)
769 {
770 FIXME("iface %p, size %p, name %p stub!\n", iface, size, name);
771
772 return E_NOTIMPL;
773 }
774
775 static HRESULT WINAPI d3drm_texture3_GetClassName(IDirect3DRMTexture3 *iface, DWORD *size, char *name)
776 {
777 TRACE("iface %p, size %p, name %p.\n", iface, size, name);
778
779 if (!size || *size < strlen("Texture") || !name)
780 return E_INVALIDARG;
781
782 strcpy(name, "Texture");
783 *size = sizeof("Texture");
784
785 return D3DRM_OK;
786 }
787
788 static HRESULT WINAPI d3drm_texture3_InitFromFile(IDirect3DRMTexture3 *iface, const char *filename)
789 {
790 FIXME("iface %p, filename %s stub!\n", iface, debugstr_a(filename));
791
792 return E_NOTIMPL;
793 }
794
795 static HRESULT WINAPI d3drm_texture3_InitFromSurface(IDirect3DRMTexture3 *iface,
796 IDirectDrawSurface *surface)
797 {
798 FIXME("iface %p, surface %p stub!\n", iface, surface);
799
800 return E_NOTIMPL;
801 }
802
803 static HRESULT WINAPI d3drm_texture3_InitFromResource(IDirect3DRMTexture3 *iface, HRSRC resource)
804 {
805 FIXME("iface %p, resource %p stub!\n", iface, resource);
806
807 return E_NOTIMPL;
808 }
809
810 static HRESULT WINAPI d3drm_texture3_Changed(IDirect3DRMTexture3 *iface,
811 DWORD flags, DWORD rect_count, RECT *rects)
812 {
813 FIXME("iface %p, flags %#x, rect_count %u, rects %p stub!\n", iface, flags, rect_count, rects);
814
815 return E_NOTIMPL;
816 }
817
818 static HRESULT WINAPI d3drm_texture3_SetColors(IDirect3DRMTexture3 *iface, DWORD max_colors)
819 {
820 FIXME("iface %p, max_colors %u stub!\n", iface, max_colors);
821
822 return E_NOTIMPL;
823 }
824
825 static HRESULT WINAPI d3drm_texture3_SetShades(IDirect3DRMTexture3 *iface, DWORD max_shades)
826 {
827 FIXME("iface %p, max_shades %u stub!\n", iface, max_shades);
828
829 return E_NOTIMPL;
830 }
831
832 static HRESULT WINAPI d3drm_texture3_SetDecalSize(IDirect3DRMTexture3 *iface, D3DVALUE width, D3DVALUE height)
833 {
834 FIXME("iface %p, width %.8e, height %.8e stub!\n", iface, width, height);
835
836 return E_NOTIMPL;
837 }
838
839 static HRESULT WINAPI d3drm_texture3_SetDecalOrigin(IDirect3DRMTexture3 *iface, LONG x, LONG y)
840 {
841 FIXME("iface %p, x %d, y %d stub!\n", iface, x, y);
842
843 return E_NOTIMPL;
844 }
845
846 static HRESULT WINAPI d3drm_texture3_SetDecalScale(IDirect3DRMTexture3 *iface, DWORD scale)
847 {
848 FIXME("iface %p, scale %u stub!\n", iface, scale);
849
850 return E_NOTIMPL;
851 }
852
853 static HRESULT WINAPI d3drm_texture3_SetDecalTransparency(IDirect3DRMTexture3 *iface, BOOL transparency)
854 {
855 FIXME("iface %p, transparency %#x stub!\n", iface, transparency);
856
857 return E_NOTIMPL;
858 }
859
860 static HRESULT WINAPI d3drm_texture3_SetDecalTransparentColor(IDirect3DRMTexture3 *iface, D3DCOLOR color)
861 {
862 FIXME("iface %p, color 0x%08x stub!\n", iface, color);
863
864 return E_NOTIMPL;
865 }
866
867 static HRESULT WINAPI d3drm_texture3_GetDecalSize(IDirect3DRMTexture3 *iface, D3DVALUE *width, D3DVALUE *height)
868 {
869 FIXME("iface %p, width %p, height %p stub!\n", iface, width, height);
870
871 return E_NOTIMPL;
872 }
873
874 static HRESULT WINAPI d3drm_texture3_GetDecalOrigin(IDirect3DRMTexture3 *iface, LONG *x, LONG *y)
875 {
876 FIXME("iface %p, x %p, y %p stub!\n", iface, x, y);
877
878 return E_NOTIMPL;
879 }
880
881 static D3DRMIMAGE * WINAPI d3drm_texture3_GetImage(IDirect3DRMTexture3 *iface)
882 {
883 FIXME("iface %p stub!\n", iface);
884
885 return NULL;
886 }
887
888 static DWORD WINAPI d3drm_texture3_GetShades(IDirect3DRMTexture3 *iface)
889 {
890 FIXME("iface %p stub!\n", iface);
891
892 return 0;
893 }
894
895 static DWORD WINAPI d3drm_texture3_GetColors(IDirect3DRMTexture3 *iface)
896 {
897 FIXME("iface %p stub!\n", iface);
898
899 return 0;
900 }
901
902 static DWORD WINAPI d3drm_texture3_GetDecalScale(IDirect3DRMTexture3 *iface)
903 {
904 FIXME("iface %p stub!\n", iface);
905
906 return 0;
907 }
908
909 static BOOL WINAPI d3drm_texture3_GetDecalTransparency(IDirect3DRMTexture3 *iface)
910 {
911 FIXME("iface %p stub!\n", iface);
912
913 return FALSE;
914 }
915
916 static D3DCOLOR WINAPI d3drm_texture3_GetDecalTransparentColor(IDirect3DRMTexture3 *iface)
917 {
918 FIXME("iface %p stub!\n", iface);
919
920 return 0;
921 }
922
923 static HRESULT WINAPI d3drm_texture3_InitFromImage(IDirect3DRMTexture3 *iface, D3DRMIMAGE *image)
924 {
925 FIXME("iface %p, image %p stub!\n", iface, image);
926
927 return E_NOTIMPL;
928 }
929
930 static HRESULT WINAPI d3drm_texture3_InitFromResource2(IDirect3DRMTexture3 *iface,
931 HMODULE module, const char *name, const char *type)
932 {
933 FIXME("iface %p, module %p, name %s, type %s stub!\n",
934 iface, module, debugstr_a(name), debugstr_a(type));
935
936 return E_NOTIMPL;
937 }
938
939 static HRESULT WINAPI d3drm_texture3_GenerateMIPMap(IDirect3DRMTexture3 *iface, DWORD flags)
940 {
941 FIXME("iface %p, flags %#x stub!\n", iface, flags);
942
943 return E_NOTIMPL;
944 }
945
946 static HRESULT WINAPI d3drm_texture3_GetSurface(IDirect3DRMTexture3 *iface,
947 DWORD flags, IDirectDrawSurface **surface)
948 {
949 FIXME("iface %p, flags %#x, surface %p stub!\n", iface, flags, surface);
950
951 return E_NOTIMPL;
952 }
953
954 static HRESULT WINAPI d3drm_texture3_SetCacheOptions(IDirect3DRMTexture3 *iface, LONG importance, DWORD flags)
955 {
956 FIXME("iface %p, importance %d, flags %#x stub!\n", iface, importance, flags);
957
958 return E_NOTIMPL;
959 }
960
961 static HRESULT WINAPI d3drm_texture3_GetCacheOptions(IDirect3DRMTexture3 *iface,
962 LONG *importance, DWORD *flags)
963 {
964 FIXME("iface %p, importance %p, flags %p stub!\n", iface, importance, flags);
965
966 return E_NOTIMPL;
967 }
968
969 static HRESULT WINAPI d3drm_texture3_SetDownsampleCallback(IDirect3DRMTexture3 *iface,
970 D3DRMDOWNSAMPLECALLBACK cb, void *ctx)
971 {
972 FIXME("iface %p, cb %p, ctx %p stub!\n", iface, cb, ctx);
973
974 return E_NOTIMPL;
975 }
976
977 static HRESULT WINAPI d3drm_texture3_SetValidationCallback(IDirect3DRMTexture3 *iface,
978 D3DRMVALIDATIONCALLBACK cb, void *ctx)
979 {
980 FIXME("iface %p, cb %p, ctx %p stub!\n", iface, cb, ctx);
981
982 return E_NOTIMPL;
983 }
984
985 static const struct IDirect3DRMTexture3Vtbl d3drm_texture3_vtbl =
986 {
987 d3drm_texture3_QueryInterface,
988 d3drm_texture3_AddRef,
989 d3drm_texture3_Release,
990 d3drm_texture3_Clone,
991 d3drm_texture3_AddDestroyCallback,
992 d3drm_texture3_DeleteDestroyCallback,
993 d3drm_texture3_SetAppData,
994 d3drm_texture3_GetAppData,
995 d3drm_texture3_SetName,
996 d3drm_texture3_GetName,
997 d3drm_texture3_GetClassName,
998 d3drm_texture3_InitFromFile,
999 d3drm_texture3_InitFromSurface,
1000 d3drm_texture3_InitFromResource,
1001 d3drm_texture3_Changed,
1002 d3drm_texture3_SetColors,
1003 d3drm_texture3_SetShades,
1004 d3drm_texture3_SetDecalSize,
1005 d3drm_texture3_SetDecalOrigin,
1006 d3drm_texture3_SetDecalScale,
1007 d3drm_texture3_SetDecalTransparency,
1008 d3drm_texture3_SetDecalTransparentColor,
1009 d3drm_texture3_GetDecalSize,
1010 d3drm_texture3_GetDecalOrigin,
1011 d3drm_texture3_GetImage,
1012 d3drm_texture3_GetShades,
1013 d3drm_texture3_GetColors,
1014 d3drm_texture3_GetDecalScale,
1015 d3drm_texture3_GetDecalTransparency,
1016 d3drm_texture3_GetDecalTransparentColor,
1017 d3drm_texture3_InitFromImage,
1018 d3drm_texture3_InitFromResource2,
1019 d3drm_texture3_GenerateMIPMap,
1020 d3drm_texture3_GetSurface,
1021 d3drm_texture3_SetCacheOptions,
1022 d3drm_texture3_GetCacheOptions,
1023 d3drm_texture3_SetDownsampleCallback,
1024 d3drm_texture3_SetValidationCallback,
1025 };
1026
1027 HRESULT Direct3DRMTexture_create(REFIID riid, IUnknown **out)
1028 {
1029 struct d3drm_texture *object;
1030 HRESULT hr;
1031
1032 TRACE("riid %s, out %p.\n", debugstr_guid(riid), out);
1033
1034 if (!(object = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(*object))))
1035 return E_OUTOFMEMORY;
1036
1037 object->IDirect3DRMTexture_iface.lpVtbl = &d3drm_texture1_vtbl;
1038 object->IDirect3DRMTexture2_iface.lpVtbl = &d3drm_texture2_vtbl;
1039 object->IDirect3DRMTexture3_iface.lpVtbl = &d3drm_texture3_vtbl;
1040 object->ref = 1;
1041
1042 hr = IDirect3DRMTexture3_QueryInterface(&object->IDirect3DRMTexture3_iface, riid, (void **)out);
1043 IDirect3DRMTexture3_Release(&object->IDirect3DRMTexture3_iface);
1044
1045 return hr;
1046 }