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
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
|| texture
->surface
)
49 IDirect3DRM_Release(texture
->d3drm
);
51 IDirectDrawSurface_Release(texture
->surface
);
52 HeapFree(GetProcessHeap(), 0, texture
);
55 static BOOL
d3drm_validate_image(D3DRMIMAGE
*image
)
62 || !(image
->rgb
|| (image
->palette
&& image
->palette_size
)))
70 static HRESULT WINAPI
d3drm_texture1_QueryInterface(IDirect3DRMTexture
*iface
, REFIID riid
, void **out
)
72 struct d3drm_texture
*texture
= impl_from_IDirect3DRMTexture(iface
);
74 TRACE("iface %p, riid %s, out %p.\n", iface
, debugstr_guid(riid
), out
);
76 return IDirect3DRMTexture3_QueryInterface(&texture
->IDirect3DRMTexture3_iface
, riid
, out
);
79 static ULONG WINAPI
d3drm_texture1_AddRef(IDirect3DRMTexture
*iface
)
81 struct d3drm_texture
*texture
= impl_from_IDirect3DRMTexture(iface
);
83 TRACE("iface %p.\n", iface
);
85 return IDirect3DRMTexture3_AddRef(&texture
->IDirect3DRMTexture3_iface
);
88 static ULONG WINAPI
d3drm_texture1_Release(IDirect3DRMTexture
*iface
)
90 struct d3drm_texture
*texture
= impl_from_IDirect3DRMTexture(iface
);
92 TRACE("iface %p.\n", iface
);
94 return IDirect3DRMTexture3_Release(&texture
->IDirect3DRMTexture3_iface
);
97 static HRESULT WINAPI
d3drm_texture1_Clone(IDirect3DRMTexture
*iface
,
98 IUnknown
*outer
, REFIID iid
, void **out
)
100 struct d3drm_texture
*texture
= impl_from_IDirect3DRMTexture(iface
);
102 TRACE("iface %p, outer %p, iid %s, out %p.\n", iface
, outer
, debugstr_guid(iid
), out
);
104 return IDirect3DRMTexture3_Clone(&texture
->IDirect3DRMTexture3_iface
, outer
, iid
, out
);
107 static HRESULT WINAPI
d3drm_texture1_AddDestroyCallback(IDirect3DRMTexture
*iface
,
108 D3DRMOBJECTCALLBACK cb
, void *ctx
)
110 struct d3drm_texture
*texture
= impl_from_IDirect3DRMTexture(iface
);
112 TRACE("iface %p, cb %p, ctx %p\n", iface
, cb
, ctx
);
114 return IDirect3DRMTexture3_AddDestroyCallback(&texture
->IDirect3DRMTexture3_iface
, cb
, ctx
);
117 static HRESULT WINAPI
d3drm_texture1_DeleteDestroyCallback(IDirect3DRMTexture
*iface
,
118 D3DRMOBJECTCALLBACK cb
, void *ctx
)
120 struct d3drm_texture
*texture
= impl_from_IDirect3DRMTexture(iface
);
122 TRACE("iface %p, cb %p, ctx %p\n", iface
, cb
, ctx
);
124 return IDirect3DRMTexture3_DeleteDestroyCallback(&texture
->IDirect3DRMTexture3_iface
, cb
, ctx
);
127 static HRESULT WINAPI
d3drm_texture1_SetAppData(IDirect3DRMTexture
*iface
, DWORD data
)
129 struct d3drm_texture
*texture
= impl_from_IDirect3DRMTexture(iface
);
131 TRACE("iface %p, data %#x.\n", iface
, data
);
133 return IDirect3DRMTexture3_SetAppData(&texture
->IDirect3DRMTexture3_iface
, data
);
136 static DWORD WINAPI
d3drm_texture1_GetAppData(IDirect3DRMTexture
*iface
)
138 struct d3drm_texture
*texture
= impl_from_IDirect3DRMTexture(iface
);
140 TRACE("iface %p.\n", iface
);
142 return IDirect3DRMTexture3_GetAppData(&texture
->IDirect3DRMTexture3_iface
);
145 static HRESULT WINAPI
d3drm_texture1_SetName(IDirect3DRMTexture
*iface
, const char *name
)
147 struct d3drm_texture
*texture
= impl_from_IDirect3DRMTexture(iface
);
149 TRACE("iface %p, name %s.\n", iface
, debugstr_a(name
));
151 return IDirect3DRMTexture3_SetName(&texture
->IDirect3DRMTexture3_iface
, name
);
154 static HRESULT WINAPI
d3drm_texture1_GetName(IDirect3DRMTexture
*iface
, DWORD
*size
, char *name
)
156 struct d3drm_texture
*texture
= impl_from_IDirect3DRMTexture(iface
);
158 TRACE("iface %p, size %p, name %p.\n", iface
, size
, name
);
160 return IDirect3DRMTexture3_GetName(&texture
->IDirect3DRMTexture3_iface
, size
, name
);
163 static HRESULT WINAPI
d3drm_texture1_GetClassName(IDirect3DRMTexture
*iface
, DWORD
*size
, char *name
)
165 struct d3drm_texture
*texture
= impl_from_IDirect3DRMTexture(iface
);
167 TRACE("iface %p, size %p, name %p.\n", iface
, size
, name
);
169 return IDirect3DRMTexture3_GetClassName(&texture
->IDirect3DRMTexture3_iface
, size
, name
);
172 static HRESULT WINAPI
d3drm_texture1_InitFromFile(IDirect3DRMTexture
*iface
, const char *filename
)
174 FIXME("iface %p, filename %s stub!\n", iface
, debugstr_a(filename
));
179 static HRESULT WINAPI
d3drm_texture1_InitFromSurface(IDirect3DRMTexture
*iface
,
180 IDirectDrawSurface
*surface
)
182 struct d3drm_texture
*texture
= impl_from_IDirect3DRMTexture(iface
);
184 TRACE("iface %p, surface %p.\n", iface
, surface
);
186 return IDirect3DRMTexture3_InitFromSurface(&texture
->IDirect3DRMTexture3_iface
, surface
);
189 static HRESULT WINAPI
d3drm_texture1_InitFromResource(IDirect3DRMTexture
*iface
, HRSRC resource
)
191 FIXME("iface %p, resource %p stub!\n", iface
, resource
);
196 static HRESULT WINAPI
d3drm_texture1_Changed(IDirect3DRMTexture
*iface
, BOOL pixels
, BOOL palette
)
198 FIXME("iface %p, pixels %#x, palette %#x stub!\n", iface
, pixels
, palette
);
203 static HRESULT WINAPI
d3drm_texture1_SetColors(IDirect3DRMTexture
*iface
, DWORD max_colors
)
205 struct d3drm_texture
*texture
= impl_from_IDirect3DRMTexture(iface
);
207 TRACE("iface %p, max_colors %u.\n", iface
, max_colors
);
209 return IDirect3DRMTexture3_SetColors(&texture
->IDirect3DRMTexture3_iface
, max_colors
);
212 static HRESULT WINAPI
d3drm_texture1_SetShades(IDirect3DRMTexture
*iface
, DWORD max_shades
)
214 struct d3drm_texture
*texture
= impl_from_IDirect3DRMTexture(iface
);
216 TRACE("iface %p, max_shades %u.\n", iface
, max_shades
);
218 return IDirect3DRMTexture3_SetShades(&texture
->IDirect3DRMTexture3_iface
, max_shades
);
221 static HRESULT WINAPI
d3drm_texture1_SetDecalSize(IDirect3DRMTexture
*iface
, D3DVALUE width
, D3DVALUE height
)
223 struct d3drm_texture
*texture
= impl_from_IDirect3DRMTexture(iface
);
225 TRACE("iface %p, width %.8e, height %.8e.\n", iface
, width
, height
);
227 return IDirect3DRMTexture3_SetDecalSize(&texture
->IDirect3DRMTexture3_iface
, width
, height
);
230 static HRESULT WINAPI
d3drm_texture1_SetDecalOrigin(IDirect3DRMTexture
*iface
, LONG x
, LONG y
)
232 struct d3drm_texture
*texture
= impl_from_IDirect3DRMTexture(iface
);
234 TRACE("iface %p, x %d, y %d.\n", iface
, x
, y
);
236 return IDirect3DRMTexture3_SetDecalOrigin(&texture
->IDirect3DRMTexture3_iface
, x
, y
);
239 static HRESULT WINAPI
d3drm_texture1_SetDecalScale(IDirect3DRMTexture
*iface
, DWORD scale
)
241 struct d3drm_texture
*texture
= impl_from_IDirect3DRMTexture(iface
);
243 TRACE("iface %p, scale %u.\n", iface
, scale
);
245 return IDirect3DRMTexture3_SetDecalScale(&texture
->IDirect3DRMTexture3_iface
, scale
);
248 static HRESULT WINAPI
d3drm_texture1_SetDecalTransparency(IDirect3DRMTexture
*iface
, BOOL transparency
)
250 struct d3drm_texture
*texture
= impl_from_IDirect3DRMTexture(iface
);
252 TRACE("iface %p, transparency %#x.\n", iface
, transparency
);
254 return IDirect3DRMTexture3_SetDecalTransparency(&texture
->IDirect3DRMTexture3_iface
, transparency
);
257 static HRESULT WINAPI
d3drm_texture1_SetDecalTransparentColor(IDirect3DRMTexture
*iface
, D3DCOLOR color
)
259 struct d3drm_texture
*texture
= impl_from_IDirect3DRMTexture(iface
);
261 TRACE("iface %p, color 0x%08x.\n", iface
, color
);
263 return IDirect3DRMTexture3_SetDecalTransparentColor(&texture
->IDirect3DRMTexture3_iface
, color
);
266 static HRESULT WINAPI
d3drm_texture1_GetDecalSize(IDirect3DRMTexture
*iface
, D3DVALUE
*width
, D3DVALUE
*height
)
268 struct d3drm_texture
*texture
= impl_from_IDirect3DRMTexture(iface
);
270 TRACE("iface %p, width %p, height %p.\n", iface
, width
, height
);
272 return IDirect3DRMTexture3_GetDecalSize(&texture
->IDirect3DRMTexture3_iface
, width
, height
);
275 static HRESULT WINAPI
d3drm_texture1_GetDecalOrigin(IDirect3DRMTexture
*iface
, LONG
*x
, LONG
*y
)
277 struct d3drm_texture
*texture
= impl_from_IDirect3DRMTexture(iface
);
279 TRACE("iface %p, x %p, y %p.\n", iface
, x
, y
);
281 return IDirect3DRMTexture3_GetDecalOrigin(&texture
->IDirect3DRMTexture3_iface
, x
, y
);
284 static D3DRMIMAGE
* WINAPI
d3drm_texture1_GetImage(IDirect3DRMTexture
*iface
)
286 struct d3drm_texture
*texture
= impl_from_IDirect3DRMTexture(iface
);
288 TRACE("iface %p.\n", iface
);
290 return IDirect3DRMTexture3_GetImage(&texture
->IDirect3DRMTexture3_iface
);
293 static DWORD WINAPI
d3drm_texture1_GetShades(IDirect3DRMTexture
*iface
)
295 struct d3drm_texture
*texture
= impl_from_IDirect3DRMTexture(iface
);
297 TRACE("iface %p.\n", iface
);
299 return IDirect3DRMTexture3_GetShades(&texture
->IDirect3DRMTexture3_iface
);
302 static DWORD WINAPI
d3drm_texture1_GetColors(IDirect3DRMTexture
*iface
)
304 struct d3drm_texture
*texture
= impl_from_IDirect3DRMTexture(iface
);
306 TRACE("iface %p.\n", iface
);
308 return IDirect3DRMTexture3_GetColors(&texture
->IDirect3DRMTexture3_iface
);
311 static DWORD WINAPI
d3drm_texture1_GetDecalScale(IDirect3DRMTexture
*iface
)
313 struct d3drm_texture
*texture
= impl_from_IDirect3DRMTexture(iface
);
315 TRACE("iface %p.\n", iface
);
317 return IDirect3DRMTexture3_GetDecalScale(&texture
->IDirect3DRMTexture3_iface
);
320 static BOOL WINAPI
d3drm_texture1_GetDecalTransparency(IDirect3DRMTexture
*iface
)
322 struct d3drm_texture
*texture
= impl_from_IDirect3DRMTexture(iface
);
324 TRACE("iface %p.\n", iface
);
326 return IDirect3DRMTexture3_GetDecalTransparency(&texture
->IDirect3DRMTexture3_iface
);
329 static D3DCOLOR WINAPI
d3drm_texture1_GetDecalTransparentColor(IDirect3DRMTexture
*iface
)
331 struct d3drm_texture
*texture
= impl_from_IDirect3DRMTexture(iface
);
333 TRACE("iface %p.\n", iface
);
335 return IDirect3DRMTexture3_GetDecalTransparentColor(&texture
->IDirect3DRMTexture3_iface
);
338 static const struct IDirect3DRMTextureVtbl d3drm_texture1_vtbl
=
340 d3drm_texture1_QueryInterface
,
341 d3drm_texture1_AddRef
,
342 d3drm_texture1_Release
,
343 d3drm_texture1_Clone
,
344 d3drm_texture1_AddDestroyCallback
,
345 d3drm_texture1_DeleteDestroyCallback
,
346 d3drm_texture1_SetAppData
,
347 d3drm_texture1_GetAppData
,
348 d3drm_texture1_SetName
,
349 d3drm_texture1_GetName
,
350 d3drm_texture1_GetClassName
,
351 d3drm_texture1_InitFromFile
,
352 d3drm_texture1_InitFromSurface
,
353 d3drm_texture1_InitFromResource
,
354 d3drm_texture1_Changed
,
355 d3drm_texture1_SetColors
,
356 d3drm_texture1_SetShades
,
357 d3drm_texture1_SetDecalSize
,
358 d3drm_texture1_SetDecalOrigin
,
359 d3drm_texture1_SetDecalScale
,
360 d3drm_texture1_SetDecalTransparency
,
361 d3drm_texture1_SetDecalTransparentColor
,
362 d3drm_texture1_GetDecalSize
,
363 d3drm_texture1_GetDecalOrigin
,
364 d3drm_texture1_GetImage
,
365 d3drm_texture1_GetShades
,
366 d3drm_texture1_GetColors
,
367 d3drm_texture1_GetDecalScale
,
368 d3drm_texture1_GetDecalTransparency
,
369 d3drm_texture1_GetDecalTransparentColor
,
372 static HRESULT WINAPI
d3drm_texture2_QueryInterface(IDirect3DRMTexture2
*iface
, REFIID riid
, void **out
)
374 struct d3drm_texture
*texture
= impl_from_IDirect3DRMTexture2(iface
);
376 TRACE("iface %p, riid %s, out %p.\n", iface
, debugstr_guid(riid
), out
);
378 return IDirect3DRMTexture3_QueryInterface(&texture
->IDirect3DRMTexture3_iface
, riid
, out
);
381 static ULONG WINAPI
d3drm_texture2_AddRef(IDirect3DRMTexture2
*iface
)
383 struct d3drm_texture
*texture
= impl_from_IDirect3DRMTexture2(iface
);
385 TRACE("iface %p.\n", iface
);
387 return IDirect3DRMTexture3_AddRef(&texture
->IDirect3DRMTexture3_iface
);
390 static ULONG WINAPI
d3drm_texture2_Release(IDirect3DRMTexture2
*iface
)
392 struct d3drm_texture
*texture
= impl_from_IDirect3DRMTexture2(iface
);
394 TRACE("iface %p.\n", iface
);
396 return IDirect3DRMTexture3_Release(&texture
->IDirect3DRMTexture3_iface
);
399 static HRESULT WINAPI
d3drm_texture2_Clone(IDirect3DRMTexture2
*iface
,
400 IUnknown
*outer
, REFIID iid
, void **out
)
402 struct d3drm_texture
*texture
= impl_from_IDirect3DRMTexture2(iface
);
404 TRACE("iface %p, outer %p, iid %s, out %p.\n", iface
, outer
, debugstr_guid(iid
), out
);
406 return IDirect3DRMTexture3_Clone(&texture
->IDirect3DRMTexture3_iface
, outer
, iid
, out
);
409 static HRESULT WINAPI
d3drm_texture2_AddDestroyCallback(IDirect3DRMTexture2
*iface
,
410 D3DRMOBJECTCALLBACK cb
, void *ctx
)
412 struct d3drm_texture
*texture
= impl_from_IDirect3DRMTexture2(iface
);
414 TRACE("iface %p, cb %p, ctx %p\n", iface
, cb
, ctx
);
416 return IDirect3DRMTexture3_AddDestroyCallback(&texture
->IDirect3DRMTexture3_iface
, cb
, ctx
);
419 static HRESULT WINAPI
d3drm_texture2_DeleteDestroyCallback(IDirect3DRMTexture2
*iface
,
420 D3DRMOBJECTCALLBACK cb
, void *ctx
)
422 struct d3drm_texture
*texture
= impl_from_IDirect3DRMTexture2(iface
);
424 TRACE("iface %p, cb %p, ctx %p\n", iface
, cb
, ctx
);
426 return IDirect3DRMTexture3_DeleteDestroyCallback(&texture
->IDirect3DRMTexture3_iface
, cb
, ctx
);
429 static HRESULT WINAPI
d3drm_texture2_SetAppData(IDirect3DRMTexture2
*iface
, DWORD data
)
431 struct d3drm_texture
*texture
= impl_from_IDirect3DRMTexture2(iface
);
433 TRACE("iface %p, data %#x.\n", iface
, data
);
435 return IDirect3DRMTexture3_SetAppData(&texture
->IDirect3DRMTexture3_iface
, data
);
438 static DWORD WINAPI
d3drm_texture2_GetAppData(IDirect3DRMTexture2
*iface
)
440 struct d3drm_texture
*texture
= impl_from_IDirect3DRMTexture2(iface
);
442 TRACE("iface %p.\n", iface
);
444 return IDirect3DRMTexture3_GetAppData(&texture
->IDirect3DRMTexture3_iface
);
447 static HRESULT WINAPI
d3drm_texture2_SetName(IDirect3DRMTexture2
*iface
, const char *name
)
449 struct d3drm_texture
*texture
= impl_from_IDirect3DRMTexture2(iface
);
451 TRACE("iface %p, name %s.\n", iface
, debugstr_a(name
));
453 return IDirect3DRMTexture3_SetName(&texture
->IDirect3DRMTexture3_iface
, name
);
456 static HRESULT WINAPI
d3drm_texture2_GetName(IDirect3DRMTexture2
*iface
, DWORD
*size
, char *name
)
458 struct d3drm_texture
*texture
= impl_from_IDirect3DRMTexture2(iface
);
460 TRACE("iface %p, size %p, name %p.\n", iface
, size
, name
);
462 return IDirect3DRMTexture3_GetName(&texture
->IDirect3DRMTexture3_iface
, size
, name
);
465 static HRESULT WINAPI
d3drm_texture2_GetClassName(IDirect3DRMTexture2
*iface
, DWORD
*size
, char *name
)
467 struct d3drm_texture
*texture
= impl_from_IDirect3DRMTexture2(iface
);
469 TRACE("iface %p, size %p, name %p.\n", iface
, size
, name
);
471 return IDirect3DRMTexture3_GetClassName(&texture
->IDirect3DRMTexture3_iface
, size
, name
);
474 static HRESULT WINAPI
d3drm_texture2_InitFromFile(IDirect3DRMTexture2
*iface
, const char *filename
)
476 FIXME("iface %p, filename %s stub!\n", iface
, debugstr_a(filename
));
481 static HRESULT WINAPI
d3drm_texture2_InitFromSurface(IDirect3DRMTexture2
*iface
,
482 IDirectDrawSurface
*surface
)
484 struct d3drm_texture
*texture
= impl_from_IDirect3DRMTexture2(iface
);
486 TRACE("iface %p, surface %p.\n", iface
, surface
);
488 return IDirect3DRMTexture3_InitFromSurface(&texture
->IDirect3DRMTexture3_iface
, surface
);
491 static HRESULT WINAPI
d3drm_texture2_InitFromResource(IDirect3DRMTexture2
*iface
, HRSRC resource
)
493 FIXME("iface %p, resource %p stub!\n", iface
, resource
);
498 static HRESULT WINAPI
d3drm_texture2_Changed(IDirect3DRMTexture2
*iface
, BOOL pixels
, BOOL palette
)
500 FIXME("iface %p, pixels %#x, palette %#x stub!\n", iface
, pixels
, palette
);
505 static HRESULT WINAPI
d3drm_texture2_SetColors(IDirect3DRMTexture2
*iface
, DWORD max_colors
)
507 struct d3drm_texture
*texture
= impl_from_IDirect3DRMTexture2(iface
);
509 TRACE("iface %p, max_colors %u.\n", iface
, max_colors
);
511 return IDirect3DRMTexture3_SetColors(&texture
->IDirect3DRMTexture3_iface
, max_colors
);
514 static HRESULT WINAPI
d3drm_texture2_SetShades(IDirect3DRMTexture2
*iface
, DWORD max_shades
)
516 struct d3drm_texture
*texture
= impl_from_IDirect3DRMTexture2(iface
);
518 TRACE("iface %p, max_shades %u.\n", iface
, max_shades
);
520 return IDirect3DRMTexture3_SetShades(&texture
->IDirect3DRMTexture3_iface
, max_shades
);
523 static HRESULT WINAPI
d3drm_texture2_SetDecalSize(IDirect3DRMTexture2
*iface
, D3DVALUE width
, D3DVALUE height
)
525 struct d3drm_texture
*texture
= impl_from_IDirect3DRMTexture2(iface
);
527 TRACE("iface %p, width %.8e, height %.8e.\n", iface
, width
, height
);
529 return IDirect3DRMTexture3_SetDecalSize(&texture
->IDirect3DRMTexture3_iface
, width
, height
);
532 static HRESULT WINAPI
d3drm_texture2_SetDecalOrigin(IDirect3DRMTexture2
*iface
, LONG x
, LONG y
)
534 struct d3drm_texture
*texture
= impl_from_IDirect3DRMTexture2(iface
);
536 TRACE("iface %p, x %d, y %d.\n", iface
, x
, y
);
538 return IDirect3DRMTexture3_SetDecalOrigin(&texture
->IDirect3DRMTexture3_iface
, x
, y
);
541 static HRESULT WINAPI
d3drm_texture2_SetDecalScale(IDirect3DRMTexture2
*iface
, DWORD scale
)
543 struct d3drm_texture
*texture
= impl_from_IDirect3DRMTexture2(iface
);
545 TRACE("iface %p, scale %u.\n", iface
, scale
);
547 return IDirect3DRMTexture3_SetDecalScale(&texture
->IDirect3DRMTexture3_iface
, scale
);
550 static HRESULT WINAPI
d3drm_texture2_SetDecalTransparency(IDirect3DRMTexture2
*iface
, BOOL transparency
)
552 struct d3drm_texture
*texture
= impl_from_IDirect3DRMTexture2(iface
);
554 TRACE("iface %p, transparency %#x.\n", iface
, transparency
);
556 return IDirect3DRMTexture3_SetDecalTransparency(&texture
->IDirect3DRMTexture3_iface
, transparency
);
559 static HRESULT WINAPI
d3drm_texture2_SetDecalTransparentColor(IDirect3DRMTexture2
*iface
, D3DCOLOR color
)
561 struct d3drm_texture
*texture
= impl_from_IDirect3DRMTexture2(iface
);
563 TRACE("iface %p, color 0x%08x.\n", iface
, color
);
565 return IDirect3DRMTexture3_SetDecalTransparentColor(&texture
->IDirect3DRMTexture3_iface
, color
);
568 static HRESULT WINAPI
d3drm_texture2_GetDecalSize(IDirect3DRMTexture2
*iface
, D3DVALUE
*width
, D3DVALUE
*height
)
570 struct d3drm_texture
*texture
= impl_from_IDirect3DRMTexture2(iface
);
572 TRACE("iface %p, width %p, height %p.\n", iface
, width
, height
);
574 return IDirect3DRMTexture3_GetDecalSize(&texture
->IDirect3DRMTexture3_iface
, width
, height
);
577 static HRESULT WINAPI
d3drm_texture2_GetDecalOrigin(IDirect3DRMTexture2
*iface
, LONG
*x
, LONG
*y
)
579 struct d3drm_texture
*texture
= impl_from_IDirect3DRMTexture2(iface
);
581 TRACE("iface %p, x %p, y %p.\n", iface
, x
, y
);
583 return IDirect3DRMTexture3_GetDecalOrigin(&texture
->IDirect3DRMTexture3_iface
, x
, y
);
586 static D3DRMIMAGE
* WINAPI
d3drm_texture2_GetImage(IDirect3DRMTexture2
*iface
)
588 struct d3drm_texture
*texture
= impl_from_IDirect3DRMTexture2(iface
);
590 TRACE("iface %p.\n", iface
);
592 return IDirect3DRMTexture3_GetImage(&texture
->IDirect3DRMTexture3_iface
);
595 static DWORD WINAPI
d3drm_texture2_GetShades(IDirect3DRMTexture2
*iface
)
597 struct d3drm_texture
*texture
= impl_from_IDirect3DRMTexture2(iface
);
599 TRACE("iface %p.\n", iface
);
601 return IDirect3DRMTexture3_GetShades(&texture
->IDirect3DRMTexture3_iface
);
604 static DWORD WINAPI
d3drm_texture2_GetColors(IDirect3DRMTexture2
*iface
)
606 struct d3drm_texture
*texture
= impl_from_IDirect3DRMTexture2(iface
);
608 TRACE("iface %p.\n", iface
);
610 return IDirect3DRMTexture3_GetColors(&texture
->IDirect3DRMTexture3_iface
);
613 static DWORD WINAPI
d3drm_texture2_GetDecalScale(IDirect3DRMTexture2
*iface
)
615 struct d3drm_texture
*texture
= impl_from_IDirect3DRMTexture2(iface
);
617 TRACE("iface %p.\n", iface
);
619 return IDirect3DRMTexture3_GetDecalScale(&texture
->IDirect3DRMTexture3_iface
);
622 static BOOL WINAPI
d3drm_texture2_GetDecalTransparency(IDirect3DRMTexture2
*iface
)
624 struct d3drm_texture
*texture
= impl_from_IDirect3DRMTexture2(iface
);
626 TRACE("iface %p.\n", iface
);
628 return IDirect3DRMTexture3_GetDecalTransparency(&texture
->IDirect3DRMTexture3_iface
);
631 static D3DCOLOR WINAPI
d3drm_texture2_GetDecalTransparentColor(IDirect3DRMTexture2
*iface
)
633 struct d3drm_texture
*texture
= impl_from_IDirect3DRMTexture2(iface
);
635 TRACE("iface %p.\n", iface
);
637 return IDirect3DRMTexture3_GetDecalTransparentColor(&texture
->IDirect3DRMTexture3_iface
);
640 static HRESULT WINAPI
d3drm_texture2_InitFromImage(IDirect3DRMTexture2
*iface
, D3DRMIMAGE
*image
)
642 struct d3drm_texture
*texture
= impl_from_IDirect3DRMTexture2(iface
);
644 TRACE("iface %p, image %p.\n", iface
, image
);
646 return IDirect3DRMTexture3_InitFromImage(&texture
->IDirect3DRMTexture3_iface
, image
);
649 static HRESULT WINAPI
d3drm_texture2_InitFromResource2(IDirect3DRMTexture2
*iface
,
650 HMODULE module
, const char *name
, const char *type
)
652 FIXME("iface %p, module %p, name %s, type %s stub!\n",
653 iface
, module
, debugstr_a(name
), debugstr_a(type
));
658 static HRESULT WINAPI
d3drm_texture2_GenerateMIPMap(IDirect3DRMTexture2
*iface
, DWORD flags
)
660 struct d3drm_texture
*texture
= impl_from_IDirect3DRMTexture2(iface
);
662 TRACE("iface %p, flags %#x.\n", iface
, flags
);
664 return IDirect3DRMTexture3_GenerateMIPMap(&texture
->IDirect3DRMTexture3_iface
, flags
);
667 static const struct IDirect3DRMTexture2Vtbl d3drm_texture2_vtbl
=
669 d3drm_texture2_QueryInterface
,
670 d3drm_texture2_AddRef
,
671 d3drm_texture2_Release
,
672 d3drm_texture2_Clone
,
673 d3drm_texture2_AddDestroyCallback
,
674 d3drm_texture2_DeleteDestroyCallback
,
675 d3drm_texture2_SetAppData
,
676 d3drm_texture2_GetAppData
,
677 d3drm_texture2_SetName
,
678 d3drm_texture2_GetName
,
679 d3drm_texture2_GetClassName
,
680 d3drm_texture2_InitFromFile
,
681 d3drm_texture2_InitFromSurface
,
682 d3drm_texture2_InitFromResource
,
683 d3drm_texture2_Changed
,
684 d3drm_texture2_SetColors
,
685 d3drm_texture2_SetShades
,
686 d3drm_texture2_SetDecalSize
,
687 d3drm_texture2_SetDecalOrigin
,
688 d3drm_texture2_SetDecalScale
,
689 d3drm_texture2_SetDecalTransparency
,
690 d3drm_texture2_SetDecalTransparentColor
,
691 d3drm_texture2_GetDecalSize
,
692 d3drm_texture2_GetDecalOrigin
,
693 d3drm_texture2_GetImage
,
694 d3drm_texture2_GetShades
,
695 d3drm_texture2_GetColors
,
696 d3drm_texture2_GetDecalScale
,
697 d3drm_texture2_GetDecalTransparency
,
698 d3drm_texture2_GetDecalTransparentColor
,
699 d3drm_texture2_InitFromImage
,
700 d3drm_texture2_InitFromResource2
,
701 d3drm_texture2_GenerateMIPMap
,
704 static HRESULT WINAPI
d3drm_texture3_QueryInterface(IDirect3DRMTexture3
*iface
, REFIID riid
, void **out
)
706 struct d3drm_texture
*texture
= impl_from_IDirect3DRMTexture3(iface
);
708 TRACE("iface %p, riid %s, out %p.\n", iface
, debugstr_guid(riid
), out
);
710 if (IsEqualGUID(riid
, &IID_IDirect3DRMTexture
)
711 || IsEqualGUID(riid
, &IID_IDirect3DRMVisual
)
712 || IsEqualGUID(riid
, &IID_IDirect3DRMObject
)
713 || IsEqualGUID(riid
, &IID_IUnknown
))
715 *out
= &texture
->IDirect3DRMTexture_iface
;
717 else if (IsEqualGUID(riid
, &IID_IDirect3DRMTexture2
))
719 *out
= &texture
->IDirect3DRMTexture2_iface
;
721 else if (IsEqualGUID(riid
, &IID_IDirect3DRMTexture3
))
723 *out
= &texture
->IDirect3DRMTexture3_iface
;
728 WARN("%s not implemented, returning CLASS_E_CLASSNOTAVAILABLE.\n", debugstr_guid(riid
));
729 return CLASS_E_CLASSNOTAVAILABLE
;
732 IUnknown_AddRef((IUnknown
*)*out
);
736 static ULONG WINAPI
d3drm_texture3_AddRef(IDirect3DRMTexture3
*iface
)
738 struct d3drm_texture
*texture
= impl_from_IDirect3DRMTexture3(iface
);
739 ULONG refcount
= InterlockedIncrement(&texture
->obj
.ref
);
741 TRACE("%p increasing refcount to %u.\n", iface
, refcount
);
746 static ULONG WINAPI
d3drm_texture3_Release(IDirect3DRMTexture3
*iface
)
748 struct d3drm_texture
*texture
= impl_from_IDirect3DRMTexture3(iface
);
749 ULONG refcount
= InterlockedDecrement(&texture
->obj
.ref
);
751 TRACE("%p decreasing refcount to %u.\n", iface
, refcount
);
754 d3drm_texture_destroy(texture
);
759 static HRESULT WINAPI
d3drm_texture3_Clone(IDirect3DRMTexture3
*iface
,
760 IUnknown
*outer
, REFIID iid
, void **out
)
762 FIXME("iface %p, outer %p, iid %s, out %p stub!\n", iface
, outer
, debugstr_guid(iid
), out
);
767 static HRESULT WINAPI
d3drm_texture3_AddDestroyCallback(IDirect3DRMTexture3
*iface
,
768 D3DRMOBJECTCALLBACK cb
, void *ctx
)
770 struct d3drm_texture
*texture
= impl_from_IDirect3DRMTexture3(iface
);
772 TRACE("iface %p, cb %p, ctx %p\n", iface
, cb
, ctx
);
774 return d3drm_object_add_destroy_callback(&texture
->obj
, cb
, ctx
);
777 static HRESULT WINAPI
d3drm_texture3_DeleteDestroyCallback(IDirect3DRMTexture3
*iface
,
778 D3DRMOBJECTCALLBACK cb
, void *ctx
)
780 struct d3drm_texture
*texture
= impl_from_IDirect3DRMTexture3(iface
);
782 TRACE("iface %p, cb %p, ctx %p\n", iface
, cb
, ctx
);
784 return d3drm_object_delete_destroy_callback(&texture
->obj
, cb
, ctx
);
787 static HRESULT WINAPI
d3drm_texture3_SetAppData(IDirect3DRMTexture3
*iface
, DWORD data
)
789 struct d3drm_texture
*texture
= impl_from_IDirect3DRMTexture3(iface
);
791 TRACE("iface %p, data %#x.\n", iface
, data
);
793 texture
->obj
.appdata
= data
;
798 static DWORD WINAPI
d3drm_texture3_GetAppData(IDirect3DRMTexture3
*iface
)
800 struct d3drm_texture
*texture
= impl_from_IDirect3DRMTexture3(iface
);
802 TRACE("iface %p.\n", iface
);
804 return texture
->obj
.appdata
;
807 static HRESULT WINAPI
d3drm_texture3_SetName(IDirect3DRMTexture3
*iface
, const char *name
)
809 struct d3drm_texture
*texture
= impl_from_IDirect3DRMTexture3(iface
);
811 TRACE("iface %p, name %s.\n", iface
, debugstr_a(name
));
813 return d3drm_object_set_name(&texture
->obj
, name
);
816 static HRESULT WINAPI
d3drm_texture3_GetName(IDirect3DRMTexture3
*iface
, DWORD
*size
, char *name
)
818 struct d3drm_texture
*texture
= impl_from_IDirect3DRMTexture3(iface
);
820 TRACE("iface %p, size %p, name %p.\n", iface
, size
, name
);
822 return d3drm_object_get_name(&texture
->obj
, size
, name
);
825 static HRESULT WINAPI
d3drm_texture3_GetClassName(IDirect3DRMTexture3
*iface
, DWORD
*size
, char *name
)
827 struct d3drm_texture
*texture
= impl_from_IDirect3DRMTexture3(iface
);
829 TRACE("iface %p, size %p, name %p.\n", iface
, size
, name
);
831 return d3drm_object_get_class_name(&texture
->obj
, size
, name
);
834 static HRESULT WINAPI
d3drm_texture3_InitFromFile(IDirect3DRMTexture3
*iface
, const char *filename
)
836 FIXME("iface %p, filename %s stub!\n", iface
, debugstr_a(filename
));
841 static HRESULT WINAPI
d3drm_texture3_InitFromSurface(IDirect3DRMTexture3
*iface
,
842 IDirectDrawSurface
*surface
)
844 struct d3drm_texture
*texture
= impl_from_IDirect3DRMTexture3(iface
);
846 TRACE("iface %p, surface %p.\n", iface
, surface
);
849 return D3DRMERR_BADOBJECT
;
851 /* d3drm intentionally leaks a reference to IDirect3DRM here if texture has already been initialized. */
852 IDirect3DRM_AddRef(texture
->d3drm
);
854 if (texture
->image
|| texture
->surface
)
855 return D3DRMERR_BADOBJECT
;
857 texture
->surface
= surface
;
858 IDirectDrawSurface_AddRef(texture
->surface
);
862 static HRESULT WINAPI
d3drm_texture3_InitFromResource(IDirect3DRMTexture3
*iface
, HRSRC resource
)
864 FIXME("iface %p, resource %p stub!\n", iface
, resource
);
869 static HRESULT WINAPI
d3drm_texture3_Changed(IDirect3DRMTexture3
*iface
,
870 DWORD flags
, DWORD rect_count
, RECT
*rects
)
872 FIXME("iface %p, flags %#x, rect_count %u, rects %p stub!\n", iface
, flags
, rect_count
, rects
);
877 static HRESULT WINAPI
d3drm_texture3_SetColors(IDirect3DRMTexture3
*iface
, DWORD max_colors
)
879 FIXME("iface %p, max_colors %u stub!\n", iface
, max_colors
);
884 static HRESULT WINAPI
d3drm_texture3_SetShades(IDirect3DRMTexture3
*iface
, DWORD max_shades
)
886 FIXME("iface %p, max_shades %u stub!\n", iface
, max_shades
);
891 static HRESULT WINAPI
d3drm_texture3_SetDecalSize(IDirect3DRMTexture3
*iface
, D3DVALUE width
, D3DVALUE height
)
893 FIXME("iface %p, width %.8e, height %.8e stub!\n", iface
, width
, height
);
898 static HRESULT WINAPI
d3drm_texture3_SetDecalOrigin(IDirect3DRMTexture3
*iface
, LONG x
, LONG y
)
900 FIXME("iface %p, x %d, y %d stub!\n", iface
, x
, y
);
905 static HRESULT WINAPI
d3drm_texture3_SetDecalScale(IDirect3DRMTexture3
*iface
, DWORD scale
)
907 FIXME("iface %p, scale %u stub!\n", iface
, scale
);
912 static HRESULT WINAPI
d3drm_texture3_SetDecalTransparency(IDirect3DRMTexture3
*iface
, BOOL transparency
)
914 FIXME("iface %p, transparency %#x stub!\n", iface
, transparency
);
919 static HRESULT WINAPI
d3drm_texture3_SetDecalTransparentColor(IDirect3DRMTexture3
*iface
, D3DCOLOR color
)
921 FIXME("iface %p, color 0x%08x stub!\n", iface
, color
);
926 static HRESULT WINAPI
d3drm_texture3_GetDecalSize(IDirect3DRMTexture3
*iface
, D3DVALUE
*width
, D3DVALUE
*height
)
928 FIXME("iface %p, width %p, height %p stub!\n", iface
, width
, height
);
933 static HRESULT WINAPI
d3drm_texture3_GetDecalOrigin(IDirect3DRMTexture3
*iface
, LONG
*x
, LONG
*y
)
935 FIXME("iface %p, x %p, y %p stub!\n", iface
, x
, y
);
940 static D3DRMIMAGE
* WINAPI
d3drm_texture3_GetImage(IDirect3DRMTexture3
*iface
)
942 struct d3drm_texture
*texture
= impl_from_IDirect3DRMTexture3(iface
);
944 TRACE("iface %p.\n", iface
);
946 return texture
->image
;
949 static DWORD WINAPI
d3drm_texture3_GetShades(IDirect3DRMTexture3
*iface
)
951 FIXME("iface %p stub!\n", iface
);
956 static DWORD WINAPI
d3drm_texture3_GetColors(IDirect3DRMTexture3
*iface
)
958 FIXME("iface %p stub!\n", iface
);
963 static DWORD WINAPI
d3drm_texture3_GetDecalScale(IDirect3DRMTexture3
*iface
)
965 FIXME("iface %p stub!\n", iface
);
970 static BOOL WINAPI
d3drm_texture3_GetDecalTransparency(IDirect3DRMTexture3
*iface
)
972 FIXME("iface %p stub!\n", iface
);
977 static D3DCOLOR WINAPI
d3drm_texture3_GetDecalTransparentColor(IDirect3DRMTexture3
*iface
)
979 FIXME("iface %p stub!\n", iface
);
984 static HRESULT WINAPI
d3drm_texture3_InitFromImage(IDirect3DRMTexture3
*iface
, D3DRMIMAGE
*image
)
986 struct d3drm_texture
*texture
= impl_from_IDirect3DRMTexture3(iface
);
988 TRACE("iface %p, image %p.\n", iface
, image
);
990 if (!d3drm_validate_image(image
))
991 return D3DRMERR_BADOBJECT
;
993 /* d3drm intentionally leaks a reference to IDirect3DRM here if texture has already been initialized. */
994 IDirect3DRM_AddRef(texture
->d3drm
);
996 if (texture
->image
|| texture
->surface
)
997 return D3DRMERR_BADOBJECT
;
999 texture
->image
= image
;
1004 static HRESULT WINAPI
d3drm_texture3_InitFromResource2(IDirect3DRMTexture3
*iface
,
1005 HMODULE module
, const char *name
, const char *type
)
1007 FIXME("iface %p, module %p, name %s, type %s stub!\n",
1008 iface
, module
, debugstr_a(name
), debugstr_a(type
));
1013 static HRESULT WINAPI
d3drm_texture3_GenerateMIPMap(IDirect3DRMTexture3
*iface
, DWORD flags
)
1015 FIXME("iface %p, flags %#x stub!\n", iface
, flags
);
1020 static HRESULT WINAPI
d3drm_texture3_GetSurface(IDirect3DRMTexture3
*iface
,
1021 DWORD flags
, IDirectDrawSurface
**surface
)
1023 struct d3drm_texture
*texture
= impl_from_IDirect3DRMTexture3(iface
);
1025 TRACE("iface %p, flags %#x, surface %p.\n", iface
, flags
, surface
);
1028 FIXME("unexpected flags %#x.\n", flags
);
1031 return D3DRMERR_BADVALUE
;
1034 return D3DRMERR_NOTCREATEDFROMDDS
;
1036 *surface
= texture
->surface
;
1037 IDirectDrawSurface_AddRef(*surface
);
1042 static HRESULT WINAPI
d3drm_texture3_SetCacheOptions(IDirect3DRMTexture3
*iface
, LONG importance
, DWORD flags
)
1044 FIXME("iface %p, importance %d, flags %#x stub!\n", iface
, importance
, flags
);
1049 static HRESULT WINAPI
d3drm_texture3_GetCacheOptions(IDirect3DRMTexture3
*iface
,
1050 LONG
*importance
, DWORD
*flags
)
1052 FIXME("iface %p, importance %p, flags %p stub!\n", iface
, importance
, flags
);
1057 static HRESULT WINAPI
d3drm_texture3_SetDownsampleCallback(IDirect3DRMTexture3
*iface
,
1058 D3DRMDOWNSAMPLECALLBACK cb
, void *ctx
)
1060 FIXME("iface %p, cb %p, ctx %p stub!\n", iface
, cb
, ctx
);
1065 static HRESULT WINAPI
d3drm_texture3_SetValidationCallback(IDirect3DRMTexture3
*iface
,
1066 D3DRMVALIDATIONCALLBACK cb
, void *ctx
)
1068 FIXME("iface %p, cb %p, ctx %p stub!\n", iface
, cb
, ctx
);
1073 static const struct IDirect3DRMTexture3Vtbl d3drm_texture3_vtbl
=
1075 d3drm_texture3_QueryInterface
,
1076 d3drm_texture3_AddRef
,
1077 d3drm_texture3_Release
,
1078 d3drm_texture3_Clone
,
1079 d3drm_texture3_AddDestroyCallback
,
1080 d3drm_texture3_DeleteDestroyCallback
,
1081 d3drm_texture3_SetAppData
,
1082 d3drm_texture3_GetAppData
,
1083 d3drm_texture3_SetName
,
1084 d3drm_texture3_GetName
,
1085 d3drm_texture3_GetClassName
,
1086 d3drm_texture3_InitFromFile
,
1087 d3drm_texture3_InitFromSurface
,
1088 d3drm_texture3_InitFromResource
,
1089 d3drm_texture3_Changed
,
1090 d3drm_texture3_SetColors
,
1091 d3drm_texture3_SetShades
,
1092 d3drm_texture3_SetDecalSize
,
1093 d3drm_texture3_SetDecalOrigin
,
1094 d3drm_texture3_SetDecalScale
,
1095 d3drm_texture3_SetDecalTransparency
,
1096 d3drm_texture3_SetDecalTransparentColor
,
1097 d3drm_texture3_GetDecalSize
,
1098 d3drm_texture3_GetDecalOrigin
,
1099 d3drm_texture3_GetImage
,
1100 d3drm_texture3_GetShades
,
1101 d3drm_texture3_GetColors
,
1102 d3drm_texture3_GetDecalScale
,
1103 d3drm_texture3_GetDecalTransparency
,
1104 d3drm_texture3_GetDecalTransparentColor
,
1105 d3drm_texture3_InitFromImage
,
1106 d3drm_texture3_InitFromResource2
,
1107 d3drm_texture3_GenerateMIPMap
,
1108 d3drm_texture3_GetSurface
,
1109 d3drm_texture3_SetCacheOptions
,
1110 d3drm_texture3_GetCacheOptions
,
1111 d3drm_texture3_SetDownsampleCallback
,
1112 d3drm_texture3_SetValidationCallback
,
1115 HRESULT
d3drm_texture_create(struct d3drm_texture
**texture
, IDirect3DRM
*d3drm
)
1117 static const char classname
[] = "Texture";
1118 struct d3drm_texture
*object
;
1120 TRACE("texture %p.\n", texture
);
1122 if (!(object
= HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY
, sizeof(*object
))))
1123 return E_OUTOFMEMORY
;
1125 object
->IDirect3DRMTexture_iface
.lpVtbl
= &d3drm_texture1_vtbl
;
1126 object
->IDirect3DRMTexture2_iface
.lpVtbl
= &d3drm_texture2_vtbl
;
1127 object
->IDirect3DRMTexture3_iface
.lpVtbl
= &d3drm_texture3_vtbl
;
1128 object
->d3drm
= d3drm
;
1130 d3drm_object_init(&object
->obj
, classname
);