This series of patches introduces a new set of structures and functions that will enable code to be re-used across various functions in d3dx9, and eventually d3dx10-d3dx11. It might be possible to split this further, but I feel like this initial set gives better context as to where things are heading.
I have a [branch](https://gitlab.winehq.org/cmcadams/wine/-/commits/WIP/d3dx-shared-s… that uses these structures and functions in d3dx10 if further context would be useful. There are a lot of changes here, but after playing around with different approaches this was the best/cleanest way I could come up with for code sharing. I'm sure there will be things I missed or potentially ways to improve this, I'm open to suggestions of course. :)
--
v3: d3dx9: Use d3dx_load_pixels_from_pixels() in D3DXLoadVolumeFromMemory().
d3dx9: Use d3dx_pixels structure in decompression helper function.
d3dx9: Introduce d3dx_load_pixels_from_pixels() helper function.
d3dx9: Use d3dx_image structure in D3DXLoadSurfaceFromFileInMemory().
d3dx9: Introduce d3dx_image structure for use in D3DXGetImageInfoFromFileInMemory().
d3dx9: Refactor WIC image info retrieval code in D3DXGetImageInfoFromFileInMemory().
d3dx9: Refactor WIC GUID to D3DXIMAGE_FILEFORMAT conversion code.
https://gitlab.winehq.org/wine/wine/-/merge_requests/5666
> Meantime, I noticed that we could prepare MSHTML for the change better by completing dispex refactoring (and document objects split), see https://gitlab.winehq.org/jacek/wine/-/commits/mshtml-dispex/ for a draft. Unfortunately, it needs a few more vtbl entries, but the unification seems worth to me. On top of that, you wouldn't need to have a dedicated new interface implementation for document node and the window variant should be easier as it could be just a forwarder. What do you think?
Looks fine to me. I'm not a fan of all the new vtbl methods, but it's better than what we have currently, so it's fine. This will definitely simplify it, but at the same time, I still want to know if is there something wrong with this MR I should change?
I'd like to get it moving, considering it doesn't have much to do with this, these changes would come later ofc.
--
https://gitlab.winehq.org/wine/wine/-/merge_requests/5444#note_71791
> The problem with `func_info_t` is that it carries information specific to the instance (like hooks), not only abstract things like the signature, so you can't just apply "current style" function info to "style" object without some additional refactoring. It's hard to comment in more details without the code.
But this `func_info_t` (rather than IID) is used for storing/creating the function object itself (like create_builtin_function but for proxies), not tied to any object, and such function object contains all the "code" of the function not just the signature, so isn't that actually more correct, idiomatically at least?
If this builtin mshtml function were to be implemented in pure jscript somehow, it would contain all its code there, including hooks and everything else. It doesn't feel that right to me to "look up" the function on a specific object when calling it in such case, which may end up with the wrong function if we're not careful.
> I'm still hoping to see how the interface capable of handling prototype chains looks like.
There are no interfaces added to deal with prototype chains, unless you mean the new method I added for `func_info_t`?
It's basically like this:
```idl
HRESULT BuiltinFuncCall([in] void *func_ctx, [in] BOOL setter, [in] DISPPARAMS *dp, [out, optional] VARIANT *ret,
[out] EXCEPINFO *ei, [in] IServiceProvider *caller);
```
and then it's called here:
```c
static HRESULT ProxyFunction_call(script_ctx_t *ctx, FunctionInstance *func, jsval_t vthis, unsigned flags,
unsigned argc, jsval_t *argv, jsval_t *r, IServiceProvider *caller)
{
ProxyFunction *function = (ProxyFunction*)func;
DISPPARAMS dp = { NULL, NULL, argc, 0 };
IWineJSDispatchHost *proxy_target;
VARIANT buf[6], retv;
EXCEPINFO ei = { 0 };
IDispatch *this_obj;
jsdisp_t *jsdisp;
HRESULT hres;
unsigned i;
if(flags & DISPATCH_CONSTRUCT)
return E_UNEXPECTED;
if(argc > function->function.length)
argc = function->function.length;
if(is_undefined(vthis) || is_null(vthis))
this_obj = lookup_global_host(ctx);
else if(!is_object_instance(vthis))
return E_UNEXPECTED;
else
this_obj = get_object(vthis);
jsdisp = to_jsdisp(this_obj);
if(jsdisp) {
if(!(proxy_target = get_proxy_target(jsdisp)))
return E_UNEXPECTED;
IWineJSDispatchHost_AddRef(proxy_target);
}else if(FAILED(IDispatch_QueryInterface(this_obj, &IID_IWineJSDispatchHost, (void**)&proxy_target)) || !proxy_target)
return E_UNEXPECTED;
if(dp.cArgs <= ARRAY_SIZE(buf))
dp.rgvarg = buf;
else if(!(dp.rgvarg = malloc(dp.cArgs * sizeof(*dp.rgvarg)))) {
hres = E_OUTOFMEMORY;
goto fail;
}
for(i = 0; i < dp.cArgs; i++) {
hres = jsval_to_variant(argv[i], &dp.rgvarg[dp.cArgs - i - 1]);
if(FAILED(hres))
goto cleanup;
}
V_VT(&retv) = VT_EMPTY;
hres = IWineJSDispatchHost_BuiltinFuncCall(proxy_target, function->func_ctx, function->setter, &dp, r ? &retv : NULL, &ei, caller);
if(hres == DISP_E_EXCEPTION)
disp_fill_exception(ctx, &ei);
else if(hres == E_NOINTERFACE)
hres = E_UNEXPECTED;
else if(SUCCEEDED(hres) && r) {
hres = variant_to_jsval(ctx, &retv, r);
VariantClear(&retv);
if(SUCCEEDED(hres))
hres = convert_to_proxy(ctx, r);
}
cleanup:
while(i--)
VariantClear(&dp.rgvarg[i]);
if(dp.rgvarg != buf)
free(dp.rgvarg);
fail:
IWineJSDispatchHost_Release(proxy_target);
return hres;
}
```
nothing special or complicated, and of course the `func_ctx` is stored by PropGetInfo rather than the IID (and we check it for NULL to see whether it's a func/accessor or a proxy prop).
--
https://gitlab.winehq.org/wine/wine/-/merge_requests/5444#note_71782
--
v2: win32u: Use a helper to set the window surface clipping, within the lock.
wineandroid: Remove now unnecessary set_surface_region calls.
server: Update window surface regions when the window is shaped.
win32u: Intersect the clipping region with the window shape region.
server: Merge get_surface_region / get_window_region requests together.
server: Split update_surface_region into get_window_region helper.
win32u: Initialize window surfaces with a hwnd.
https://gitlab.winehq.org/wine/wine/-/merge_requests/5753
I was going to reimplement path resolution in ShellExecute, but half way through I realized that's very unnecessary.
Since what I wanted is a version of `PathResolve` that behaves differently _only_ for filespec paths, I ended up duplicating a lot of code, then I realized I can still pass filespec paths onto `PathResolve` and only deal with non-filespec paths.
--
v4: shell32: Fix ShellExecute for non-filespec paths.
https://gitlab.winehq.org/wine/wine/-/merge_requests/5692
I was going to reimplement path resolution in ShellExecute, but half way through I realized that's very unnecessary.
Since what I wanted is a version of `PathResolve` that behaves differently _only_ for filespec paths, I ended up duplicating a lot of code, then I realized I can still pass filespec paths onto `PathResolve` and only deal with non-filespec paths.
--
v5: debug CI failure
https://gitlab.winehq.org/wine/wine/-/merge_requests/5692