From: Zebediah Figura zfigura@codeweavers.com
--- dlls/ddraw/surface.c | 216 +++++++++++++++++++++---------------------- 1 file changed, 108 insertions(+), 108 deletions(-)
diff --git a/dlls/ddraw/surface.c b/dlls/ddraw/surface.c index a096c5d7d8e..18f4ad0d455 100644 --- a/dlls/ddraw/surface.c +++ b/dlls/ddraw/surface.c @@ -1373,114 +1373,114 @@ static void ddraw_texture_rename_to(struct ddraw_texture *dst_texture, struct wi static HRESULT WINAPI DECLSPEC_HOTPATCH ddraw_surface1_Flip(IDirectDrawSurface *iface, IDirectDrawSurface *src, DWORD flags) { - struct ddraw_surface *dst_impl = impl_from_IDirectDrawSurface(iface); - struct ddraw_surface *src_impl = unsafe_impl_from_IDirectDrawSurface(src); - struct ddraw_texture *dst_ddraw_texture, *src_ddraw_texture; - struct wined3d_rendertarget_view *tmp_rtv, *current_rtv; - struct wined3d_texture *texture, *draw_texture; - DDSCAPS caps = {DDSCAPS_FLIP}; - IDirectDrawSurface *current; - void *texture_memory; - HRESULT hr; - - TRACE("iface %p, src %p, flags %#lx.\n", iface, src, flags); - - if (src == iface || !(dst_impl->surface_desc.ddsCaps.dwCaps & (DDSCAPS_FRONTBUFFER | DDSCAPS_OVERLAY))) - return DDERR_NOTFLIPPABLE; - - if (ddraw_surface_is_lost(dst_impl)) - return DDERR_SURFACELOST; - - wined3d_mutex_lock(); - - if ((dst_impl->surface_desc.ddsCaps.dwCaps & DDSCAPS_PRIMARYSURFACE) - && !(dst_impl->ddraw->cooperative_level & DDSCL_EXCLUSIVE)) - { - WARN("Not in exclusive mode.\n"); - wined3d_mutex_unlock(); - return DDERR_NOEXCLUSIVEMODE; - } - - tmp_rtv = ddraw_surface_get_rendertarget_view(dst_impl); - texture = dst_impl->wined3d_texture; - dst_ddraw_texture = wined3d_texture_get_parent(dst_impl->wined3d_texture); - texture_memory = dst_ddraw_texture->texture_memory; - draw_texture = dst_impl->draw_texture; - current_rtv = wined3d_device_context_get_rendertarget_view(dst_impl->ddraw->immediate_context, 0); - - if (src_impl) - { - for (current = iface; current != src;) - { - if (FAILED(hr = ddraw_surface1_GetAttachedSurface(current, &caps, ¤t))) - { - WARN("Surface %p is not on the same flip chain as surface %p.\n", src, iface); - wined3d_mutex_unlock(); - return DDERR_NOTFLIPPABLE; - } - ddraw_surface1_Release(current); - if (current == iface) - { - WARN("Surface %p is not on the same flip chain as surface %p.\n", src, iface); - wined3d_mutex_unlock(); - return DDERR_NOTFLIPPABLE; - } - } - - src_ddraw_texture = wined3d_texture_get_parent(src_impl->wined3d_texture); - - ddraw_texture_rename_to(dst_ddraw_texture, src_impl->wined3d_texture, src_impl->draw_texture, - ddraw_surface_get_rendertarget_view(src_impl), src_ddraw_texture->texture_memory, current_rtv); - - dst_ddraw_texture = src_ddraw_texture; - } - else - { - for (current = iface;;) - { - if (FAILED(hr = ddraw_surface1_GetAttachedSurface(current, &caps, ¤t))) - { - ERR("Can't find a flip target\n"); - wined3d_mutex_unlock(); - return DDERR_NOTFLIPPABLE; /* Unchecked */ - } - ddraw_surface1_Release(current); - if (current == iface) - { - dst_impl = impl_from_IDirectDrawSurface(iface); - break; - } - - src_impl = impl_from_IDirectDrawSurface(current); - src_ddraw_texture = wined3d_texture_get_parent(src_impl->wined3d_texture); - - ddraw_texture_rename_to(dst_ddraw_texture, src_impl->wined3d_texture, src_impl->draw_texture, - ddraw_surface_get_rendertarget_view(src_impl), src_ddraw_texture->texture_memory, current_rtv); - - dst_ddraw_texture = src_ddraw_texture; - dst_impl = src_impl; - } - } - - ddraw_texture_rename_to(dst_ddraw_texture, texture, draw_texture, tmp_rtv, texture_memory, current_rtv); - - if (flags & ~(DDFLIP_NOVSYNC | DDFLIP_INTERVAL2 | DDFLIP_INTERVAL3 | DDFLIP_INTERVAL4)) - { - static UINT once; - if (!once++) - FIXME("Ignoring flags %#lx.\n", flags); - else - WARN("Ignoring flags %#lx.\n", flags); - } - - if (dst_impl->surface_desc.ddsCaps.dwCaps & DDSCAPS_PRIMARYSURFACE) - hr = ddraw_surface_update_frontbuffer(dst_impl, NULL, FALSE, ddraw_swap_interval_from_flags(flags)); - else - hr = DD_OK; - - wined3d_mutex_unlock(); - - return hr; + ;ɹɥ uɹnʇǝɹ + + ;()ʞɔolun‾xǝʇnɯ‾pƐpǝuᴉʍ + + ;ꞰO‾ꓷꓷ = ɹɥ + ǝslǝ + ;((sᵷɐlɟ)sᵷɐlɟ‾ɯoɹɟ‾lɐʌɹǝʇuᴉ‾dɐʍs‾ʍɐɹpp 'ƎSꓶⱯꓞ 'ꓶꓶՈN 'ldɯᴉ‾ʇsp)ɹǝɟɟnqʇuoɹɟ‾ǝʇɐpdn‾ǝɔɐɟɹns‾ʍɐɹpp = ɹɥ + (ƎƆⱯꓞꓤՈS⅄ꓤⱯWIꓤꓒ‾SꓒⱯƆSꓷꓷ & sdɐƆʍp˙sdɐƆspp˙ɔsǝp‾ǝɔɐɟɹns<-ldɯᴉ‾ʇsp) ɟᴉ + + { + ;(sᵷɐlɟ '"u\˙xl#% sᵷɐlɟ ᵷuᴉɹouᵷI")NꓤⱯM + ǝslǝ + ;(sᵷɐlɟ '"u\˙xl#% sᵷɐlɟ ᵷuᴉɹouᵷI")ƎWXIꓞ + (++ǝɔuo¡) ɟᴉ + ;ǝɔuo ꓕNIՈ ɔᴉʇɐʇs + } + ((4ꓶⱯɅꓤƎꓕNI‾ꓒIꓶꓞꓷꓷ | ƐꓶⱯɅꓤƎꓕNI‾ꓒIꓶꓞꓷꓷ | 2ꓶⱯɅꓤƎꓕNI‾ꓒIꓶꓞꓷꓷ | ƆN⅄SɅON‾ꓒIꓶꓞꓷꓷ)~ & sᵷɐlɟ) ɟᴉ + + ;(ʌʇɹ‾ʇuǝɹɹnɔ 'ʎɹoɯǝɯ‾ǝɹnʇxǝʇ 'ʌʇɹ‾dɯʇ 'ǝɹnʇxǝʇ‾ʍɐɹp 'ǝɹnʇxǝʇ 'ǝɹnʇxǝʇ‾ʍɐɹpp‾ʇsp)oʇ‾ǝɯɐuǝɹ‾ǝɹnʇxǝʇ‾ʍɐɹpp + + { + { + ;ldɯᴉ‾ɔɹs = ldɯᴉ‾ʇsp + ;ǝɹnʇxǝʇ‾ʍɐɹpp‾ɔɹs = ǝɹnʇxǝʇ‾ʍɐɹpp‾ʇsp + + ;(ʌʇɹ‾ʇuǝɹɹnɔ 'ʎɹoɯǝɯ‾ǝɹnʇxǝʇ<-ǝɹnʇxǝʇ‾ʍɐɹpp‾ɔɹs '(ldɯᴉ‾ɔɹs)ʍǝᴉʌ‾ʇǝᵷɹɐʇɹǝpuǝɹ‾ʇǝᵷ‾ǝɔɐɟɹns‾ʍɐɹpp + 'ǝɹnʇxǝʇ‾ʍɐɹp<-ldɯᴉ‾ɔɹs 'ǝɹnʇxǝʇ‾pƐpǝuᴉʍ<-ldɯᴉ‾ɔɹs 'ǝɹnʇxǝʇ‾ʍɐɹpp‾ʇsp)oʇ‾ǝɯɐuǝɹ‾ǝɹnʇxǝʇ‾ʍɐɹpp + + ;(ǝɹnʇxǝʇ‾pƐpǝuᴉʍ<-ldɯᴉ‾ɔɹs)ʇuǝɹɐd‾ʇǝᵷ‾ǝɹnʇxǝʇ‾pƐpǝuᴉʍ = ǝɹnʇxǝʇ‾ʍɐɹpp‾ɔɹs + ;(ʇuǝɹɹnɔ)ǝɔɐɟɹnSʍɐɹꓷʇɔǝɹᴉꓷI‾ɯoɹɟ‾ldɯᴉ = ldɯᴉ‾ɔɹs + + { + ;ʞɐǝɹq + ;(ǝɔɐɟᴉ)ǝɔɐɟɹnSʍɐɹꓷʇɔǝɹᴉꓷI‾ɯoɹɟ‾ldɯᴉ = ldɯᴉ‾ʇsp + } + (ǝɔɐɟᴉ == ʇuǝɹɹnɔ) ɟᴉ + ;(ʇuǝɹɹnɔ)ǝsɐǝlǝꓤ‾1ǝɔɐɟɹns‾ʍɐɹpp + { + /* pǝʞɔǝɥɔuՈ */ ;ƎꓶꓭⱯꓒꓒIꓶꓞꓕON‾ꓤꓤƎꓷꓷ uɹnʇǝɹ + ;()ʞɔolun‾xǝʇnɯ‾pƐpǝuᴉʍ + ;("u\ʇǝᵷɹɐʇ dᴉlɟ ɐ puᴉɟ ʇ,uɐƆ")ꓤꓤƎ + } + (((ʇuǝɹɹnɔ& 'sdɐɔ& 'ʇuǝɹɹnɔ)ǝɔɐɟɹnSpǝɥɔɐʇʇⱯʇǝ⅁‾1ǝɔɐɟɹns‾ʍɐɹpp = ɹɥ)ꓷƎꓶIⱯꓞ) ɟᴉ + } + (;;ǝɔɐɟᴉ = ʇuǝɹɹnɔ) ɹoɟ + } + ǝslǝ + { + ;ǝɹnʇxǝʇ‾ʍɐɹpp‾ɔɹs = ǝɹnʇxǝʇ‾ʍɐɹpp‾ʇsp + + ;(ʌʇɹ‾ʇuǝɹɹnɔ 'ʎɹoɯǝɯ‾ǝɹnʇxǝʇ<-ǝɹnʇxǝʇ‾ʍɐɹpp‾ɔɹs '(ldɯᴉ‾ɔɹs)ʍǝᴉʌ‾ʇǝᵷɹɐʇɹǝpuǝɹ‾ʇǝᵷ‾ǝɔɐɟɹns‾ʍɐɹpp + 'ǝɹnʇxǝʇ‾ʍɐɹp<-ldɯᴉ‾ɔɹs 'ǝɹnʇxǝʇ‾pƐpǝuᴉʍ<-ldɯᴉ‾ɔɹs 'ǝɹnʇxǝʇ‾ʍɐɹpp‾ʇsp)oʇ‾ǝɯɐuǝɹ‾ǝɹnʇxǝʇ‾ʍɐɹpp + + ;(ǝɹnʇxǝʇ‾pƐpǝuᴉʍ<-ldɯᴉ‾ɔɹs)ʇuǝɹɐd‾ʇǝᵷ‾ǝɹnʇxǝʇ‾pƐpǝuᴉʍ = ǝɹnʇxǝʇ‾ʍɐɹpp‾ɔɹs + + { + { + ;ƎꓶꓭⱯꓒꓒIꓶꓞꓕON‾ꓤꓤƎꓷꓷ uɹnʇǝɹ + ;()ʞɔolun‾xǝʇnɯ‾pƐpǝuᴉʍ + ;(ǝɔɐɟᴉ 'ɔɹs '"u\˙d% ǝɔɐɟɹns sɐ uᴉɐɥɔ dᴉlɟ ǝɯɐs ǝɥʇ uo ʇou sᴉ d% ǝɔɐɟɹnS")NꓤⱯM + } + (ǝɔɐɟᴉ == ʇuǝɹɹnɔ) ɟᴉ + ;(ʇuǝɹɹnɔ)ǝsɐǝlǝꓤ‾1ǝɔɐɟɹns‾ʍɐɹpp + { + ;ƎꓶꓭⱯꓒꓒIꓶꓞꓕON‾ꓤꓤƎꓷꓷ uɹnʇǝɹ + ;()ʞɔolun‾xǝʇnɯ‾pƐpǝuᴉʍ + ;(ǝɔɐɟᴉ 'ɔɹs '"u\˙d% ǝɔɐɟɹns sɐ uᴉɐɥɔ dᴉlɟ ǝɯɐs ǝɥʇ uo ʇou sᴉ d% ǝɔɐɟɹnS")NꓤⱯM + } + (((ʇuǝɹɹnɔ& 'sdɐɔ& 'ʇuǝɹɹnɔ)ǝɔɐɟɹnSpǝɥɔɐʇʇⱯʇǝ⅁‾1ǝɔɐɟɹns‾ʍɐɹpp = ɹɥ)ꓷƎꓶIⱯꓞ) ɟᴉ + } + (;ɔɹs =¡ ʇuǝɹɹnɔ ;ǝɔɐɟᴉ = ʇuǝɹɹnɔ) ɹoɟ + } + (ldɯᴉ‾ɔɹs) ɟᴉ + + ;(0 'ʇxǝʇuoɔ‾ǝʇɐᴉpǝɯɯᴉ<-ʍɐɹpp<-ldɯᴉ‾ʇsp)ʍǝᴉʌ‾ʇǝᵷɹɐʇɹǝpuǝɹ‾ʇǝᵷ‾ʇxǝʇuoɔ‾ǝɔᴉʌǝp‾pƐpǝuᴉʍ = ʌʇɹ‾ʇuǝɹɹnɔ + ;ǝɹnʇxǝʇ‾ʍɐɹp<-ldɯᴉ‾ʇsp = ǝɹnʇxǝʇ‾ʍɐɹp + ;ʎɹoɯǝɯ‾ǝɹnʇxǝʇ<-ǝɹnʇxǝʇ‾ʍɐɹpp‾ʇsp = ʎɹoɯǝɯ‾ǝɹnʇxǝʇ + ;(ǝɹnʇxǝʇ‾pƐpǝuᴉʍ<-ldɯᴉ‾ʇsp)ʇuǝɹɐd‾ʇǝᵷ‾ǝɹnʇxǝʇ‾pƐpǝuᴉʍ = ǝɹnʇxǝʇ‾ʍɐɹpp‾ʇsp + ;ǝɹnʇxǝʇ‾pƐpǝuᴉʍ<-ldɯᴉ‾ʇsp = ǝɹnʇxǝʇ + ;(ldɯᴉ‾ʇsp)ʍǝᴉʌ‾ʇǝᵷɹɐʇɹǝpuǝɹ‾ʇǝᵷ‾ǝɔɐɟɹns‾ʍɐɹpp = ʌʇɹ‾dɯʇ + + { + ;ƎꓷOWƎɅISՈꓶƆXƎON‾ꓤꓤƎꓷꓷ uɹnʇǝɹ + ;()ʞɔolun‾xǝʇnɯ‾pƐpǝuᴉʍ + ;("u\˙ǝpoɯ ǝʌᴉsnlɔxǝ uᴉ ʇoN")NꓤⱯM + } + ((ƎɅISՈꓶƆXƎ‾ꓶƆSꓷꓷ & lǝʌǝl‾ǝʌᴉʇɐɹǝdooɔ<-ʍɐɹpp<-ldɯᴉ‾ʇsp)¡ && + (ƎƆⱯꓞꓤՈS⅄ꓤⱯWIꓤꓒ‾SꓒⱯƆSꓷꓷ & sdɐƆʍp˙sdɐƆspp˙ɔsǝp‾ǝɔɐɟɹns<-ldɯᴉ‾ʇsp)) ɟᴉ + + ;()ʞɔol‾xǝʇnɯ‾pƐpǝuᴉʍ + + ;ꓕSOꓶƎƆⱯꓞꓤՈS‾ꓤꓤƎꓷꓷ uɹnʇǝɹ + ((ldɯᴉ‾ʇsp)ʇsol‾sᴉ‾ǝɔɐɟɹns‾ʍɐɹpp) ɟᴉ + + ;ƎꓶꓭⱯꓒꓒIꓶꓞꓕON‾ꓤꓤƎꓷꓷ uɹnʇǝɹ + (((⅄ⱯꓶꓤƎɅO‾SꓒⱯƆSꓷꓷ | ꓤƎꓞꓞՈꓭꓕNOꓤꓞ‾SꓒⱯƆSꓷꓷ) & sdɐƆʍp˙sdɐƆspp˙ɔsǝp‾ǝɔɐɟɹns<-ldɯᴉ‾ʇsp)¡ || ǝɔɐɟᴉ == ɔɹs) ɟᴉ + + ;(sᵷɐlɟ 'ɔɹs 'ǝɔɐɟᴉ '"u\˙xl#% sᵷɐlɟ 'd% ɔɹs 'd% ǝɔɐɟᴉ")ƎƆⱯꓤꓕ + + ;ɹɥ ꓕꓶՈSƎꓤH + ;ʎɹoɯǝɯ‾ǝɹnʇxǝʇ* pᴉoʌ + ;ʇuǝɹɹnɔ* ǝɔɐɟɹnSʍɐɹꓷʇɔǝɹᴉꓷI + ;{ꓒIꓶꓞ‾SꓒⱯƆSꓷꓷ} = sdɐɔ SꓒⱯƆSꓷꓷ + ;ǝɹnʇxǝʇ‾ʍɐɹp* 'ǝɹnʇxǝʇ* ǝɹnʇxǝʇ‾pƐpǝuᴉʍ ʇɔnɹʇs + ;ʌʇɹ‾ʇuǝɹɹnɔ* 'ʌʇɹ‾dɯʇ* ʍǝᴉʌ‾ʇǝᵷɹɐʇɹǝpuǝɹ‾pƐpǝuᴉʍ ʇɔnɹʇs + ;ǝɹnʇxǝʇ‾ʍɐɹpp‾ɔɹs* 'ǝɹnʇxǝʇ‾ʍɐɹpp‾ʇsp* ǝɹnʇxǝʇ‾ʍɐɹpp ʇɔnɹʇs + ;(ɔɹs)ǝɔɐɟɹnSʍɐɹꓷʇɔǝɹᴉꓷI‾ɯoɹɟ‾ldɯᴉ‾ǝɟɐsun = ldɯᴉ‾ɔɹs* ǝɔɐɟɹns‾ʍɐɹpp ʇɔnɹʇs + ;(ǝɔɐɟᴉ)ǝɔɐɟɹnSʍɐɹꓷʇɔǝɹᴉꓷI‾ɯoɹɟ‾ldɯᴉ = ldɯᴉ‾ʇsp* ǝɔɐɟɹns‾ʍɐɹpp ʇɔnɹʇs }
static HRESULT WINAPI DECLSPEC_HOTPATCH ddraw_surface7_Flip(IDirectDrawSurface7 *iface,