wined3d: Fix some misspellings of "surface".

This commit is contained in:
Henri Verbeet 2010-08-15 23:21:43 +02:00 committed by Alexandre Julliard
parent 5f2fcfdd6b
commit e1188b0c8e
5 changed files with 159 additions and 162 deletions

View File

@ -1040,7 +1040,7 @@ static HRESULT WINAPI IWineD3DDeviceImpl_CreateStateBlock(IWineD3DDevice *iface,
}
static HRESULT WINAPI IWineD3DDeviceImpl_CreateSurface(IWineD3DDevice *iface, UINT Width, UINT Height,
WINED3DFORMAT Format, BOOL Lockable, BOOL Discard, UINT Level, IWineD3DSurface **ppSurface,
WINED3DFORMAT Format, BOOL Lockable, BOOL Discard, UINT Level, IWineD3DSurface **surface,
DWORD Usage, WINED3DPOOL Pool, WINED3DMULTISAMPLE_TYPE MultiSample, DWORD MultisampleQuality,
WINED3DSURFTYPE Impl, IUnknown *parent, const struct wined3d_parent_ops *parent_ops)
{
@ -1051,7 +1051,7 @@ static HRESULT WINAPI IWineD3DDeviceImpl_CreateSurface(IWineD3DDevice *iface, UI
TRACE("iface %p, width %u, height %u, format %s (%#x), lockable %#x, discard %#x, level %u\n",
iface, Width, Height, debug_d3dformat(Format), Format, Lockable, Discard, Level);
TRACE("surface %p, usage %s (%#x), pool %s (%#x), multisample_type %#x, multisample_quality %u\n",
ppSurface, debug_d3dusage(Usage), Usage, debug_d3dpool(Pool), Pool, MultiSample, MultisampleQuality);
surface, debug_d3dusage(Usage), Usage, debug_d3dpool(Pool), Pool, MultiSample, MultisampleQuality);
TRACE("surface_type %#x, parent %p, parent_ops %p.\n", Impl, parent, parent_ops);
if (Impl == SURFACE_OPENGL && !This->adapter)
@ -1078,7 +1078,7 @@ static HRESULT WINAPI IWineD3DDeviceImpl_CreateSurface(IWineD3DDevice *iface, UI
TRACE("(%p) : Created surface %p\n", This, object);
*ppSurface = (IWineD3DSurface *)object;
*surface = (IWineD3DSurface *)object;
return hr;
}
@ -4984,14 +4984,20 @@ static HRESULT WINAPI IWineD3DDeviceImpl_UpdateTexture(IWineD3DDevice *iface,
return WINED3D_OK;
}
static HRESULT WINAPI IWineD3DDeviceImpl_GetFrontBufferData(IWineD3DDevice *iface,UINT iSwapChain, IWineD3DSurface *pDestSurface) {
IWineD3DSwapChain *swapChain;
static HRESULT WINAPI IWineD3DDeviceImpl_GetFrontBufferData(IWineD3DDevice *iface,
UINT swapchain_idx, IWineD3DSurface *dst_surface)
{
IWineD3DSwapChain *swapchain;
HRESULT hr;
hr = IWineD3DDeviceImpl_GetSwapChain(iface, iSwapChain, &swapChain);
if(hr == WINED3D_OK) {
hr = IWineD3DSwapChain_GetFrontBufferData(swapChain, pDestSurface);
IWineD3DSwapChain_Release(swapChain);
}
TRACE("iface %p, swapchain_idx %u, dst_surface %p.\n", iface, swapchain_idx, dst_surface);
hr = IWineD3DDeviceImpl_GetSwapChain(iface, swapchain_idx, &swapchain);
if (FAILED(hr)) return hr;
hr = IWineD3DSwapChain_GetFrontBufferData(swapchain, dst_surface);
IWineD3DSwapChain_Release(swapchain);
return hr;
}
@ -5486,14 +5492,16 @@ static HRESULT WINAPI IWineD3DDeviceImpl_DeletePatch(IWineD3DDevice *iface, UINT
}
static HRESULT WINAPI IWineD3DDeviceImpl_ColorFill(IWineD3DDevice *iface,
IWineD3DSurface *pSurface, const WINED3DRECT *pRect, WINED3DCOLOR color)
IWineD3DSurface *surface, const WINED3DRECT *pRect, WINED3DCOLOR color)
{
IWineD3DSurfaceImpl *surface = (IWineD3DSurfaceImpl *) pSurface;
IWineD3DSurfaceImpl *s = (IWineD3DSurfaceImpl *)surface;
WINEDDBLTFX BltFx;
TRACE("iface %p, surface %p, rect %p, color 0x%08x.\n", iface, pSurface, pRect, color);
TRACE("iface %p, surface %p, rect %s, color 0x%08x.\n",
iface, surface, wine_dbgstr_rect((const RECT *)pRect), color);
if (surface->resource.pool != WINED3DPOOL_DEFAULT && surface->resource.pool != WINED3DPOOL_SYSTEMMEM) {
if (s->resource.pool != WINED3DPOOL_DEFAULT && s->resource.pool != WINED3DPOOL_SYSTEMMEM)
{
FIXME("call to colorfill with non WINED3DPOOL_DEFAULT or WINED3DPOOL_SYSTEMMEM surface\n");
return WINED3DERR_INVALIDCALL;
}
@ -5501,7 +5509,7 @@ static HRESULT WINAPI IWineD3DDeviceImpl_ColorFill(IWineD3DDevice *iface,
if (wined3d_settings.offscreen_rendering_mode == ORM_FBO) {
const float c[4] = {D3DCOLOR_R(color), D3DCOLOR_G(color), D3DCOLOR_B(color), D3DCOLOR_A(color)};
return device_clear_render_targets((IWineD3DDeviceImpl *)iface, 1, &surface,
return device_clear_render_targets((IWineD3DDeviceImpl *)iface, 1, &s,
!!pRect, pRect, WINED3DCLEAR_TARGET, c, 0.0f, 0);
}
else
@ -5509,8 +5517,8 @@ static HRESULT WINAPI IWineD3DDeviceImpl_ColorFill(IWineD3DDevice *iface,
/* Just forward this to the DirectDraw blitting engine */
memset(&BltFx, 0, sizeof(BltFx));
BltFx.dwSize = sizeof(BltFx);
BltFx.u5.dwFillColor = color_convert_argb_to_fmt(color, surface->resource.format_desc->format);
return IWineD3DSurface_Blt(pSurface, (const RECT *)pRect, NULL, NULL,
BltFx.u5.dwFillColor = color_convert_argb_to_fmt(color, s->resource.format_desc->format);
return IWineD3DSurface_Blt(surface, (const RECT *)pRect, NULL, NULL,
WINEDDBLT_COLORFILL, &BltFx, WINED3DTEXF_POINT);
}
}
@ -5810,14 +5818,15 @@ static HRESULT WINAPI IWineD3DDeviceImpl_SetDepthStencilSurface(IWineD3DDevice *
return WINED3D_OK;
}
static HRESULT WINAPI IWineD3DDeviceImpl_SetCursorProperties(IWineD3DDevice* iface, UINT XHotSpot,
UINT YHotSpot, IWineD3DSurface *pCursorBitmap) {
IWineD3DDeviceImpl *This = (IWineD3DDeviceImpl *) iface;
/* TODO: the use of Impl is deprecated. */
IWineD3DSurfaceImpl * pSur = (IWineD3DSurfaceImpl *) pCursorBitmap;
static HRESULT WINAPI IWineD3DDeviceImpl_SetCursorProperties(IWineD3DDevice *iface,
UINT XHotSpot, UINT YHotSpot, IWineD3DSurface *cursor_image)
{
IWineD3DDeviceImpl *This = (IWineD3DDeviceImpl *)iface;
IWineD3DSurfaceImpl *s = (IWineD3DSurfaceImpl *)cursor_image;
WINED3DLOCKED_RECT lockedRect;
TRACE("(%p) : Spot Pos(%u,%u)\n", This, XHotSpot, YHotSpot);
TRACE("iface %p, hotspot_x %u, hotspot_y %u, cursor_image %p.\n",
iface, XHotSpot, YHotSpot, cursor_image);
/* some basic validation checks */
if (This->cursorTexture)
@ -5830,25 +5839,28 @@ static HRESULT WINAPI IWineD3DDeviceImpl_SetCursorProperties(IWineD3DDevice* i
This->cursorTexture = 0;
}
if ( (pSur->currentDesc.Width == 32) && (pSur->currentDesc.Height == 32) )
if ((s->currentDesc.Width == 32) && (s->currentDesc.Height == 32))
This->haveHardwareCursor = TRUE;
else
This->haveHardwareCursor = FALSE;
if(pCursorBitmap) {
if (cursor_image)
{
WINED3DLOCKED_RECT rect;
/* MSDN: Cursor must be A8R8G8B8 */
if (pSur->resource.format_desc->format != WINED3DFMT_B8G8R8A8_UNORM)
if (s->resource.format_desc->format != WINED3DFMT_B8G8R8A8_UNORM)
{
ERR("(%p) : surface(%p) has an invalid format\n", This, pCursorBitmap);
WARN("surface %p has an invalid format.\n", cursor_image);
return WINED3DERR_INVALIDCALL;
}
/* MSDN: Cursor must be smaller than the display mode */
if(pSur->currentDesc.Width > This->ddraw_width ||
pSur->currentDesc.Height > This->ddraw_height) {
ERR("(%p) : Surface(%p) is %dx%d pixels, but screen res is %dx%d\n", This, pSur, pSur->currentDesc.Width, pSur->currentDesc.Height, This->ddraw_width, This->ddraw_height);
if (s->currentDesc.Width > This->ddraw_width
|| s->currentDesc.Height > This->ddraw_height)
{
WARN("Surface %p dimensions are %ux%u, but screen dimensions are %ux%u.\n",
s, s->currentDesc.Width, s->currentDesc.Height, This->ddraw_width, This->ddraw_height);
return WINED3DERR_INVALIDCALL;
}
@ -5861,9 +5873,9 @@ static HRESULT WINAPI IWineD3DDeviceImpl_SetCursorProperties(IWineD3DDevice* i
* creating circular refcount dependencies. Copy out the gl texture
* instead.
*/
This->cursorWidth = pSur->currentDesc.Width;
This->cursorHeight = pSur->currentDesc.Height;
if (SUCCEEDED(IWineD3DSurface_LockRect(pCursorBitmap, &rect, NULL, WINED3DLOCK_READONLY)))
This->cursorWidth = s->currentDesc.Width;
This->cursorHeight = s->currentDesc.Height;
if (SUCCEEDED(IWineD3DSurface_LockRect(cursor_image, &rect, NULL, WINED3DLOCK_READONLY)))
{
const struct wined3d_gl_info *gl_info = &This->adapter->gl_info;
const struct wined3d_format_desc *format_desc = getFormatDescEntry(WINED3DFMT_B8G8R8A8_UNORM, gl_info);
@ -5883,7 +5895,7 @@ static HRESULT WINAPI IWineD3DDeviceImpl_SetCursorProperties(IWineD3DDevice* i
mem = HeapAlloc(GetProcessHeap(), 0, width * height * bpp);
for(i = 0; i < height; i++)
memcpy(&mem[width * bpp * i], &bits[rect.Pitch * i], width * bpp);
IWineD3DSurface_UnlockRect(pCursorBitmap);
IWineD3DSurface_UnlockRect(cursor_image);
context = context_acquire(This, NULL);
@ -5938,22 +5950,17 @@ static HRESULT WINAPI IWineD3DDeviceImpl_SetCursorProperties(IWineD3DDevice* i
* 32-bit cursors. 32x32 bits split into 32-bit chunks == 32
* chunks. */
DWORD *maskBits = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY,
(pSur->currentDesc.Width * pSur->currentDesc.Height / 8));
IWineD3DSurface_LockRect(pCursorBitmap, &lockedRect, NULL,
WINED3DLOCK_NO_DIRTY_UPDATE |
WINED3DLOCK_READONLY
);
TRACE("width: %i height: %i\n", pSur->currentDesc.Width,
pSur->currentDesc.Height);
(s->currentDesc.Width * s->currentDesc.Height / 8));
IWineD3DSurface_LockRect(cursor_image, &lockedRect, NULL,
WINED3DLOCK_NO_DIRTY_UPDATE | WINED3DLOCK_READONLY);
TRACE("width: %u height: %u.\n", s->currentDesc.Width, s->currentDesc.Height);
cursorInfo.fIcon = FALSE;
cursorInfo.xHotspot = XHotSpot;
cursorInfo.yHotspot = YHotSpot;
cursorInfo.hbmMask = CreateBitmap(pSur->currentDesc.Width, pSur->currentDesc.Height,
1, 1, maskBits);
cursorInfo.hbmColor = CreateBitmap(pSur->currentDesc.Width, pSur->currentDesc.Height,
1, 32, lockedRect.pBits);
IWineD3DSurface_UnlockRect(pCursorBitmap);
cursorInfo.hbmMask = CreateBitmap(s->currentDesc.Width, s->currentDesc.Height, 1, 1, maskBits);
cursorInfo.hbmColor = CreateBitmap(s->currentDesc.Width, s->currentDesc.Height, 1, 32, lockedRect.pBits);
IWineD3DSurface_UnlockRect(cursor_image);
/* Create our cursor and clean up. */
cursor = CreateIconIndirect(&cursorInfo);
SetCursor(cursor);

View File

@ -3764,7 +3764,7 @@ static HRESULT IWineD3DSurfaceImpl_BltOverride(IWineD3DSurfaceImpl *dst_surface,
}
static HRESULT IWineD3DSurfaceImpl_BltZ(IWineD3DSurfaceImpl *This, const RECT *DestRect,
IWineD3DSurface *SrcSurface, const RECT *SrcRect, DWORD Flags, const WINEDDBLTFX *DDBltFx)
IWineD3DSurface *src_surface, const RECT *src_rect, DWORD Flags, const WINEDDBLTFX *DDBltFx)
{
IWineD3DDeviceImpl *device = This->resource.device;
float depth;
@ -3798,16 +3798,20 @@ static HRESULT IWineD3DSurfaceImpl_BltZ(IWineD3DSurfaceImpl *This, const RECT *D
return WINED3DERR_INVALIDCALL;
}
static HRESULT WINAPI IWineD3DSurfaceImpl_Blt(IWineD3DSurface *iface, const RECT *DestRect, IWineD3DSurface *SrcSurface,
const RECT *SrcRect, DWORD Flags, const WINEDDBLTFX *DDBltFx, WINED3DTEXTUREFILTERTYPE Filter) {
static HRESULT WINAPI IWineD3DSurfaceImpl_Blt(IWineD3DSurface *iface, const RECT *DestRect,
IWineD3DSurface *src_surface, const RECT *SrcRect, DWORD Flags,
const WINEDDBLTFX *DDBltFx, WINED3DTEXTUREFILTERTYPE Filter)
{
IWineD3DSurfaceImpl *This = (IWineD3DSurfaceImpl *)iface;
IWineD3DSurfaceImpl *Src = (IWineD3DSurfaceImpl *) SrcSurface;
IWineD3DSurfaceImpl *src = (IWineD3DSurfaceImpl *)src_surface;
IWineD3DDeviceImpl *device = This->resource.device;
TRACE("(%p)->(%p,%p,%p,%x,%p)\n", This, DestRect, SrcSurface, SrcRect, Flags, DDBltFx);
TRACE("(%p): Usage is %s\n", This, debug_d3dusage(This->resource.usage));
TRACE("iface %p, dst_rect %s, src_surface %p, src_rect %s, flags %#x, fx %p, filter %s.\n",
iface, wine_dbgstr_rect(DestRect), src_surface, wine_dbgstr_rect(SrcRect),
Flags, DDBltFx, debug_d3dtexturefiltertype(Filter));
TRACE("Usage is %s.\n", debug_d3dusage(This->resource.usage));
if ( (This->Flags & SFLAG_LOCKED) || ((Src != NULL) && (Src->Flags & SFLAG_LOCKED)))
if ((This->Flags & SFLAG_LOCKED) || (src && (src->Flags & SFLAG_LOCKED)))
{
WARN(" Surface is busy, returning DDERR_SURFACEBUSY\n");
return WINEDDERR_SURFACEBUSY;
@ -3816,13 +3820,15 @@ static HRESULT WINAPI IWineD3DSurfaceImpl_Blt(IWineD3DSurface *iface, const RECT
/* Accessing the depth stencil is supposed to fail between a BeginScene and EndScene pair,
* except depth blits, which seem to work
*/
if (This == device->depth_stencil || (Src && Src == device->depth_stencil))
if (This == device->depth_stencil || (src && src == device->depth_stencil))
{
if (device->inScene && !(Flags & WINEDDBLT_DEPTHFILL))
{
TRACE("Attempt to access the depth stencil surface in a BeginScene / EndScene pair, returning WINED3DERR_INVALIDCALL\n");
return WINED3DERR_INVALIDCALL;
} else if(IWineD3DSurfaceImpl_BltZ(This, DestRect, SrcSurface, SrcRect, Flags, DDBltFx) == WINED3D_OK) {
}
else if (SUCCEEDED(IWineD3DSurfaceImpl_BltZ(This, DestRect, src_surface, SrcRect, Flags, DDBltFx)))
{
TRACE("Z Blit override handled the blit\n");
return WINED3D_OK;
}
@ -3830,48 +3836,49 @@ static HRESULT WINAPI IWineD3DSurfaceImpl_Blt(IWineD3DSurface *iface, const RECT
/* Special cases for RenderTargets */
if ((This->resource.usage & WINED3DUSAGE_RENDERTARGET)
|| (Src && (Src->resource.usage & WINED3DUSAGE_RENDERTARGET)))
|| (src && (src->resource.usage & WINED3DUSAGE_RENDERTARGET)))
{
if (SUCCEEDED(IWineD3DSurfaceImpl_BltOverride(This, DestRect, Src, SrcRect, Flags, DDBltFx, Filter)))
if (SUCCEEDED(IWineD3DSurfaceImpl_BltOverride(This, DestRect, src, SrcRect, Flags, DDBltFx, Filter)))
return WINED3D_OK;
}
/* For the rest call the X11 surface implementation.
* For RenderTargets this should be implemented OpenGL accelerated in BltOverride,
* other Blts are rather rare
*/
return IWineD3DBaseSurfaceImpl_Blt(iface, DestRect, SrcSurface, SrcRect, Flags, DDBltFx, Filter);
* other Blts are rather rare. */
return IWineD3DBaseSurfaceImpl_Blt(iface, DestRect, src_surface, SrcRect, Flags, DDBltFx, Filter);
}
static HRESULT WINAPI IWineD3DSurfaceImpl_BltFast(IWineD3DSurface *iface, DWORD dstx, DWORD dsty,
IWineD3DSurface *Source, const RECT *rsrc, DWORD trans)
IWineD3DSurface *src_surface, const RECT *rsrc, DWORD trans)
{
IWineD3DSurfaceImpl *This = (IWineD3DSurfaceImpl *) iface;
IWineD3DSurfaceImpl *srcImpl = (IWineD3DSurfaceImpl *) Source;
IWineD3DSurfaceImpl *This = (IWineD3DSurfaceImpl *)iface;
IWineD3DSurfaceImpl *src = (IWineD3DSurfaceImpl *)src_surface;
IWineD3DDeviceImpl *device = This->resource.device;
TRACE("(%p)->(%d, %d, %p, %p, %08x\n", iface, dstx, dsty, Source, rsrc, trans);
TRACE("iface %p, dst_x %u, dst_y %u, src_surface %p, src_rect %s, flags %#x.\n",
iface, dstx, dsty, src_surface, wine_dbgstr_rect(rsrc), trans);
if ( (This->Flags & SFLAG_LOCKED) || (srcImpl->Flags & SFLAG_LOCKED))
if ((This->Flags & SFLAG_LOCKED) || (src->Flags & SFLAG_LOCKED))
{
WARN(" Surface is busy, returning DDERR_SURFACEBUSY\n");
return WINEDDERR_SURFACEBUSY;
}
if (device->inScene && (This == device->depth_stencil || srcImpl == device->depth_stencil))
if (device->inScene && (This == device->depth_stencil || src == device->depth_stencil))
{
TRACE("Attempt to access the depth stencil surface in a BeginScene / EndScene pair, returning WINED3DERR_INVALIDCALL\n");
return WINED3DERR_INVALIDCALL;
}
/* Special cases for RenderTargets */
if( (This->resource.usage & WINED3DUSAGE_RENDERTARGET) ||
(srcImpl->resource.usage & WINED3DUSAGE_RENDERTARGET) ) {
if ((This->resource.usage & WINED3DUSAGE_RENDERTARGET)
|| (src->resource.usage & WINED3DUSAGE_RENDERTARGET))
{
RECT SrcRect, DstRect;
DWORD Flags=0;
surface_get_rect(srcImpl, rsrc, &SrcRect);
surface_get_rect(src, rsrc, &SrcRect);
DstRect.left = dstx;
DstRect.top=dsty;
@ -3889,12 +3896,11 @@ static HRESULT WINAPI IWineD3DSurfaceImpl_BltFast(IWineD3DSurface *iface, DWORD
Flags |= WINEDDBLT_DONOTWAIT;
if (SUCCEEDED(IWineD3DSurfaceImpl_BltOverride(This,
&DstRect, srcImpl, &SrcRect, Flags, NULL, WINED3DTEXF_POINT)))
&DstRect, src, &SrcRect, Flags, NULL, WINED3DTEXF_POINT)))
return WINED3D_OK;
}
return IWineD3DBaseSurfaceImpl_BltFast(iface, dstx, dsty, Source, rsrc, trans);
return IWineD3DBaseSurfaceImpl_BltFast(iface, dstx, dsty, src_surface, rsrc, trans);
}
static HRESULT WINAPI IWineD3DSurfaceImpl_RealizePalette(IWineD3DSurface *iface)

View File

@ -944,14 +944,14 @@ static HRESULT
*
* Params:
* DestRect: Destination rectangle to write to
* SrcSurface: Source surface, can be NULL
* src_surface: Source surface, can be NULL
* SrcRect: Source rectangle
*****************************************************************************/
HRESULT WINAPI IWineD3DBaseSurfaceImpl_Blt(IWineD3DSurface *iface, const RECT *DestRect, IWineD3DSurface *SrcSurface,
HRESULT WINAPI IWineD3DBaseSurfaceImpl_Blt(IWineD3DSurface *iface, const RECT *DestRect, IWineD3DSurface *src_surface,
const RECT *SrcRect, DWORD Flags, const WINEDDBLTFX *DDBltFx, WINED3DTEXTUREFILTERTYPE Filter)
{
IWineD3DSurfaceImpl *This = (IWineD3DSurfaceImpl *) iface;
IWineD3DSurfaceImpl *Src = (IWineD3DSurfaceImpl *) SrcSurface;
IWineD3DSurfaceImpl *This = (IWineD3DSurfaceImpl *)iface;
IWineD3DSurfaceImpl *src = (IWineD3DSurfaceImpl *)src_surface;
RECT xdst,xsrc;
HRESULT ret = WINED3D_OK;
WINED3DLOCKED_RECT dlock, slock;
@ -960,17 +960,12 @@ HRESULT WINAPI IWineD3DBaseSurfaceImpl_Blt(IWineD3DSurface *iface, const RECT *D
int x, y;
const BYTE *sbuf;
BYTE *dbuf;
TRACE("(%p)->(%p,%p,%p,%x,%p)\n", This, DestRect, Src, SrcRect, Flags, DDBltFx);
if (TRACE_ON(d3d_surface))
{
if (DestRect) TRACE("\tdestrect :%dx%d-%dx%d\n",
DestRect->left, DestRect->top, DestRect->right, DestRect->bottom);
if (SrcRect) TRACE("\tsrcrect :%dx%d-%dx%d\n",
SrcRect->left, SrcRect->top, SrcRect->right, SrcRect->bottom);
}
TRACE("iface %p, dst_rect %s, src_surface %p, src_rect %s, flags %#x, fx %p, filter %s.\n",
iface, wine_dbgstr_rect(DestRect), src_surface, wine_dbgstr_rect(SrcRect),
Flags, DDBltFx, debug_d3dtexturefiltertype(Filter));
if ( (This->Flags & SFLAG_LOCKED) || ((Src != NULL) && (Src->Flags & SFLAG_LOCKED)))
if ((This->Flags & SFLAG_LOCKED) || (src && (src->Flags & SFLAG_LOCKED)))
{
WARN(" Surface is busy, returning DDERR_SURFACEBUSY\n");
return WINEDDERR_SURFACEBUSY;
@ -986,21 +981,21 @@ HRESULT WINAPI IWineD3DBaseSurfaceImpl_Blt(IWineD3DSurface *iface, const RECT *D
if (SrcRect)
{
if (Src)
if (src)
{
if (SrcRect->right < SrcRect->left || SrcRect->bottom < SrcRect->top
|| SrcRect->left > Src->currentDesc.Width || SrcRect->left < 0
|| SrcRect->top > Src->currentDesc.Height || SrcRect->top < 0
|| SrcRect->right > Src->currentDesc.Width || SrcRect->right < 0
|| SrcRect->bottom > Src->currentDesc.Height || SrcRect->bottom < 0)
|| SrcRect->left > src->currentDesc.Width || SrcRect->left < 0
|| SrcRect->top > src->currentDesc.Height || SrcRect->top < 0
|| SrcRect->right > src->currentDesc.Width || SrcRect->right < 0
|| SrcRect->bottom > src->currentDesc.Height || SrcRect->bottom < 0)
{
WARN("Application gave us bad source rectangle for Blt.\n");
return WINEDDERR_INVALIDRECT;
}
if (!SrcRect->right || !SrcRect->bottom
|| SrcRect->left == (int)Src->currentDesc.Width
|| SrcRect->top == (int)Src->currentDesc.Height)
|| SrcRect->left == (int)src->currentDesc.Width
|| SrcRect->top == (int)src->currentDesc.Height)
{
TRACE("Nothing to be done.\n");
return WINED3D_OK;
@ -1009,12 +1004,12 @@ HRESULT WINAPI IWineD3DBaseSurfaceImpl_Blt(IWineD3DSurface *iface, const RECT *D
xsrc = *SrcRect;
}
else if (Src)
else if (src)
{
xsrc.left = 0;
xsrc.top = 0;
xsrc.right = Src->currentDesc.Width;
xsrc.bottom = Src->currentDesc.Height;
xsrc.right = src->currentDesc.Width;
xsrc.bottom = src->currentDesc.Height;
}
else
{
@ -1043,7 +1038,7 @@ HRESULT WINAPI IWineD3DBaseSurfaceImpl_Blt(IWineD3DSurface *iface, const RECT *D
return WINED3D_OK;
}
if (!Src)
if (!src)
{
RECT full_rect;
@ -1105,8 +1100,8 @@ HRESULT WINAPI IWineD3DBaseSurfaceImpl_Blt(IWineD3DSurface *iface, const RECT *D
|| (xdst.left >= (int)This->currentDesc.Width)
|| (xdst.top >= (int)This->currentDesc.Height)
|| (xsrc.right <= 0) || (xsrc.bottom <= 0)
|| (xsrc.left >= (int) Src->currentDesc.Width)
|| (xsrc.top >= (int)Src->currentDesc.Height))
|| (xsrc.left >= (int)src->currentDesc.Width)
|| (xsrc.top >= (int)src->currentDesc.Height))
{
TRACE("Nothing to be done after clipping.\n");
return WINED3D_OK;
@ -1122,7 +1117,7 @@ HRESULT WINAPI IWineD3DBaseSurfaceImpl_Blt(IWineD3DSurface *iface, const RECT *D
xdst.bottom = This->currentDesc.Height;
}
if (Src == This)
if (src == This)
{
IWineD3DSurface_LockRect(iface, &dlock, NULL, 0);
slock = dlock;
@ -1132,19 +1127,20 @@ HRESULT WINAPI IWineD3DBaseSurfaceImpl_Blt(IWineD3DSurface *iface, const RECT *D
else
{
dEntry = This->resource.format_desc;
if (Src)
if (src)
{
if (This->resource.format_desc->format != Src->resource.format_desc->format)
if (This->resource.format_desc->format != src->resource.format_desc->format)
{
Src = surface_convert_format(Src, dEntry->format);
if(!Src) {
src = surface_convert_format(src, dEntry->format);
if (!src)
{
/* The conv function writes a FIXME */
WARN("Cannot convert source surface format to dest format\n");
goto release;
}
}
IWineD3DSurface_LockRect((IWineD3DSurface *) Src, &slock, NULL, WINED3DLOCK_READONLY);
sEntry = Src->resource.format_desc;
IWineD3DSurface_LockRect((IWineD3DSurface *)src, &slock, NULL, WINED3DLOCK_READONLY);
sEntry = src->resource.format_desc;
}
else
{
@ -1160,7 +1156,7 @@ HRESULT WINAPI IWineD3DBaseSurfaceImpl_Blt(IWineD3DSurface *iface, const RECT *D
if (sEntry->Flags & dEntry->Flags & WINED3DFMT_FLAG_FOURCC)
{
if (!DestRect || Src == This)
if (!DestRect || src == This)
{
memcpy(dlock.pBits, slock.pBits, This->resource.size);
goto release;
@ -1174,7 +1170,7 @@ HRESULT WINAPI IWineD3DBaseSurfaceImpl_Blt(IWineD3DSurface *iface, const RECT *D
dstwidth = xdst.right - xdst.left;
width = (xdst.right - xdst.left) * bpp;
if (DestRect && Src != This)
if (DestRect && src != This)
dbuf = dlock.pBits;
else
dbuf = (BYTE*)dlock.pBits+(xdst.top*dlock.Pitch)+(xdst.left*bpp);
@ -1239,7 +1235,7 @@ HRESULT WINAPI IWineD3DBaseSurfaceImpl_Blt(IWineD3DSurface *iface, const RECT *D
FIXME("\tDdraw Raster Ops: %08x Pattern: %p\n", DDBltFx->dwDDROP, DDBltFx->u5.lpDDSPattern);
}
/* Now the 'with source' blits */
if (Src)
if (src)
{
const BYTE *sbase;
int sx, xinc, sy, yinc;
@ -1262,7 +1258,7 @@ HRESULT WINAPI IWineD3DBaseSurfaceImpl_Blt(IWineD3DSurface *iface, const RECT *D
sbuf = sbase;
/* check for overlapping surfaces */
if (Src != This || xdst.top < xsrc.top ||
if (src != This || xdst.top < xsrc.top ||
xdst.right <= xsrc.left || xsrc.right <= xdst.left)
{
/* no overlap, or dst above src, so copy from top downwards */
@ -1370,8 +1366,8 @@ HRESULT WINAPI IWineD3DBaseSurfaceImpl_Blt(IWineD3DSurface *iface, const RECT *D
/* The color keying flags are checked for correctness in ddraw */
if (Flags & WINEDDBLT_KEYSRC)
{
keylow = Src->SrcBltCKey.dwColorSpaceLowValue;
keyhigh = Src->SrcBltCKey.dwColorSpaceHighValue;
keylow = src->SrcBltCKey.dwColorSpaceLowValue;
keyhigh = src->SrcBltCKey.dwColorSpaceHighValue;
}
else if (Flags & WINEDDBLT_KEYSRCOVERRIDE)
{
@ -1382,8 +1378,8 @@ HRESULT WINAPI IWineD3DBaseSurfaceImpl_Blt(IWineD3DSurface *iface, const RECT *D
if (Flags & WINEDDBLT_KEYDEST)
{
/* Destination color keys are taken from the source surface ! */
destkeylow = Src->DestBltCKey.dwColorSpaceLowValue;
destkeyhigh = Src->DestBltCKey.dwColorSpaceHighValue;
destkeylow = src->DestBltCKey.dwColorSpaceLowValue;
destkeyhigh = src->DestBltCKey.dwColorSpaceHighValue;
}
else if (Flags & WINEDDBLT_KEYDESTOVERRIDE)
{
@ -1554,9 +1550,9 @@ error:
release:
IWineD3DSurface_UnlockRect(iface);
if (Src && Src != This) IWineD3DSurface_UnlockRect((IWineD3DSurface *) Src);
if (src && src != This) IWineD3DSurface_UnlockRect((IWineD3DSurface *)src);
/* Release the converted surface if any */
if (Src && SrcSurface != (IWineD3DSurface *) Src) IWineD3DSurface_Release((IWineD3DSurface *) Src);
if (src && src_surface != (IWineD3DSurface *)src) IWineD3DSurface_Release((IWineD3DSurface *)src);
return ret;
}
@ -1570,7 +1566,7 @@ release:
* Params:
* dstx:
* dsty:
* Source: Source surface to copy from
* src_surface: Source surface to copy from
* rsrc: Source rectangle
* trans: Some Flags
*
@ -1579,10 +1575,10 @@ release:
*
*****************************************************************************/
HRESULT WINAPI IWineD3DBaseSurfaceImpl_BltFast(IWineD3DSurface *iface, DWORD dstx, DWORD dsty,
IWineD3DSurface *Source, const RECT *rsrc, DWORD trans)
IWineD3DSurface *src_surface, const RECT *rsrc, DWORD trans)
{
IWineD3DSurfaceImpl *This = (IWineD3DSurfaceImpl *) iface;
IWineD3DSurfaceImpl *Src = (IWineD3DSurfaceImpl *) Source;
IWineD3DSurfaceImpl *This = (IWineD3DSurfaceImpl *)iface;
IWineD3DSurfaceImpl *src = (IWineD3DSurfaceImpl *)src_surface;
int bpp, w, h, x, y;
WINED3DLOCKED_RECT dlock,slock;
@ -1593,23 +1589,10 @@ HRESULT WINAPI IWineD3DBaseSurfaceImpl_BltFast(IWineD3DSurface *iface, DWORD dst
BYTE *dbuf;
const struct wined3d_format_desc *sEntry, *dEntry;
if (TRACE_ON(d3d_surface))
{
TRACE("(%p)->(%d,%d,%p,%p,%08x)\n", This,dstx,dsty,Src,rsrc,trans);
TRACE("iface %p, dst_x %u, dst_y %u, src_surface %p, src_rect %s, flags %#x.\n",
iface, dstx, dsty, src_surface, wine_dbgstr_rect(rsrc), trans);
if (rsrc)
{
TRACE("\tsrcrect: %dx%d-%dx%d\n",rsrc->left,rsrc->top,
rsrc->right,rsrc->bottom);
}
else
{
TRACE(" srcrect: NULL\n");
}
}
if ((This->Flags & SFLAG_LOCKED) ||
(Src->Flags & SFLAG_LOCKED))
if ((This->Flags & SFLAG_LOCKED) || (src->Flags & SFLAG_LOCKED))
{
WARN(" Surface is busy, returning DDERR_SURFACEBUSY\n");
return WINEDDERR_SURFACEBUSY;
@ -1620,17 +1603,17 @@ HRESULT WINAPI IWineD3DBaseSurfaceImpl_BltFast(IWineD3DSurface *iface, DWORD dst
WARN("rsrc is NULL!\n");
rsrc2.left = 0;
rsrc2.top = 0;
rsrc2.right = Src->currentDesc.Width;
rsrc2.bottom = Src->currentDesc.Height;
rsrc2.right = src->currentDesc.Width;
rsrc2.bottom = src->currentDesc.Height;
rsrc = &rsrc2;
}
/* Check source rect for validity. Copied from normal Blt. Fixes Baldur's Gate.*/
if ((rsrc->bottom > Src->currentDesc.Height) || (rsrc->bottom < 0) ||
(rsrc->top > Src->currentDesc.Height) || (rsrc->top < 0) ||
(rsrc->left > Src->currentDesc.Width) || (rsrc->left < 0) ||
(rsrc->right > Src->currentDesc.Width) || (rsrc->right < 0) ||
(rsrc->right < rsrc->left) || (rsrc->bottom < rsrc->top))
if ((rsrc->bottom > src->currentDesc.Height) || (rsrc->bottom < 0)
|| (rsrc->top > src->currentDesc.Height) || (rsrc->top < 0)
|| (rsrc->left > src->currentDesc.Width) || (rsrc->left < 0)
|| (rsrc->right > src->currentDesc.Width) || (rsrc->right < 0)
|| (rsrc->right < rsrc->left) || (rsrc->bottom < rsrc->top))
{
WARN("Application gave us bad source rectangle for BltFast.\n");
return WINEDDERR_INVALIDRECT;
@ -1638,12 +1621,12 @@ HRESULT WINAPI IWineD3DBaseSurfaceImpl_BltFast(IWineD3DSurface *iface, DWORD dst
h = rsrc->bottom - rsrc->top;
if (h > This->currentDesc.Height-dsty) h = This->currentDesc.Height-dsty;
if (h > Src->currentDesc.Height-rsrc->top) h=Src->currentDesc.Height-rsrc->top;
if (h > src->currentDesc.Height-rsrc->top) h = src->currentDesc.Height-rsrc->top;
if (h <= 0) return WINEDDERR_INVALIDRECT;
w = rsrc->right - rsrc->left;
if (w > This->currentDesc.Width-dstx) w = This->currentDesc.Width-dstx;
if (w > Src->currentDesc.Width-rsrc->left) w = Src->currentDesc.Width-rsrc->left;
if (w > src->currentDesc.Width-rsrc->left) w = src->currentDesc.Width-rsrc->left;
if (w <= 0) return WINEDDERR_INVALIDRECT;
/* Now compute the locking rectangle... */
@ -1660,7 +1643,7 @@ HRESULT WINAPI IWineD3DBaseSurfaceImpl_BltFast(IWineD3DSurface *iface, DWORD dst
bpp = This->resource.format_desc->byte_count;
/* We need to lock the surfaces, or we won't get refreshes when done. */
if (Src == This)
if (src == This)
{
int pitch;
@ -1676,12 +1659,12 @@ HRESULT WINAPI IWineD3DBaseSurfaceImpl_BltFast(IWineD3DSurface *iface, DWORD dst
/* Since slock was originally copied from this surface's description, we can just reuse it */
sbuf = This->resource.allocatedMemory + lock_src.top * pitch + lock_src.left * bpp;
dbuf = This->resource.allocatedMemory + lock_dst.top * pitch + lock_dst.left * bpp;
sEntry = Src->resource.format_desc;
sEntry = src->resource.format_desc;
dEntry = sEntry;
}
else
{
ret = IWineD3DSurface_LockRect(Source, &slock, &lock_src, WINED3DLOCK_READONLY);
ret = IWineD3DSurface_LockRect(src_surface, &slock, &lock_src, WINED3DLOCK_READONLY);
if(ret != WINED3D_OK) goto error;
ret = IWineD3DSurface_LockRect(iface, &dlock, &lock_dst, 0);
if(ret != WINED3D_OK) goto error;
@ -1690,7 +1673,7 @@ HRESULT WINAPI IWineD3DBaseSurfaceImpl_BltFast(IWineD3DSurface *iface, DWORD dst
dbuf = dlock.pBits;
TRACE("Dst is at %p, Src is at %p\n", dbuf, sbuf);
sEntry = Src->resource.format_desc;
sEntry = src->resource.format_desc;
dEntry = This->resource.format_desc;
}
@ -1704,7 +1687,7 @@ HRESULT WINAPI IWineD3DBaseSurfaceImpl_BltFast(IWineD3DSurface *iface, DWORD dst
FIXME("trans arg not supported when a compressed surface is involved\n");
if (dstx || dsty)
FIXME("offset for destination surface is not supported\n");
if (Src->resource.format_desc->format != This->resource.format_desc->format)
if (src->resource.format_desc->format != This->resource.format_desc->format)
{
FIXME("compressed -> compressed copy only supported for the same type of surface\n");
ret = WINED3DERR_WRONGTEXTUREFORMAT;
@ -1733,9 +1716,9 @@ HRESULT WINAPI IWineD3DBaseSurfaceImpl_BltFast(IWineD3DSurface *iface, DWORD dst
if (trans & (WINEDDBLTFAST_SRCCOLORKEY | WINEDDBLTFAST_DESTCOLORKEY))
{
DWORD keylow, keyhigh;
DWORD mask = Src->resource.format_desc->red_mask |
Src->resource.format_desc->green_mask |
Src->resource.format_desc->blue_mask;
DWORD mask = src->resource.format_desc->red_mask
| src->resource.format_desc->green_mask
| src->resource.format_desc->blue_mask;
/* For some 8-bit formats like L8 and P8 color masks don't make sense */
if(!mask && bpp==1)
@ -1744,8 +1727,8 @@ HRESULT WINAPI IWineD3DBaseSurfaceImpl_BltFast(IWineD3DSurface *iface, DWORD dst
TRACE("Color keyed copy\n");
if (trans & WINEDDBLTFAST_SRCCOLORKEY)
{
keylow = Src->SrcBltCKey.dwColorSpaceLowValue;
keyhigh = Src->SrcBltCKey.dwColorSpaceHighValue;
keylow = src->SrcBltCKey.dwColorSpaceLowValue;
keyhigh = src->SrcBltCKey.dwColorSpaceHighValue;
}
else
{
@ -1836,14 +1819,14 @@ HRESULT WINAPI IWineD3DBaseSurfaceImpl_BltFast(IWineD3DSurface *iface, DWORD dst
}
error:
if (Src == This)
if (src == This)
{
IWineD3DSurface_UnlockRect(iface);
}
else
{
IWineD3DSurface_UnlockRect(iface);
IWineD3DSurface_UnlockRect(Source);
IWineD3DSurface_UnlockRect(src_surface);
}
return ret;

View File

@ -72,11 +72,12 @@ HRESULT WINAPI IWineD3DBaseSwapChainImpl_GetParent(IWineD3DSwapChain *iface, IUn
return WINED3D_OK;
}
HRESULT WINAPI IWineD3DBaseSwapChainImpl_GetFrontBufferData(IWineD3DSwapChain *iface, IWineD3DSurface *pDestSurface) {
HRESULT WINAPI IWineD3DBaseSwapChainImpl_GetFrontBufferData(IWineD3DSwapChain *iface, IWineD3DSurface *dst_surface)
{
IWineD3DSwapChainImpl *This = (IWineD3DSwapChainImpl *)iface;
POINT start;
TRACE("(%p) : iface(%p) pDestSurface(%p)\n", This, iface, pDestSurface);
TRACE("iface %p, dst_surface %p.\n", iface, dst_surface);
start.x = 0;
start.y = 0;
@ -85,7 +86,7 @@ HRESULT WINAPI IWineD3DBaseSwapChainImpl_GetFrontBufferData(IWineD3DSwapChain *i
MapWindowPoints(This->win_handle, NULL, &start, 1);
}
IWineD3DSurface_BltFast(pDestSurface, start.x, start.y, (IWineD3DSurface *)This->front_buffer, NULL, 0);
IWineD3DSurface_BltFast(dst_surface, start.x, start.y, (IWineD3DSurface *)This->front_buffer, NULL, 0);
return WINED3D_OK;
}

View File

@ -2128,8 +2128,8 @@ HRESULT WINAPI IWineD3DBaseSurfaceImpl_SetClipper(IWineD3DSurface *iface, IWineD
HRESULT WINAPI IWineD3DBaseSurfaceImpl_GetClipper(IWineD3DSurface *iface, IWineD3DClipper **clipper) DECLSPEC_HIDDEN;
HRESULT WINAPI IWineD3DBaseSurfaceImpl_SetFormat(IWineD3DSurface *iface, WINED3DFORMAT format) DECLSPEC_HIDDEN;
HRESULT IWineD3DBaseSurfaceImpl_CreateDIBSection(IWineD3DSurface *iface) DECLSPEC_HIDDEN;
HRESULT WINAPI IWineD3DBaseSurfaceImpl_Blt(IWineD3DSurface *iface, const RECT *DestRect, IWineD3DSurface *SrcSurface,
const RECT *SrcRect, DWORD Flags, const WINEDDBLTFX *DDBltFx, WINED3DTEXTUREFILTERTYPE Filter) DECLSPEC_HIDDEN;
HRESULT WINAPI IWineD3DBaseSurfaceImpl_Blt(IWineD3DSurface *iface, const RECT *dst_rect, IWineD3DSurface *src_surface,
const RECT *src_rect, DWORD flags, const WINEDDBLTFX *fx, WINED3DTEXTUREFILTERTYPE filter) DECLSPEC_HIDDEN;
HRESULT WINAPI IWineD3DBaseSurfaceImpl_BltFast(IWineD3DSurface *iface, DWORD dstx, DWORD dsty,
IWineD3DSurface *Source, const RECT *rsrc, DWORD trans) DECLSPEC_HIDDEN;
HRESULT WINAPI IWineD3DBaseSurfaceImpl_LockRect(IWineD3DSurface *iface, WINED3DLOCKED_RECT *pLockedRect,
@ -2552,7 +2552,7 @@ ULONG WINAPI IWineD3DBaseSwapChainImpl_AddRef(IWineD3DSwapChain *iface) DECLSPEC
ULONG WINAPI IWineD3DBaseSwapChainImpl_Release(IWineD3DSwapChain *iface) DECLSPEC_HIDDEN;
HRESULT WINAPI IWineD3DBaseSwapChainImpl_GetParent(IWineD3DSwapChain *iface, IUnknown **ppParent) DECLSPEC_HIDDEN;
HRESULT WINAPI IWineD3DBaseSwapChainImpl_GetFrontBufferData(IWineD3DSwapChain *iface,
IWineD3DSurface *pDestSurface) DECLSPEC_HIDDEN;
IWineD3DSurface *dst_surface) DECLSPEC_HIDDEN;
HRESULT WINAPI IWineD3DBaseSwapChainImpl_GetBackBuffer(IWineD3DSwapChain *iface, UINT iBackBuffer,
WINED3DBACKBUFFER_TYPE Type, IWineD3DSurface **ppBackBuffer) DECLSPEC_HIDDEN;
HRESULT WINAPI IWineD3DBaseSwapChainImpl_GetRasterStatus(IWineD3DSwapChain *iface,