[WINESYNC] d3dx9: Merge the d3dx_effect_GetAnnotationByName() helper.

Signed-off-by: Michael Stefaniuc <mstefani@winehq.org>
Signed-off-by: Matteo Bruni <mbruni@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>

wine commit id 1dd9104724b333fe27c2a1b7e57b31c29a252420 by Michael Stefaniuc <mstefani@winehq.org>
This commit is contained in:
winesync 2020-09-21 22:40:26 +02:00 committed by Jérôme Gardou
parent 3a9af49488
commit de908e3bd1
2 changed files with 22 additions and 29 deletions

View file

@ -1290,33 +1290,6 @@ static UINT get_annotation_from_object(struct d3dx9_base_effect *base,
}
}
static D3DXHANDLE d3dx9_base_effect_get_annotation_by_name(struct d3dx9_base_effect *base,
D3DXHANDLE object, const char *name)
{
struct d3dx_parameter *annotation = NULL;
struct d3dx_parameter *annotations = NULL;
UINT annotation_count = 0;
if (!name)
{
WARN("Invalid argument specified\n");
return NULL;
}
annotation_count = get_annotation_from_object(base, object, &annotations);
annotation = get_annotation_by_name(base, annotation_count, annotations, name);
if (annotation)
{
TRACE("Returning parameter %p\n", annotation);
return get_parameter_handle(annotation);
}
WARN("Annotation not found.\n");
return NULL;
}
static BOOL walk_parameter_tree(struct d3dx_parameter *param, walk_parameter_dep_func param_func,
void *data)
{
@ -3520,10 +3493,30 @@ static D3DXHANDLE WINAPI d3dx_effect_GetAnnotationByName(ID3DXEffect *iface, D3D
const char *name)
{
struct d3dx_effect *effect = impl_from_ID3DXEffect(iface);
struct d3dx_parameter *annotation = NULL;
struct d3dx_parameter *annotations = NULL;
unsigned int annotation_count;
TRACE("iface %p, object %p, name %s.\n", iface, object, debugstr_a(name));
return d3dx9_base_effect_get_annotation_by_name(&effect->base_effect, object, name);
if (!name)
{
WARN("Invalid argument specified\n");
return NULL;
}
annotation_count = get_annotation_from_object(&effect->base_effect, object, &annotations);
annotation = get_annotation_by_name(&effect->base_effect, annotation_count, annotations, name);
if (annotation)
{
TRACE("Returning parameter %p\n", annotation);
return get_parameter_handle(annotation);
}
WARN("Annotation not found.\n");
return NULL;
}
static HRESULT WINAPI d3dx_effect_SetValue(ID3DXEffect *iface, D3DXHANDLE parameter,

View file

@ -15,4 +15,4 @@ files: {include/d3dx9.h: sdk/include/dxsdk/d3dx9.h, include/d3dx9anim.h: sdk/inc
include/d3dx9mesh.h: sdk/include/dxsdk/d3dx9mesh.h, include/d3dx9of.h: sdk/include/dxsdk/d3dx9of.h,
include/d3dx9shader.h: sdk/include/dxsdk/d3dx9shader.h, include/d3dx9shape.h: sdk/include/dxsdk/d3dx9shape.h,
include/d3dx9tex.h: sdk/include/dxsdk/d3dx9tex.h, include/d3dx9xof.h: sdk/include/dxsdk/d3dx9xof.h}
tags: {wine: 7a1df2b0069bde1a9a022c6454fb8b3e06181fd0}
tags: {wine: 1dd9104724b333fe27c2a1b7e57b31c29a252420}