From 55311d0bb828d73ec33d5eaa262c88f9d4d3dded Mon Sep 17 00:00:00 2001 From: Sara Date: Fri, 21 Apr 2023 00:26:36 +0200 Subject: [PATCH] fixed translation issue with ninesliced images --- src/corelib/render.c | 18 ++++++++---------- 1 file changed, 8 insertions(+), 10 deletions(-) diff --git a/src/corelib/render.c b/src/corelib/render.c index 4f3be4b..35916f8 100644 --- a/src/corelib/render.c +++ b/src/corelib/render.c @@ -160,7 +160,7 @@ void exec_sliced_cmd(const drawcmd_t* cmd) { tw - sliced->corner_size*2, sliced->corner_size }; dstr = get_dest_with_size((SDL_FRect){ - rect.x + sliced->radius, 0.0, sliced->rect.w - sliced->radius * 2, sliced->radius + rect.x + sliced->radius, rect.y, sliced->rect.w - sliced->radius * 2, sliced->radius }, cmd->ui); SDL_RenderCopyF(g_context.renderer, t, &srcr, &dstr); @@ -169,7 +169,7 @@ void exec_sliced_cmd(const drawcmd_t* cmd) { tw - sliced->corner_size, 0, sliced->corner_size, sliced->corner_size }; dstr = get_dest_with_size((SDL_FRect){ - rect.w - sliced->radius, 0, sliced->radius, sliced->radius + rect.x + rect.w - sliced->radius, rect.y, sliced->radius, sliced->radius }, cmd->ui); SDL_RenderCopyF(g_context.renderer, t, &srcr, &dstr); @@ -178,7 +178,7 @@ void exec_sliced_cmd(const drawcmd_t* cmd) { 0, sliced->corner_size, sliced->corner_size, th - sliced->corner_size * 2 }; dstr = get_dest_with_size((SDL_FRect) { - 0, sliced->radius, sliced->radius, rect.h - sliced->radius * 2 + rect.x, rect.y + sliced->radius, sliced->radius, rect.h - sliced->radius * 2 }, cmd->ui); SDL_RenderCopyF(g_context.renderer, t, &srcr, &dstr); @@ -187,7 +187,7 @@ void exec_sliced_cmd(const drawcmd_t* cmd) { sliced->corner_size, sliced->corner_size, tw - sliced->corner_size * 2, th - sliced->corner_size * 2 }; dstr = get_dest_with_size((SDL_FRect) { - sliced->radius, sliced->radius, rect.w - sliced->radius * 2, rect.h - sliced->radius * 2 + rect.x + sliced->radius, rect.y + sliced->radius, rect.w - sliced->radius * 2, rect.h - sliced->radius * 2 }, cmd->ui); SDL_RenderCopyF(g_context.renderer, t, &srcr, &dstr); @@ -196,18 +196,16 @@ void exec_sliced_cmd(const drawcmd_t* cmd) { tw - sliced->corner_size, sliced->corner_size, sliced->corner_size, th - sliced->corner_size * 2 }; dstr = get_dest_with_size((SDL_FRect) { - rect.w - sliced->radius, sliced->radius, sliced->radius, rect.h - sliced->radius * 2 + rect.x + rect.w - sliced->radius, rect.y + sliced->radius, sliced->radius, rect.h - sliced->radius * 2 }, cmd->ui); SDL_RenderCopyF(g_context.renderer, t, &srcr, &dstr); // bottom-left srcr = (SDL_Rect) { - 0, th - sliced->corner_size, - sliced->corner_size, sliced->corner_size + 0, th - sliced->corner_size, sliced->corner_size, sliced->corner_size }; dstr = get_dest_with_size((SDL_FRect){ - 0, rect.h - sliced->radius, - sliced->radius, sliced->radius + rect.x, rect.y + rect.h - sliced->radius, sliced->radius, sliced->radius }, cmd->ui); SDL_RenderCopyF(g_context.renderer, t, &srcr, &dstr); @@ -216,7 +214,7 @@ void exec_sliced_cmd(const drawcmd_t* cmd) { sliced->corner_size, th - sliced->corner_size, tw - sliced->corner_size * 2, sliced->corner_size }; dstr = get_dest_with_size((SDL_FRect) { - sliced->radius, rect.h - sliced->radius, rect.w - sliced->radius * 2, sliced->radius + rect.x + sliced->radius, rect.y + rect.h - sliced->radius, rect.w - sliced->radius * 2, sliced->radius }, cmd->ui); SDL_RenderCopyF(g_context.renderer, t, &srcr, &dstr);