From 2dc0fdcfee25be4bb66904719cef4b85e6e485e8 Mon Sep 17 00:00:00 2001 From: twinaphex Date: Sat, 28 Mar 2020 03:47:05 +0100 Subject: [PATCH] (gfx drivers_display) Cleanups --- gfx/drivers_display/gfx_display_gl1.c | 27 ++++++++++++++------------- 1 file changed, 14 insertions(+), 13 deletions(-) diff --git a/gfx/drivers_display/gfx_display_gl1.c b/gfx/drivers_display/gfx_display_gl1.c index 8a3f2b8693..366d8150de 100644 --- a/gfx/drivers_display/gfx_display_gl1.c +++ b/gfx/drivers_display/gfx_display_gl1.c @@ -26,10 +26,6 @@ #include "../gfx_display.h" -#ifdef VITA -static float *vertices3 = NULL; -#endif - static const GLfloat gl1_menu_vertexes[] = { 0, 0, 1, 0, @@ -140,16 +136,21 @@ static void gfx_display_gl1_draw(gfx_display_ctx_draw_t *draw, glEnableClientState(GL_TEXTURE_COORD_ARRAY); #ifdef VITA - if (vertices3) - free(vertices3); - vertices3 = (float*)malloc(sizeof(float) * 3 * draw->coords->vertices); - int i; - for (i = 0; i < draw->coords->vertices; i++) { - memcpy(&vertices3[i*3], &draw->coords->vertex[i*2], sizeof(float) * 2); - vertices3[i*3] -= 0.5f; - vertices3[i*3+2] = 0.0f; + { + unsigned i; + static float *vertices3 = NULL; + + if (vertices3) + free(vertices3); + vertices3 = (float*)malloc(sizeof(float) * 3 * draw->coords->vertices); + for (i = 0; i < draw->coords->vertices; i++) + { + memcpy(&vertices3[i*3], &draw->coords->vertex[i*2], sizeof(float) * 2); + vertices3[i*3] -= 0.5f; + vertices3[i*3+2] = 0.0f; + } + glVertexPointer(3, GL_FLOAT, 0, vertices3); } - glVertexPointer(3, GL_FLOAT, 0, vertices3); #else glVertexPointer(2, GL_FLOAT, 0, draw->coords->vertex); #endif