From 3d7eaee7c985cdafaf295225094a944c83cef505 Mon Sep 17 00:00:00 2001 From: twinaphex Date: Sun, 13 May 2018 14:43:40 +0200 Subject: [PATCH] (menu display driver) Cleanups to bind_texture --- menu/drivers_display/menu_display_d3d8.c | 12 ++++++------ menu/drivers_display/menu_display_d3d9.c | 16 +++++++--------- 2 files changed, 13 insertions(+), 15 deletions(-) diff --git a/menu/drivers_display/menu_display_d3d8.c b/menu/drivers_display/menu_display_d3d8.c index 46f460f945..df9f5b7768 100644 --- a/menu/drivers_display/menu_display_d3d8.c +++ b/menu/drivers_display/menu_display_d3d8.c @@ -106,12 +106,10 @@ static void menu_display_d3d8_viewport(menu_display_ctx_draw_t *draw, { } -static void menu_display_d3d8_bind_texture(void *data, d3d8_video_t *d3d) +static void menu_display_d3d8_bind_texture(menu_display_ctx_draw_t *draw, + d3d8_video_t *d3d) { - menu_display_ctx_draw_t *draw = (menu_display_ctx_draw_t*)data; - - if (!d3d || !draw || !draw->texture) - return; + LPDIRECT3DDEVICE8 dev = d3d->dev; d3d8_set_texture(d3d->dev, 0, (void*)draw->texture); d3d8_set_sampler_address_u(d3d->dev, 0, D3DTADDRESS_COMM_CLAMP); @@ -218,7 +216,9 @@ static void menu_display_d3d8_draw(menu_display_ctx_draw_t *draw, mvp.data = d3d; mvp.matrix = &m1; video_driver_set_mvp(&mvp); - menu_display_d3d8_bind_texture(draw, (d3d8_video_t*)video_info->userdata); + if (draw && draw->texture) + menu_display_d3d8_bind_texture(draw, d3d); + d3d8_draw_primitive(d3d->dev, menu_display_prim_to_d3d8_enum(draw->prim_type), d3d->menu_display.offset, diff --git a/menu/drivers_display/menu_display_d3d9.c b/menu/drivers_display/menu_display_d3d9.c index ef8331598c..7123455c5d 100644 --- a/menu/drivers_display/menu_display_d3d9.c +++ b/menu/drivers_display/menu_display_d3d9.c @@ -106,15 +106,10 @@ static void menu_display_d3d9_viewport(menu_display_ctx_draw_t *draw, { } -static void menu_display_d3d9_bind_texture(void *data, d3d9_video_t *d3d) +static void menu_display_d3d9_bind_texture(menu_display_ctx_draw_t *draw, + d3d9_video_t *d3d) { - menu_display_ctx_draw_t *draw = (menu_display_ctx_draw_t*)data; - LPDIRECT3DDEVICE9 dev; - - if (!d3d || !draw || !draw->texture) - return; - - dev = (LPDIRECT3DDEVICE9)d3d->dev; + LPDIRECT3DDEVICE9 dev = d3d->dev; d3d9_set_texture(dev, 0, (LPDIRECT3DTEXTURE9)draw->texture); d3d9_set_sampler_address_u(dev, 0, D3DTADDRESS_COMM_CLAMP); @@ -214,7 +209,10 @@ static void menu_display_d3d9_draw(menu_display_ctx_draw_t *draw, mvp.data = d3d; mvp.matrix = &m1; video_driver_set_mvp(&mvp); - menu_display_d3d9_bind_texture(draw, (d3d9_video_t*)video_info->userdata); + + if (draw && draw->texture) + menu_display_d3d9_bind_texture(draw, d3d); + d3d9_draw_primitive(dev, (D3DPRIMITIVETYPE)menu_display_prim_to_d3d9_enum(draw->prim_type), d3d->menu_display.offset,