Michael Stefaniuc : d3dx9: Merge the d3dx_effect_GetAnnotationByName() helper.

Alexandre Julliard julliard at winehq.org
Tue Mar 5 15:06:30 CST 2019


Module: wine
Branch: master
Commit: 1dd9104724b333fe27c2a1b7e57b31c29a252420
URL:    https://source.winehq.org/git/wine.git/?a=commit;h=1dd9104724b333fe27c2a1b7e57b31c29a252420

Author: Michael Stefaniuc <mstefani at winehq.org>
Date:   Mon Mar  4 23:15:59 2019 +0100

d3dx9: Merge the d3dx_effect_GetAnnotationByName() helper.

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

---

 dlls/d3dx9_36/effect.c | 49 +++++++++++++++++++++----------------------------
 1 file changed, 21 insertions(+), 28 deletions(-)

diff --git a/dlls/d3dx9_36/effect.c b/dlls/d3dx9_36/effect.c
index ea35631..e7b8b86 100644
--- a/dlls/d3dx9_36/effect.c
+++ b/dlls/d3dx9_36/effect.c
@@ -1286,33 +1286,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)
 {
@@ -3516,10 +3489,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,




More information about the wine-cvs mailing list