Commit 2fa5a221 authored by Henri Verbeet's avatar Henri Verbeet Committed by Alexandre Julliard

wined3d: Get rid of the WINED3DLOCKED_BOX typedef.

parent eafebc04
......@@ -363,8 +363,8 @@ static HRESULT STDMETHODCALLTYPE d3d10_texture3d_Map(ID3D10Texture3D *iface, UIN
D3D10_MAP map_type, UINT map_flags, D3D10_MAPPED_TEXTURE3D *mapped_texture)
{
struct d3d10_texture3d *texture = impl_from_ID3D10Texture3D(iface);
struct wined3d_mapped_box wined3d_map_desc;
struct wined3d_resource *sub_resource;
WINED3DLOCKED_BOX wined3d_map_desc;
HRESULT hr;
TRACE("iface %p, sub_resource_idx %u, map_type %u, map_flags %#x, mapped_texture %p.\n",
......@@ -380,9 +380,9 @@ static HRESULT STDMETHODCALLTYPE d3d10_texture3d_Map(ID3D10Texture3D *iface, UIN
else if (SUCCEEDED(hr = wined3d_volume_map(wined3d_volume_from_resource(sub_resource),
&wined3d_map_desc, NULL, 0)))
{
mapped_texture->pData = wined3d_map_desc.pBits;
mapped_texture->RowPitch = wined3d_map_desc.RowPitch;
mapped_texture->DepthPitch = wined3d_map_desc.SlicePitch;
mapped_texture->pData = wined3d_map_desc.data;
mapped_texture->RowPitch = wined3d_map_desc.row_pitch;
mapped_texture->DepthPitch = wined3d_map_desc.slice_pitch;
}
return hr;
......
......@@ -227,7 +227,7 @@ static HRESULT WINAPI IDirect3DVolume8Impl_LockBox(IDirect3DVolume8 *iface,
iface, pLockedVolume, pBox, Flags);
wined3d_mutex_lock();
hr = wined3d_volume_map(This->wined3d_volume, (WINED3DLOCKED_BOX *)pLockedVolume,
hr = wined3d_volume_map(This->wined3d_volume, (struct wined3d_mapped_box *)pLockedVolume,
(const WINED3DBOX *)pBox, Flags);
wined3d_mutex_unlock();
......
......@@ -225,7 +225,7 @@ static HRESULT WINAPI IDirect3DVolume9Impl_LockBox(IDirect3DVolume9 *iface,
iface, pLockedVolume, pBox, Flags);
wined3d_mutex_lock();
hr = wined3d_volume_map(This->wined3d_volume, (WINED3DLOCKED_BOX *)pLockedVolume,
hr = wined3d_volume_map(This->wined3d_volume, (struct wined3d_mapped_box *)pLockedVolume,
(const WINED3DBOX *)pBox, Flags);
wined3d_mutex_unlock();
......
......@@ -4301,8 +4301,8 @@ HRESULT CDECL wined3d_device_draw_indexed_primitive_strided(struct wined3d_devic
static HRESULT device_update_volume(struct wined3d_device *device,
struct wined3d_volume *src_volume, struct wined3d_volume *dst_volume)
{
WINED3DLOCKED_BOX src;
WINED3DLOCKED_BOX dst;
struct wined3d_mapped_box src;
struct wined3d_mapped_box dst;
HRESULT hr;
TRACE("device %p, src_volume %p, dst_volume %p.\n",
......@@ -4319,7 +4319,7 @@ static HRESULT device_update_volume(struct wined3d_device *device,
return hr;
}
memcpy(dst.pBits, src.pBits, dst_volume->resource.size);
memcpy(dst.data, src.data, dst_volume->resource.size);
hr = wined3d_volume_unmap(dst_volume);
if (FAILED(hr))
......
......@@ -185,23 +185,23 @@ struct wined3d_resource * CDECL wined3d_volume_get_resource(struct wined3d_volum
}
HRESULT CDECL wined3d_volume_map(struct wined3d_volume *volume,
WINED3DLOCKED_BOX *locked_box, const WINED3DBOX *box, DWORD flags)
struct wined3d_mapped_box *mapped_box, const WINED3DBOX *box, DWORD flags)
{
TRACE("volume %p, locked_box %p, box %p, flags %#x.\n",
volume, locked_box, box, flags);
TRACE("volume %p, mapped_box %p, box %p, flags %#x.\n",
volume, mapped_box, box, flags);
if (!volume->resource.allocatedMemory)
volume->resource.allocatedMemory = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, volume->resource.size);
TRACE("allocatedMemory %p.\n", volume->resource.allocatedMemory);
locked_box->RowPitch = volume->resource.format->byte_count * volume->resource.width; /* Bytes / row */
locked_box->SlicePitch = volume->resource.format->byte_count
mapped_box->row_pitch = volume->resource.format->byte_count * volume->resource.width; /* Bytes / row */
mapped_box->slice_pitch = volume->resource.format->byte_count
* volume->resource.width * volume->resource.height; /* Bytes / slice */
if (!box)
{
TRACE("No box supplied - all is ok\n");
locked_box->pBits = volume->resource.allocatedMemory;
mapped_box->data = volume->resource.allocatedMemory;
volume->lockedBox.Left = 0;
volume->lockedBox.Top = 0;
volume->lockedBox.Front = 0;
......@@ -213,9 +213,9 @@ HRESULT CDECL wined3d_volume_map(struct wined3d_volume *volume,
{
TRACE("Lock Box (%p) = l %d, t %d, r %d, b %d, fr %d, ba %d\n",
box, box->Left, box->Top, box->Right, box->Bottom, box->Front, box->Back);
locked_box->pBits = volume->resource.allocatedMemory
+ (locked_box->SlicePitch * box->Front) /* FIXME: is front < back or vica versa? */
+ (locked_box->RowPitch * box->Top)
mapped_box->data = volume->resource.allocatedMemory
+ (mapped_box->slice_pitch * box->Front) /* FIXME: is front < back or vica versa? */
+ (mapped_box->row_pitch * box->Top)
+ (box->Left * volume->resource.format->byte_count);
volume->lockedBox.Left = box->Left;
volume->lockedBox.Top = box->Top;
......@@ -234,7 +234,7 @@ HRESULT CDECL wined3d_volume_map(struct wined3d_volume *volume,
volume->locked = TRUE;
TRACE("Returning memory %p, row pitch %d, slice pitch %d.\n",
locked_box->pBits, locked_box->RowPitch, locked_box->SlicePitch);
mapped_box->data, mapped_box->row_pitch, mapped_box->slice_pitch);
return WINED3D_OK;
}
......
......@@ -1708,12 +1708,12 @@ struct wined3d_mapped_rect
void *data;
};
typedef struct _WINED3DLOCKED_BOX
struct wined3d_mapped_box
{
INT RowPitch;
INT SlicePitch;
void *pBits;
} WINED3DLOCKED_BOX;
UINT row_pitch;
UINT slice_pitch;
void *data;
};
typedef struct _WINED3DBOX
{
......@@ -2452,7 +2452,7 @@ DWORD __cdecl wined3d_volume_get_priority(const struct wined3d_volume *volume);
struct wined3d_resource * __cdecl wined3d_volume_get_resource(struct wined3d_volume *volume);
ULONG __cdecl wined3d_volume_incref(struct wined3d_volume *volume);
HRESULT __cdecl wined3d_volume_map(struct wined3d_volume *volume,
WINED3DLOCKED_BOX *locked_box, const WINED3DBOX *box, DWORD flags);
struct wined3d_mapped_box *mapped_box, const WINED3DBOX *box, DWORD flags);
void __cdecl wined3d_volume_preload(struct wined3d_volume *volume);
DWORD __cdecl wined3d_volume_set_priority(struct wined3d_volume *volume, DWORD new_priority);
HRESULT __cdecl wined3d_volume_unmap(struct wined3d_volume *volume);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment