Release 2.9.
[wine.git] / dlls / d3drm / texture.c
blob5d621a05f83d10bd4f1f2dbf02c8f95e2e133d9d
1 /*
2 * Implementation of IDirect3DRMTextureX interfaces
4 * Copyright 2012 Christian Costa
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.
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.
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
21 #include "config.h"
22 #include "wine/port.h"
24 #include "d3drm_private.h"
26 WINE_DEFAULT_DEBUG_CHANNEL(d3drm);
28 static inline struct d3drm_texture *impl_from_IDirect3DRMTexture(IDirect3DRMTexture *iface)
30 return CONTAINING_RECORD(iface, struct d3drm_texture, IDirect3DRMTexture_iface);
33 static inline struct d3drm_texture *impl_from_IDirect3DRMTexture2(IDirect3DRMTexture2 *iface)
35 return CONTAINING_RECORD(iface, struct d3drm_texture, IDirect3DRMTexture2_iface);
38 static inline struct d3drm_texture *impl_from_IDirect3DRMTexture3(IDirect3DRMTexture3 *iface)
40 return CONTAINING_RECORD(iface, struct d3drm_texture, IDirect3DRMTexture3_iface);
43 static void d3drm_texture_destroy(struct d3drm_texture *texture)
45 TRACE("texture %p is being destroyed.\n", texture);
47 d3drm_object_cleanup((IDirect3DRMObject*)&texture->IDirect3DRMTexture_iface, &texture->obj);
48 if (texture->image)
49 IDirect3DRM_Release(texture->d3drm);
50 HeapFree(GetProcessHeap(), 0, texture);
53 static BOOL d3drm_validate_image(D3DRMIMAGE *image)
55 if (!image
56 || !image->red_mask
57 || !image->green_mask
58 || !image->blue_mask
59 || !image->buffer1
60 || !(image->rgb || (image->palette && image->palette_size)))
62 return FALSE;
65 return TRUE;
68 static HRESULT WINAPI d3drm_texture1_QueryInterface(IDirect3DRMTexture *iface, REFIID riid, void **out)
70 struct d3drm_texture *texture = impl_from_IDirect3DRMTexture(iface);
72 TRACE("iface %p, riid %s, out %p.\n", iface, debugstr_guid(riid), out);
74 return IDirect3DRMTexture3_QueryInterface(&texture->IDirect3DRMTexture3_iface, riid, out);
77 static ULONG WINAPI d3drm_texture1_AddRef(IDirect3DRMTexture *iface)
79 struct d3drm_texture *texture = impl_from_IDirect3DRMTexture(iface);
81 TRACE("iface %p.\n", iface);
83 return IDirect3DRMTexture3_AddRef(&texture->IDirect3DRMTexture3_iface);
86 static ULONG WINAPI d3drm_texture1_Release(IDirect3DRMTexture *iface)
88 struct d3drm_texture *texture = impl_from_IDirect3DRMTexture(iface);
90 TRACE("iface %p.\n", iface);
92 return IDirect3DRMTexture3_Release(&texture->IDirect3DRMTexture3_iface);
95 static HRESULT WINAPI d3drm_texture1_Clone(IDirect3DRMTexture *iface,
96 IUnknown *outer, REFIID iid, void **out)
98 struct d3drm_texture *texture = impl_from_IDirect3DRMTexture(iface);
100 TRACE("iface %p, outer %p, iid %s, out %p.\n", iface, outer, debugstr_guid(iid), out);
102 return IDirect3DRMTexture3_Clone(&texture->IDirect3DRMTexture3_iface, outer, iid, out);
105 static HRESULT WINAPI d3drm_texture1_AddDestroyCallback(IDirect3DRMTexture *iface,
106 D3DRMOBJECTCALLBACK cb, void *ctx)
108 struct d3drm_texture *texture = impl_from_IDirect3DRMTexture(iface);
110 TRACE("iface %p, cb %p, ctx %p\n", iface, cb, ctx);
112 return IDirect3DRMTexture3_AddDestroyCallback(&texture->IDirect3DRMTexture3_iface, cb, ctx);
115 static HRESULT WINAPI d3drm_texture1_DeleteDestroyCallback(IDirect3DRMTexture *iface,
116 D3DRMOBJECTCALLBACK cb, void *ctx)
118 struct d3drm_texture *texture = impl_from_IDirect3DRMTexture(iface);
120 TRACE("iface %p, cb %p, ctx %p\n", iface, cb, ctx);
122 return IDirect3DRMTexture3_DeleteDestroyCallback(&texture->IDirect3DRMTexture3_iface, cb, ctx);
125 static HRESULT WINAPI d3drm_texture1_SetAppData(IDirect3DRMTexture *iface, DWORD data)
127 struct d3drm_texture *texture = impl_from_IDirect3DRMTexture(iface);
129 TRACE("iface %p, data %#x.\n", iface, data);
131 return IDirect3DRMTexture3_SetAppData(&texture->IDirect3DRMTexture3_iface, data);
134 static DWORD WINAPI d3drm_texture1_GetAppData(IDirect3DRMTexture *iface)
136 struct d3drm_texture *texture = impl_from_IDirect3DRMTexture(iface);
138 TRACE("iface %p.\n", iface);
140 return IDirect3DRMTexture3_GetAppData(&texture->IDirect3DRMTexture3_iface);
143 static HRESULT WINAPI d3drm_texture1_SetName(IDirect3DRMTexture *iface, const char *name)
145 struct d3drm_texture *texture = impl_from_IDirect3DRMTexture(iface);
147 TRACE("iface %p, name %s.\n", iface, debugstr_a(name));
149 return IDirect3DRMTexture3_SetName(&texture->IDirect3DRMTexture3_iface, name);
152 static HRESULT WINAPI d3drm_texture1_GetName(IDirect3DRMTexture *iface, DWORD *size, char *name)
154 struct d3drm_texture *texture = impl_from_IDirect3DRMTexture(iface);
156 TRACE("iface %p, size %p, name %p.\n", iface, size, name);
158 return IDirect3DRMTexture3_GetName(&texture->IDirect3DRMTexture3_iface, size, name);
161 static HRESULT WINAPI d3drm_texture1_GetClassName(IDirect3DRMTexture *iface, DWORD *size, char *name)
163 struct d3drm_texture *texture = impl_from_IDirect3DRMTexture(iface);
165 TRACE("iface %p, size %p, name %p.\n", iface, size, name);
167 return IDirect3DRMTexture3_GetClassName(&texture->IDirect3DRMTexture3_iface, size, name);
170 static HRESULT WINAPI d3drm_texture1_InitFromFile(IDirect3DRMTexture *iface, const char *filename)
172 FIXME("iface %p, filename %s stub!\n", iface, debugstr_a(filename));
174 return E_NOTIMPL;
177 static HRESULT WINAPI d3drm_texture1_InitFromSurface(IDirect3DRMTexture *iface,
178 IDirectDrawSurface *surface)
180 FIXME("iface %p, surface %p stub!\n", iface, surface);
182 return E_NOTIMPL;
185 static HRESULT WINAPI d3drm_texture1_InitFromResource(IDirect3DRMTexture *iface, HRSRC resource)
187 FIXME("iface %p, resource %p stub!\n", iface, resource);
189 return E_NOTIMPL;
192 static HRESULT WINAPI d3drm_texture1_Changed(IDirect3DRMTexture *iface, BOOL pixels, BOOL palette)
194 FIXME("iface %p, pixels %#x, palette %#x stub!\n", iface, pixels, palette);
196 return E_NOTIMPL;
199 static HRESULT WINAPI d3drm_texture1_SetColors(IDirect3DRMTexture *iface, DWORD max_colors)
201 struct d3drm_texture *texture = impl_from_IDirect3DRMTexture(iface);
203 TRACE("iface %p, max_colors %u.\n", iface, max_colors);
205 return IDirect3DRMTexture3_SetColors(&texture->IDirect3DRMTexture3_iface, max_colors);
208 static HRESULT WINAPI d3drm_texture1_SetShades(IDirect3DRMTexture *iface, DWORD max_shades)
210 struct d3drm_texture *texture = impl_from_IDirect3DRMTexture(iface);
212 TRACE("iface %p, max_shades %u.\n", iface, max_shades);
214 return IDirect3DRMTexture3_SetShades(&texture->IDirect3DRMTexture3_iface, max_shades);
217 static HRESULT WINAPI d3drm_texture1_SetDecalSize(IDirect3DRMTexture *iface, D3DVALUE width, D3DVALUE height)
219 struct d3drm_texture *texture = impl_from_IDirect3DRMTexture(iface);
221 TRACE("iface %p, width %.8e, height %.8e.\n", iface, width, height);
223 return IDirect3DRMTexture3_SetDecalSize(&texture->IDirect3DRMTexture3_iface, width, height);
226 static HRESULT WINAPI d3drm_texture1_SetDecalOrigin(IDirect3DRMTexture *iface, LONG x, LONG y)
228 struct d3drm_texture *texture = impl_from_IDirect3DRMTexture(iface);
230 TRACE("iface %p, x %d, y %d.\n", iface, x, y);
232 return IDirect3DRMTexture3_SetDecalOrigin(&texture->IDirect3DRMTexture3_iface, x, y);
235 static HRESULT WINAPI d3drm_texture1_SetDecalScale(IDirect3DRMTexture *iface, DWORD scale)
237 struct d3drm_texture *texture = impl_from_IDirect3DRMTexture(iface);
239 TRACE("iface %p, scale %u.\n", iface, scale);
241 return IDirect3DRMTexture3_SetDecalScale(&texture->IDirect3DRMTexture3_iface, scale);
244 static HRESULT WINAPI d3drm_texture1_SetDecalTransparency(IDirect3DRMTexture *iface, BOOL transparency)
246 struct d3drm_texture *texture = impl_from_IDirect3DRMTexture(iface);
248 TRACE("iface %p, transparency %#x.\n", iface, transparency);
250 return IDirect3DRMTexture3_SetDecalTransparency(&texture->IDirect3DRMTexture3_iface, transparency);
253 static HRESULT WINAPI d3drm_texture1_SetDecalTransparentColor(IDirect3DRMTexture *iface, D3DCOLOR color)
255 struct d3drm_texture *texture = impl_from_IDirect3DRMTexture(iface);
257 TRACE("iface %p, color 0x%08x.\n", iface, color);
259 return IDirect3DRMTexture3_SetDecalTransparentColor(&texture->IDirect3DRMTexture3_iface, color);
262 static HRESULT WINAPI d3drm_texture1_GetDecalSize(IDirect3DRMTexture *iface, D3DVALUE *width, D3DVALUE *height)
264 struct d3drm_texture *texture = impl_from_IDirect3DRMTexture(iface);
266 TRACE("iface %p, width %p, height %p.\n", iface, width, height);
268 return IDirect3DRMTexture3_GetDecalSize(&texture->IDirect3DRMTexture3_iface, width, height);
271 static HRESULT WINAPI d3drm_texture1_GetDecalOrigin(IDirect3DRMTexture *iface, LONG *x, LONG *y)
273 struct d3drm_texture *texture = impl_from_IDirect3DRMTexture(iface);
275 TRACE("iface %p, x %p, y %p.\n", iface, x, y);
277 return IDirect3DRMTexture3_GetDecalOrigin(&texture->IDirect3DRMTexture3_iface, x, y);
280 static D3DRMIMAGE * WINAPI d3drm_texture1_GetImage(IDirect3DRMTexture *iface)
282 struct d3drm_texture *texture = impl_from_IDirect3DRMTexture(iface);
284 TRACE("iface %p.\n", iface);
286 return IDirect3DRMTexture3_GetImage(&texture->IDirect3DRMTexture3_iface);
289 static DWORD WINAPI d3drm_texture1_GetShades(IDirect3DRMTexture *iface)
291 struct d3drm_texture *texture = impl_from_IDirect3DRMTexture(iface);
293 TRACE("iface %p.\n", iface);
295 return IDirect3DRMTexture3_GetShades(&texture->IDirect3DRMTexture3_iface);
298 static DWORD WINAPI d3drm_texture1_GetColors(IDirect3DRMTexture *iface)
300 struct d3drm_texture *texture = impl_from_IDirect3DRMTexture(iface);
302 TRACE("iface %p.\n", iface);
304 return IDirect3DRMTexture3_GetColors(&texture->IDirect3DRMTexture3_iface);
307 static DWORD WINAPI d3drm_texture1_GetDecalScale(IDirect3DRMTexture *iface)
309 struct d3drm_texture *texture = impl_from_IDirect3DRMTexture(iface);
311 TRACE("iface %p.\n", iface);
313 return IDirect3DRMTexture3_GetDecalScale(&texture->IDirect3DRMTexture3_iface);
316 static BOOL WINAPI d3drm_texture1_GetDecalTransparency(IDirect3DRMTexture *iface)
318 struct d3drm_texture *texture = impl_from_IDirect3DRMTexture(iface);
320 TRACE("iface %p.\n", iface);
322 return IDirect3DRMTexture3_GetDecalTransparency(&texture->IDirect3DRMTexture3_iface);
325 static D3DCOLOR WINAPI d3drm_texture1_GetDecalTransparentColor(IDirect3DRMTexture *iface)
327 struct d3drm_texture *texture = impl_from_IDirect3DRMTexture(iface);
329 TRACE("iface %p.\n", iface);
331 return IDirect3DRMTexture3_GetDecalTransparentColor(&texture->IDirect3DRMTexture3_iface);
334 static const struct IDirect3DRMTextureVtbl d3drm_texture1_vtbl =
336 d3drm_texture1_QueryInterface,
337 d3drm_texture1_AddRef,
338 d3drm_texture1_Release,
339 d3drm_texture1_Clone,
340 d3drm_texture1_AddDestroyCallback,
341 d3drm_texture1_DeleteDestroyCallback,
342 d3drm_texture1_SetAppData,
343 d3drm_texture1_GetAppData,
344 d3drm_texture1_SetName,
345 d3drm_texture1_GetName,
346 d3drm_texture1_GetClassName,
347 d3drm_texture1_InitFromFile,
348 d3drm_texture1_InitFromSurface,
349 d3drm_texture1_InitFromResource,
350 d3drm_texture1_Changed,
351 d3drm_texture1_SetColors,
352 d3drm_texture1_SetShades,
353 d3drm_texture1_SetDecalSize,
354 d3drm_texture1_SetDecalOrigin,
355 d3drm_texture1_SetDecalScale,
356 d3drm_texture1_SetDecalTransparency,
357 d3drm_texture1_SetDecalTransparentColor,
358 d3drm_texture1_GetDecalSize,
359 d3drm_texture1_GetDecalOrigin,
360 d3drm_texture1_GetImage,
361 d3drm_texture1_GetShades,
362 d3drm_texture1_GetColors,
363 d3drm_texture1_GetDecalScale,
364 d3drm_texture1_GetDecalTransparency,
365 d3drm_texture1_GetDecalTransparentColor,
368 static HRESULT WINAPI d3drm_texture2_QueryInterface(IDirect3DRMTexture2 *iface, REFIID riid, void **out)
370 struct d3drm_texture *texture = impl_from_IDirect3DRMTexture2(iface);
372 TRACE("iface %p, riid %s, out %p.\n", iface, debugstr_guid(riid), out);
374 return IDirect3DRMTexture3_QueryInterface(&texture->IDirect3DRMTexture3_iface, riid, out);
377 static ULONG WINAPI d3drm_texture2_AddRef(IDirect3DRMTexture2 *iface)
379 struct d3drm_texture *texture = impl_from_IDirect3DRMTexture2(iface);
381 TRACE("iface %p.\n", iface);
383 return IDirect3DRMTexture3_AddRef(&texture->IDirect3DRMTexture3_iface);
386 static ULONG WINAPI d3drm_texture2_Release(IDirect3DRMTexture2 *iface)
388 struct d3drm_texture *texture = impl_from_IDirect3DRMTexture2(iface);
390 TRACE("iface %p.\n", iface);
392 return IDirect3DRMTexture3_Release(&texture->IDirect3DRMTexture3_iface);
395 static HRESULT WINAPI d3drm_texture2_Clone(IDirect3DRMTexture2 *iface,
396 IUnknown *outer, REFIID iid, void **out)
398 struct d3drm_texture *texture = impl_from_IDirect3DRMTexture2(iface);
400 TRACE("iface %p, outer %p, iid %s, out %p.\n", iface, outer, debugstr_guid(iid), out);
402 return IDirect3DRMTexture3_Clone(&texture->IDirect3DRMTexture3_iface, outer, iid, out);
405 static HRESULT WINAPI d3drm_texture2_AddDestroyCallback(IDirect3DRMTexture2 *iface,
406 D3DRMOBJECTCALLBACK cb, void *ctx)
408 struct d3drm_texture *texture = impl_from_IDirect3DRMTexture2(iface);
410 TRACE("iface %p, cb %p, ctx %p\n", iface, cb, ctx);
412 return IDirect3DRMTexture3_AddDestroyCallback(&texture->IDirect3DRMTexture3_iface, cb, ctx);
415 static HRESULT WINAPI d3drm_texture2_DeleteDestroyCallback(IDirect3DRMTexture2 *iface,
416 D3DRMOBJECTCALLBACK cb, void *ctx)
418 struct d3drm_texture *texture = impl_from_IDirect3DRMTexture2(iface);
420 TRACE("iface %p, cb %p, ctx %p\n", iface, cb, ctx);
422 return IDirect3DRMTexture3_DeleteDestroyCallback(&texture->IDirect3DRMTexture3_iface, cb, ctx);
425 static HRESULT WINAPI d3drm_texture2_SetAppData(IDirect3DRMTexture2 *iface, DWORD data)
427 struct d3drm_texture *texture = impl_from_IDirect3DRMTexture2(iface);
429 TRACE("iface %p, data %#x.\n", iface, data);
431 return IDirect3DRMTexture3_SetAppData(&texture->IDirect3DRMTexture3_iface, data);
434 static DWORD WINAPI d3drm_texture2_GetAppData(IDirect3DRMTexture2 *iface)
436 struct d3drm_texture *texture = impl_from_IDirect3DRMTexture2(iface);
438 TRACE("iface %p.\n", iface);
440 return IDirect3DRMTexture3_GetAppData(&texture->IDirect3DRMTexture3_iface);
443 static HRESULT WINAPI d3drm_texture2_SetName(IDirect3DRMTexture2 *iface, const char *name)
445 struct d3drm_texture *texture = impl_from_IDirect3DRMTexture2(iface);
447 TRACE("iface %p, name %s.\n", iface, debugstr_a(name));
449 return IDirect3DRMTexture3_SetName(&texture->IDirect3DRMTexture3_iface, name);
452 static HRESULT WINAPI d3drm_texture2_GetName(IDirect3DRMTexture2 *iface, DWORD *size, char *name)
454 struct d3drm_texture *texture = impl_from_IDirect3DRMTexture2(iface);
456 TRACE("iface %p, size %p, name %p.\n", iface, size, name);
458 return IDirect3DRMTexture3_GetName(&texture->IDirect3DRMTexture3_iface, size, name);
461 static HRESULT WINAPI d3drm_texture2_GetClassName(IDirect3DRMTexture2 *iface, DWORD *size, char *name)
463 struct d3drm_texture *texture = impl_from_IDirect3DRMTexture2(iface);
465 TRACE("iface %p, size %p, name %p.\n", iface, size, name);
467 return IDirect3DRMTexture3_GetClassName(&texture->IDirect3DRMTexture3_iface, size, name);
470 static HRESULT WINAPI d3drm_texture2_InitFromFile(IDirect3DRMTexture2 *iface, const char *filename)
472 FIXME("iface %p, filename %s stub!\n", iface, debugstr_a(filename));
474 return E_NOTIMPL;
477 static HRESULT WINAPI d3drm_texture2_InitFromSurface(IDirect3DRMTexture2 *iface,
478 IDirectDrawSurface *surface)
480 FIXME("iface %p, surface %p stub!\n", iface, surface);
482 return E_NOTIMPL;
485 static HRESULT WINAPI d3drm_texture2_InitFromResource(IDirect3DRMTexture2 *iface, HRSRC resource)
487 FIXME("iface %p, resource %p stub!\n", iface, resource);
489 return E_NOTIMPL;
492 static HRESULT WINAPI d3drm_texture2_Changed(IDirect3DRMTexture2 *iface, BOOL pixels, BOOL palette)
494 FIXME("iface %p, pixels %#x, palette %#x stub!\n", iface, pixels, palette);
496 return E_NOTIMPL;
499 static HRESULT WINAPI d3drm_texture2_SetColors(IDirect3DRMTexture2 *iface, DWORD max_colors)
501 struct d3drm_texture *texture = impl_from_IDirect3DRMTexture2(iface);
503 TRACE("iface %p, max_colors %u.\n", iface, max_colors);
505 return IDirect3DRMTexture3_SetColors(&texture->IDirect3DRMTexture3_iface, max_colors);
508 static HRESULT WINAPI d3drm_texture2_SetShades(IDirect3DRMTexture2 *iface, DWORD max_shades)
510 struct d3drm_texture *texture = impl_from_IDirect3DRMTexture2(iface);
512 TRACE("iface %p, max_shades %u.\n", iface, max_shades);
514 return IDirect3DRMTexture3_SetShades(&texture->IDirect3DRMTexture3_iface, max_shades);
517 static HRESULT WINAPI d3drm_texture2_SetDecalSize(IDirect3DRMTexture2 *iface, D3DVALUE width, D3DVALUE height)
519 struct d3drm_texture *texture = impl_from_IDirect3DRMTexture2(iface);
521 TRACE("iface %p, width %.8e, height %.8e.\n", iface, width, height);
523 return IDirect3DRMTexture3_SetDecalSize(&texture->IDirect3DRMTexture3_iface, width, height);
526 static HRESULT WINAPI d3drm_texture2_SetDecalOrigin(IDirect3DRMTexture2 *iface, LONG x, LONG y)
528 struct d3drm_texture *texture = impl_from_IDirect3DRMTexture2(iface);
530 TRACE("iface %p, x %d, y %d.\n", iface, x, y);
532 return IDirect3DRMTexture3_SetDecalOrigin(&texture->IDirect3DRMTexture3_iface, x, y);
535 static HRESULT WINAPI d3drm_texture2_SetDecalScale(IDirect3DRMTexture2 *iface, DWORD scale)
537 struct d3drm_texture *texture = impl_from_IDirect3DRMTexture2(iface);
539 TRACE("iface %p, scale %u.\n", iface, scale);
541 return IDirect3DRMTexture3_SetDecalScale(&texture->IDirect3DRMTexture3_iface, scale);
544 static HRESULT WINAPI d3drm_texture2_SetDecalTransparency(IDirect3DRMTexture2 *iface, BOOL transparency)
546 struct d3drm_texture *texture = impl_from_IDirect3DRMTexture2(iface);
548 TRACE("iface %p, transparency %#x.\n", iface, transparency);
550 return IDirect3DRMTexture3_SetDecalTransparency(&texture->IDirect3DRMTexture3_iface, transparency);
553 static HRESULT WINAPI d3drm_texture2_SetDecalTransparentColor(IDirect3DRMTexture2 *iface, D3DCOLOR color)
555 struct d3drm_texture *texture = impl_from_IDirect3DRMTexture2(iface);
557 TRACE("iface %p, color 0x%08x.\n", iface, color);
559 return IDirect3DRMTexture3_SetDecalTransparentColor(&texture->IDirect3DRMTexture3_iface, color);
562 static HRESULT WINAPI d3drm_texture2_GetDecalSize(IDirect3DRMTexture2 *iface, D3DVALUE *width, D3DVALUE *height)
564 struct d3drm_texture *texture = impl_from_IDirect3DRMTexture2(iface);
566 TRACE("iface %p, width %p, height %p.\n", iface, width, height);
568 return IDirect3DRMTexture3_GetDecalSize(&texture->IDirect3DRMTexture3_iface, width, height);
571 static HRESULT WINAPI d3drm_texture2_GetDecalOrigin(IDirect3DRMTexture2 *iface, LONG *x, LONG *y)
573 struct d3drm_texture *texture = impl_from_IDirect3DRMTexture2(iface);
575 TRACE("iface %p, x %p, y %p.\n", iface, x, y);
577 return IDirect3DRMTexture3_GetDecalOrigin(&texture->IDirect3DRMTexture3_iface, x, y);
580 static D3DRMIMAGE * WINAPI d3drm_texture2_GetImage(IDirect3DRMTexture2 *iface)
582 struct d3drm_texture *texture = impl_from_IDirect3DRMTexture2(iface);
584 TRACE("iface %p.\n", iface);
586 return IDirect3DRMTexture3_GetImage(&texture->IDirect3DRMTexture3_iface);
589 static DWORD WINAPI d3drm_texture2_GetShades(IDirect3DRMTexture2 *iface)
591 struct d3drm_texture *texture = impl_from_IDirect3DRMTexture2(iface);
593 TRACE("iface %p.\n", iface);
595 return IDirect3DRMTexture3_GetShades(&texture->IDirect3DRMTexture3_iface);
598 static DWORD WINAPI d3drm_texture2_GetColors(IDirect3DRMTexture2 *iface)
600 struct d3drm_texture *texture = impl_from_IDirect3DRMTexture2(iface);
602 TRACE("iface %p.\n", iface);
604 return IDirect3DRMTexture3_GetColors(&texture->IDirect3DRMTexture3_iface);
607 static DWORD WINAPI d3drm_texture2_GetDecalScale(IDirect3DRMTexture2 *iface)
609 struct d3drm_texture *texture = impl_from_IDirect3DRMTexture2(iface);
611 TRACE("iface %p.\n", iface);
613 return IDirect3DRMTexture3_GetDecalScale(&texture->IDirect3DRMTexture3_iface);
616 static BOOL WINAPI d3drm_texture2_GetDecalTransparency(IDirect3DRMTexture2 *iface)
618 struct d3drm_texture *texture = impl_from_IDirect3DRMTexture2(iface);
620 TRACE("iface %p.\n", iface);
622 return IDirect3DRMTexture3_GetDecalTransparency(&texture->IDirect3DRMTexture3_iface);
625 static D3DCOLOR WINAPI d3drm_texture2_GetDecalTransparentColor(IDirect3DRMTexture2 *iface)
627 struct d3drm_texture *texture = impl_from_IDirect3DRMTexture2(iface);
629 TRACE("iface %p.\n", iface);
631 return IDirect3DRMTexture3_GetDecalTransparentColor(&texture->IDirect3DRMTexture3_iface);
634 static HRESULT WINAPI d3drm_texture2_InitFromImage(IDirect3DRMTexture2 *iface, D3DRMIMAGE *image)
636 struct d3drm_texture *texture = impl_from_IDirect3DRMTexture2(iface);
638 TRACE("iface %p, image %p.\n", iface, image);
640 return IDirect3DRMTexture3_InitFromImage(&texture->IDirect3DRMTexture3_iface, image);
643 static HRESULT WINAPI d3drm_texture2_InitFromResource2(IDirect3DRMTexture2 *iface,
644 HMODULE module, const char *name, const char *type)
646 FIXME("iface %p, module %p, name %s, type %s stub!\n",
647 iface, module, debugstr_a(name), debugstr_a(type));
649 return E_NOTIMPL;
652 static HRESULT WINAPI d3drm_texture2_GenerateMIPMap(IDirect3DRMTexture2 *iface, DWORD flags)
654 struct d3drm_texture *texture = impl_from_IDirect3DRMTexture2(iface);
656 TRACE("iface %p, flags %#x.\n", iface, flags);
658 return IDirect3DRMTexture3_GenerateMIPMap(&texture->IDirect3DRMTexture3_iface, flags);
661 static const struct IDirect3DRMTexture2Vtbl d3drm_texture2_vtbl =
663 d3drm_texture2_QueryInterface,
664 d3drm_texture2_AddRef,
665 d3drm_texture2_Release,
666 d3drm_texture2_Clone,
667 d3drm_texture2_AddDestroyCallback,
668 d3drm_texture2_DeleteDestroyCallback,
669 d3drm_texture2_SetAppData,
670 d3drm_texture2_GetAppData,
671 d3drm_texture2_SetName,
672 d3drm_texture2_GetName,
673 d3drm_texture2_GetClassName,
674 d3drm_texture2_InitFromFile,
675 d3drm_texture2_InitFromSurface,
676 d3drm_texture2_InitFromResource,
677 d3drm_texture2_Changed,
678 d3drm_texture2_SetColors,
679 d3drm_texture2_SetShades,
680 d3drm_texture2_SetDecalSize,
681 d3drm_texture2_SetDecalOrigin,
682 d3drm_texture2_SetDecalScale,
683 d3drm_texture2_SetDecalTransparency,
684 d3drm_texture2_SetDecalTransparentColor,
685 d3drm_texture2_GetDecalSize,
686 d3drm_texture2_GetDecalOrigin,
687 d3drm_texture2_GetImage,
688 d3drm_texture2_GetShades,
689 d3drm_texture2_GetColors,
690 d3drm_texture2_GetDecalScale,
691 d3drm_texture2_GetDecalTransparency,
692 d3drm_texture2_GetDecalTransparentColor,
693 d3drm_texture2_InitFromImage,
694 d3drm_texture2_InitFromResource2,
695 d3drm_texture2_GenerateMIPMap,
698 static HRESULT WINAPI d3drm_texture3_QueryInterface(IDirect3DRMTexture3 *iface, REFIID riid, void **out)
700 struct d3drm_texture *texture = impl_from_IDirect3DRMTexture3(iface);
702 TRACE("iface %p, riid %s, out %p.\n", iface, debugstr_guid(riid), out);
704 if (IsEqualGUID(riid, &IID_IDirect3DRMTexture)
705 || IsEqualGUID(riid, &IID_IDirect3DRMVisual)
706 || IsEqualGUID(riid, &IID_IDirect3DRMObject)
707 || IsEqualGUID(riid, &IID_IUnknown))
709 *out = &texture->IDirect3DRMTexture_iface;
711 else if (IsEqualGUID(riid, &IID_IDirect3DRMTexture2))
713 *out = &texture->IDirect3DRMTexture2_iface;
715 else if (IsEqualGUID(riid, &IID_IDirect3DRMTexture3))
717 *out = &texture->IDirect3DRMTexture3_iface;
719 else
721 *out = NULL;
722 WARN("%s not implemented, returning CLASS_E_CLASSNOTAVAILABLE.\n", debugstr_guid(riid));
723 return CLASS_E_CLASSNOTAVAILABLE;
726 IUnknown_AddRef((IUnknown *)*out);
727 return S_OK;
730 static ULONG WINAPI d3drm_texture3_AddRef(IDirect3DRMTexture3 *iface)
732 struct d3drm_texture *texture = impl_from_IDirect3DRMTexture3(iface);
733 ULONG refcount = InterlockedIncrement(&texture->obj.ref);
735 TRACE("%p increasing refcount to %u.\n", iface, refcount);
737 return refcount;
740 static ULONG WINAPI d3drm_texture3_Release(IDirect3DRMTexture3 *iface)
742 struct d3drm_texture *texture = impl_from_IDirect3DRMTexture3(iface);
743 ULONG refcount = InterlockedDecrement(&texture->obj.ref);
745 TRACE("%p decreasing refcount to %u.\n", iface, refcount);
747 if (!refcount)
748 d3drm_texture_destroy(texture);
750 return refcount;
753 static HRESULT WINAPI d3drm_texture3_Clone(IDirect3DRMTexture3 *iface,
754 IUnknown *outer, REFIID iid, void **out)
756 FIXME("iface %p, outer %p, iid %s, out %p stub!\n", iface, outer, debugstr_guid(iid), out);
758 return E_NOTIMPL;
761 static HRESULT WINAPI d3drm_texture3_AddDestroyCallback(IDirect3DRMTexture3 *iface,
762 D3DRMOBJECTCALLBACK cb, void *ctx)
764 struct d3drm_texture *texture = impl_from_IDirect3DRMTexture3(iface);
766 TRACE("iface %p, cb %p, ctx %p\n", iface, cb, ctx);
768 return d3drm_object_add_destroy_callback(&texture->obj, cb, ctx);
771 static HRESULT WINAPI d3drm_texture3_DeleteDestroyCallback(IDirect3DRMTexture3 *iface,
772 D3DRMOBJECTCALLBACK cb, void *ctx)
774 struct d3drm_texture *texture = impl_from_IDirect3DRMTexture3(iface);
776 TRACE("iface %p, cb %p, ctx %p\n", iface, cb, ctx);
778 return d3drm_object_delete_destroy_callback(&texture->obj, cb, ctx);
781 static HRESULT WINAPI d3drm_texture3_SetAppData(IDirect3DRMTexture3 *iface, DWORD data)
783 struct d3drm_texture *texture = impl_from_IDirect3DRMTexture3(iface);
785 TRACE("iface %p, data %#x.\n", iface, data);
787 texture->obj.appdata = data;
789 return D3DRM_OK;
792 static DWORD WINAPI d3drm_texture3_GetAppData(IDirect3DRMTexture3 *iface)
794 struct d3drm_texture *texture = impl_from_IDirect3DRMTexture3(iface);
796 TRACE("iface %p.\n", iface);
798 return texture->obj.appdata;
801 static HRESULT WINAPI d3drm_texture3_SetName(IDirect3DRMTexture3 *iface, const char *name)
803 FIXME("iface %p, name %s stub!\n", iface, debugstr_a(name));
805 return E_NOTIMPL;
808 static HRESULT WINAPI d3drm_texture3_GetName(IDirect3DRMTexture3 *iface, DWORD *size, char *name)
810 FIXME("iface %p, size %p, name %p stub!\n", iface, size, name);
812 return E_NOTIMPL;
815 static HRESULT WINAPI d3drm_texture3_GetClassName(IDirect3DRMTexture3 *iface, DWORD *size, char *name)
817 TRACE("iface %p, size %p, name %p.\n", iface, size, name);
819 if (!size || *size < sizeof("Texture") || !name)
820 return E_INVALIDARG;
822 strcpy(name, "Texture");
823 *size = sizeof("Texture");
825 return D3DRM_OK;
828 static HRESULT WINAPI d3drm_texture3_InitFromFile(IDirect3DRMTexture3 *iface, const char *filename)
830 FIXME("iface %p, filename %s stub!\n", iface, debugstr_a(filename));
832 return E_NOTIMPL;
835 static HRESULT WINAPI d3drm_texture3_InitFromSurface(IDirect3DRMTexture3 *iface,
836 IDirectDrawSurface *surface)
838 FIXME("iface %p, surface %p stub!\n", iface, surface);
840 return E_NOTIMPL;
843 static HRESULT WINAPI d3drm_texture3_InitFromResource(IDirect3DRMTexture3 *iface, HRSRC resource)
845 FIXME("iface %p, resource %p stub!\n", iface, resource);
847 return E_NOTIMPL;
850 static HRESULT WINAPI d3drm_texture3_Changed(IDirect3DRMTexture3 *iface,
851 DWORD flags, DWORD rect_count, RECT *rects)
853 FIXME("iface %p, flags %#x, rect_count %u, rects %p stub!\n", iface, flags, rect_count, rects);
855 return E_NOTIMPL;
858 static HRESULT WINAPI d3drm_texture3_SetColors(IDirect3DRMTexture3 *iface, DWORD max_colors)
860 FIXME("iface %p, max_colors %u stub!\n", iface, max_colors);
862 return E_NOTIMPL;
865 static HRESULT WINAPI d3drm_texture3_SetShades(IDirect3DRMTexture3 *iface, DWORD max_shades)
867 FIXME("iface %p, max_shades %u stub!\n", iface, max_shades);
869 return E_NOTIMPL;
872 static HRESULT WINAPI d3drm_texture3_SetDecalSize(IDirect3DRMTexture3 *iface, D3DVALUE width, D3DVALUE height)
874 FIXME("iface %p, width %.8e, height %.8e stub!\n", iface, width, height);
876 return E_NOTIMPL;
879 static HRESULT WINAPI d3drm_texture3_SetDecalOrigin(IDirect3DRMTexture3 *iface, LONG x, LONG y)
881 FIXME("iface %p, x %d, y %d stub!\n", iface, x, y);
883 return E_NOTIMPL;
886 static HRESULT WINAPI d3drm_texture3_SetDecalScale(IDirect3DRMTexture3 *iface, DWORD scale)
888 FIXME("iface %p, scale %u stub!\n", iface, scale);
890 return E_NOTIMPL;
893 static HRESULT WINAPI d3drm_texture3_SetDecalTransparency(IDirect3DRMTexture3 *iface, BOOL transparency)
895 FIXME("iface %p, transparency %#x stub!\n", iface, transparency);
897 return E_NOTIMPL;
900 static HRESULT WINAPI d3drm_texture3_SetDecalTransparentColor(IDirect3DRMTexture3 *iface, D3DCOLOR color)
902 FIXME("iface %p, color 0x%08x stub!\n", iface, color);
904 return E_NOTIMPL;
907 static HRESULT WINAPI d3drm_texture3_GetDecalSize(IDirect3DRMTexture3 *iface, D3DVALUE *width, D3DVALUE *height)
909 FIXME("iface %p, width %p, height %p stub!\n", iface, width, height);
911 return E_NOTIMPL;
914 static HRESULT WINAPI d3drm_texture3_GetDecalOrigin(IDirect3DRMTexture3 *iface, LONG *x, LONG *y)
916 FIXME("iface %p, x %p, y %p stub!\n", iface, x, y);
918 return E_NOTIMPL;
921 static D3DRMIMAGE * WINAPI d3drm_texture3_GetImage(IDirect3DRMTexture3 *iface)
923 struct d3drm_texture *texture = impl_from_IDirect3DRMTexture3(iface);
925 TRACE("iface %p.\n", iface);
927 return texture->image;
930 static DWORD WINAPI d3drm_texture3_GetShades(IDirect3DRMTexture3 *iface)
932 FIXME("iface %p stub!\n", iface);
934 return 0;
937 static DWORD WINAPI d3drm_texture3_GetColors(IDirect3DRMTexture3 *iface)
939 FIXME("iface %p stub!\n", iface);
941 return 0;
944 static DWORD WINAPI d3drm_texture3_GetDecalScale(IDirect3DRMTexture3 *iface)
946 FIXME("iface %p stub!\n", iface);
948 return 0;
951 static BOOL WINAPI d3drm_texture3_GetDecalTransparency(IDirect3DRMTexture3 *iface)
953 FIXME("iface %p stub!\n", iface);
955 return FALSE;
958 static D3DCOLOR WINAPI d3drm_texture3_GetDecalTransparentColor(IDirect3DRMTexture3 *iface)
960 FIXME("iface %p stub!\n", iface);
962 return 0;
965 static HRESULT WINAPI d3drm_texture3_InitFromImage(IDirect3DRMTexture3 *iface, D3DRMIMAGE *image)
967 struct d3drm_texture *texture = impl_from_IDirect3DRMTexture3(iface);
969 TRACE("iface %p, image %p.\n", iface, image);
971 if (!d3drm_validate_image(image))
972 return D3DRMERR_BADOBJECT;
974 /* d3drm intentionally leaks a reference to IDirect3DRM here if texture has already been initialized. */
975 IDirect3DRM_AddRef(texture->d3drm);
977 if (texture->image)
978 return D3DRMERR_BADOBJECT;
980 texture->image = image;
982 return D3DRM_OK;
985 static HRESULT WINAPI d3drm_texture3_InitFromResource2(IDirect3DRMTexture3 *iface,
986 HMODULE module, const char *name, const char *type)
988 FIXME("iface %p, module %p, name %s, type %s stub!\n",
989 iface, module, debugstr_a(name), debugstr_a(type));
991 return E_NOTIMPL;
994 static HRESULT WINAPI d3drm_texture3_GenerateMIPMap(IDirect3DRMTexture3 *iface, DWORD flags)
996 FIXME("iface %p, flags %#x stub!\n", iface, flags);
998 return E_NOTIMPL;
1001 static HRESULT WINAPI d3drm_texture3_GetSurface(IDirect3DRMTexture3 *iface,
1002 DWORD flags, IDirectDrawSurface **surface)
1004 FIXME("iface %p, flags %#x, surface %p stub!\n", iface, flags, surface);
1006 return E_NOTIMPL;
1009 static HRESULT WINAPI d3drm_texture3_SetCacheOptions(IDirect3DRMTexture3 *iface, LONG importance, DWORD flags)
1011 FIXME("iface %p, importance %d, flags %#x stub!\n", iface, importance, flags);
1013 return E_NOTIMPL;
1016 static HRESULT WINAPI d3drm_texture3_GetCacheOptions(IDirect3DRMTexture3 *iface,
1017 LONG *importance, DWORD *flags)
1019 FIXME("iface %p, importance %p, flags %p stub!\n", iface, importance, flags);
1021 return E_NOTIMPL;
1024 static HRESULT WINAPI d3drm_texture3_SetDownsampleCallback(IDirect3DRMTexture3 *iface,
1025 D3DRMDOWNSAMPLECALLBACK cb, void *ctx)
1027 FIXME("iface %p, cb %p, ctx %p stub!\n", iface, cb, ctx);
1029 return E_NOTIMPL;
1032 static HRESULT WINAPI d3drm_texture3_SetValidationCallback(IDirect3DRMTexture3 *iface,
1033 D3DRMVALIDATIONCALLBACK cb, void *ctx)
1035 FIXME("iface %p, cb %p, ctx %p stub!\n", iface, cb, ctx);
1037 return E_NOTIMPL;
1040 static const struct IDirect3DRMTexture3Vtbl d3drm_texture3_vtbl =
1042 d3drm_texture3_QueryInterface,
1043 d3drm_texture3_AddRef,
1044 d3drm_texture3_Release,
1045 d3drm_texture3_Clone,
1046 d3drm_texture3_AddDestroyCallback,
1047 d3drm_texture3_DeleteDestroyCallback,
1048 d3drm_texture3_SetAppData,
1049 d3drm_texture3_GetAppData,
1050 d3drm_texture3_SetName,
1051 d3drm_texture3_GetName,
1052 d3drm_texture3_GetClassName,
1053 d3drm_texture3_InitFromFile,
1054 d3drm_texture3_InitFromSurface,
1055 d3drm_texture3_InitFromResource,
1056 d3drm_texture3_Changed,
1057 d3drm_texture3_SetColors,
1058 d3drm_texture3_SetShades,
1059 d3drm_texture3_SetDecalSize,
1060 d3drm_texture3_SetDecalOrigin,
1061 d3drm_texture3_SetDecalScale,
1062 d3drm_texture3_SetDecalTransparency,
1063 d3drm_texture3_SetDecalTransparentColor,
1064 d3drm_texture3_GetDecalSize,
1065 d3drm_texture3_GetDecalOrigin,
1066 d3drm_texture3_GetImage,
1067 d3drm_texture3_GetShades,
1068 d3drm_texture3_GetColors,
1069 d3drm_texture3_GetDecalScale,
1070 d3drm_texture3_GetDecalTransparency,
1071 d3drm_texture3_GetDecalTransparentColor,
1072 d3drm_texture3_InitFromImage,
1073 d3drm_texture3_InitFromResource2,
1074 d3drm_texture3_GenerateMIPMap,
1075 d3drm_texture3_GetSurface,
1076 d3drm_texture3_SetCacheOptions,
1077 d3drm_texture3_GetCacheOptions,
1078 d3drm_texture3_SetDownsampleCallback,
1079 d3drm_texture3_SetValidationCallback,
1082 HRESULT d3drm_texture_create(struct d3drm_texture **texture, IDirect3DRM *d3drm)
1084 struct d3drm_texture *object;
1086 TRACE("texture %p.\n", texture);
1088 if (!(object = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(*object))))
1089 return E_OUTOFMEMORY;
1091 object->IDirect3DRMTexture_iface.lpVtbl = &d3drm_texture1_vtbl;
1092 object->IDirect3DRMTexture2_iface.lpVtbl = &d3drm_texture2_vtbl;
1093 object->IDirect3DRMTexture3_iface.lpVtbl = &d3drm_texture3_vtbl;
1094 object->d3drm = d3drm;
1096 d3drm_object_init(&object->obj);
1098 *texture = object;
1100 return D3DRM_OK;