~ubuntu-branches/ubuntu/precise/wine1.3/precise

« back to all changes in this revision

Viewing changes to dlls/ddraw/material.c

  • Committer: Package Import Robot
  • Author(s): Scott Ritchie
  • Date: 2012-01-17 09:00:34 UTC
  • mfrom: (1.1.2)
  • Revision ID: package-import@ubuntu.com-20120117090034-eyhpp02jawlvrrkc
Tags: 1.3.37-0ubuntu1
* New upstream release
  - Many changes
* Convert to 3.0 source format
* debian/control:
  - Remove pre-multiarch amd64 build depends
  - Remove quilt build depends
  - Recommend proper gecko versions
* debian/rules:
  - Remove manual dh_quilt patch and unpatch
  - No need to uuencode/uudecode anymore with new source format

Show diffs side-by-side

added added

removed removed

Lines of Context:
142
142
    {
143
143
        if(This->Handle)
144
144
        {
145
 
            EnterCriticalSection(&ddraw_cs);
 
145
            wined3d_mutex_lock();
146
146
            ddraw_free_handle(&This->ddraw->d3ddevice->handle_table, This->Handle - 1, DDRAW_HANDLE_MATERIAL);
147
 
            LeaveCriticalSection(&ddraw_cs);
 
147
            wined3d_mutex_unlock();
148
148
        }
149
149
 
150
150
        HeapFree(GetProcessHeap(), 0, This);
236
236
        dump_material(lpMat);
237
237
 
238
238
    /* Stores the material */
239
 
    EnterCriticalSection(&ddraw_cs);
 
239
    wined3d_mutex_lock();
240
240
    memset(&This->mat, 0, sizeof(This->mat));
241
241
    memcpy(&This->mat, lpMat, lpMat->dwSize);
242
 
    LeaveCriticalSection(&ddraw_cs);
 
242
    wined3d_mutex_unlock();
243
243
 
244
244
    return DD_OK;
245
245
}
271
271
    }
272
272
 
273
273
    /* Copies the material structure */
274
 
    EnterCriticalSection(&ddraw_cs);
 
274
    wined3d_mutex_lock();
275
275
    dwSize = lpMat->dwSize;
276
276
    memcpy(lpMat, &This->mat, dwSize);
277
 
    LeaveCriticalSection(&ddraw_cs);
 
277
    wined3d_mutex_unlock();
278
278
 
279
279
    return DD_OK;
280
280
}
295
295
 *
296
296
 *****************************************************************************/
297
297
static HRESULT WINAPI IDirect3DMaterialImpl_GetHandle(IDirect3DMaterial3 *iface,
298
 
        IDirect3DDevice3 *lpDirect3DDevice3, D3DMATERIALHANDLE *lpHandle)
 
298
        IDirect3DDevice3 *device, D3DMATERIALHANDLE *handle)
299
299
{
300
300
    IDirect3DMaterialImpl *This = impl_from_IDirect3DMaterial3(iface);
301
 
    IDirect3DDeviceImpl *device = device_from_device3(lpDirect3DDevice3);
302
 
 
303
 
    TRACE("iface %p, device %p, handle %p.\n", iface, lpDirect3DDevice3, lpHandle);
304
 
 
305
 
    EnterCriticalSection(&ddraw_cs);
306
 
    This->active_device = device;
 
301
    IDirect3DDeviceImpl *device_impl = unsafe_impl_from_IDirect3DDevice3(device);
 
302
 
 
303
    TRACE("iface %p, device %p, handle %p.\n", iface, device, handle);
 
304
 
 
305
    wined3d_mutex_lock();
 
306
    This->active_device = device_impl;
307
307
    if(!This->Handle)
308
308
    {
309
 
        DWORD h = ddraw_allocate_handle(&device->handle_table, This, DDRAW_HANDLE_MATERIAL);
 
309
        DWORD h = ddraw_allocate_handle(&device_impl->handle_table, This, DDRAW_HANDLE_MATERIAL);
310
310
        if (h == DDRAW_INVALID_HANDLE)
311
311
        {
312
312
            ERR("Failed to allocate a material handle.\n");
313
 
            LeaveCriticalSection(&ddraw_cs);
 
313
            wined3d_mutex_unlock();
314
314
            return DDERR_INVALIDPARAMS;   /* Unchecked */
315
315
        }
316
316
 
317
317
        This->Handle = h + 1;
318
318
    }
319
 
    *lpHandle = This->Handle;
320
 
    TRACE(" returning handle %08x.\n", *lpHandle);
321
 
    LeaveCriticalSection(&ddraw_cs);
 
319
    *handle = This->Handle;
 
320
    TRACE(" returning handle %08x.\n", *handle);
 
321
    wined3d_mutex_unlock();
322
322
 
323
323
    return D3D_OK;
324
324
}
325
325
 
326
326
static HRESULT WINAPI IDirect3DMaterialImpl_2_GetHandle(IDirect3DMaterial2 *iface,
327
 
        IDirect3DDevice2 *lpDirect3DDevice2, D3DMATERIALHANDLE *lpHandle)
 
327
        IDirect3DDevice2 *device, D3DMATERIALHANDLE *handle)
328
328
{
329
329
    IDirect3DMaterialImpl *This = impl_from_IDirect3DMaterial2(iface);
330
 
 
331
 
    TRACE("iface %p, device %p, handle %p.\n", iface, lpDirect3DDevice2, lpHandle);
332
 
 
333
 
    return IDirect3DMaterial3_GetHandle(&This->IDirect3DMaterial3_iface, lpDirect3DDevice2 ?
334
 
            (IDirect3DDevice3 *)&device_from_device2(lpDirect3DDevice2)->IDirect3DDevice3_vtbl : NULL, lpHandle);
 
330
    IDirect3DDeviceImpl *device_impl = unsafe_impl_from_IDirect3DDevice2(device);
 
331
 
 
332
    TRACE("iface %p, device %p, handle %p.\n", iface, device, handle);
 
333
 
 
334
    return IDirect3DMaterial3_GetHandle(&This->IDirect3DMaterial3_iface, device_impl ?
 
335
            &device_impl->IDirect3DDevice3_iface : NULL, handle);
335
336
}
336
337
 
337
338
static HRESULT WINAPI IDirect3DMaterialImpl_1_GetHandle(IDirect3DMaterial *iface,
338
 
        IDirect3DDevice *lpDirect3DDevice, D3DMATERIALHANDLE *lpHandle)
 
339
        IDirect3DDevice *device, D3DMATERIALHANDLE *handle)
339
340
{
340
341
    IDirect3DMaterialImpl *This = impl_from_IDirect3DMaterial(iface);
341
 
 
342
 
    TRACE("iface %p, device %p, handle %p.\n", iface, lpDirect3DDevice, lpHandle);
343
 
 
344
 
    return IDirect3DMaterial3_GetHandle(&This->IDirect3DMaterial3_iface, lpDirect3DDevice ?
345
 
            (IDirect3DDevice3 *)&device_from_device1(lpDirect3DDevice)->IDirect3DDevice3_vtbl : NULL, lpHandle);
 
342
    IDirect3DDeviceImpl *device_impl = unsafe_impl_from_IDirect3DDevice(device);
 
343
 
 
344
    TRACE("iface %p, device %p, handle %p.\n", iface, device, handle);
 
345
 
 
346
    return IDirect3DMaterial3_GetHandle(&This->IDirect3DMaterial3_iface, device_impl ?
 
347
            &device_impl->IDirect3DDevice3_iface : NULL, handle);
346
348
}
347
349
 
348
350
static HRESULT WINAPI IDirect3DMaterialImpl_2_QueryInterface(IDirect3DMaterial2 *iface, REFIID riid,
462
464
    d3d7mat.u3.emissive = This->mat.u3.emissive;
463
465
    d3d7mat.u4.power = This->mat.u4.power;
464
466
 
465
 
    IDirect3DDevice7_SetMaterial((IDirect3DDevice7 *)This->active_device, &d3d7mat);
 
467
    IDirect3DDevice7_SetMaterial(&This->active_device->IDirect3DDevice7_iface, &d3d7mat);
466
468
}
467
469
 
468
470
static const struct IDirect3DMaterial3Vtbl d3d_material3_vtbl =