fixed translation issue with ninesliced images

pull/1/head
Sara 2023-04-21 00:26:36 +02:00
parent 38e6908dc3
commit 55311d0bb8
1 changed files with 8 additions and 10 deletions

View File

@ -160,7 +160,7 @@ void exec_sliced_cmd(const drawcmd_t* cmd) {
tw - sliced->corner_size*2, sliced->corner_size tw - sliced->corner_size*2, sliced->corner_size
}; };
dstr = get_dest_with_size((SDL_FRect){ 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); }, cmd->ui);
SDL_RenderCopyF(g_context.renderer, t, &srcr, &dstr); 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 tw - sliced->corner_size, 0, sliced->corner_size, sliced->corner_size
}; };
dstr = get_dest_with_size((SDL_FRect){ 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); }, cmd->ui);
SDL_RenderCopyF(g_context.renderer, t, &srcr, &dstr); 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 0, sliced->corner_size, sliced->corner_size, th - sliced->corner_size * 2
}; };
dstr = get_dest_with_size((SDL_FRect) { 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); }, cmd->ui);
SDL_RenderCopyF(g_context.renderer, t, &srcr, &dstr); 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 sliced->corner_size, sliced->corner_size, tw - sliced->corner_size * 2, th - sliced->corner_size * 2
}; };
dstr = get_dest_with_size((SDL_FRect) { 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); }, cmd->ui);
SDL_RenderCopyF(g_context.renderer, t, &srcr, &dstr); 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 tw - sliced->corner_size, sliced->corner_size, sliced->corner_size, th - sliced->corner_size * 2
}; };
dstr = get_dest_with_size((SDL_FRect) { 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); }, cmd->ui);
SDL_RenderCopyF(g_context.renderer, t, &srcr, &dstr); SDL_RenderCopyF(g_context.renderer, t, &srcr, &dstr);
// bottom-left // bottom-left
srcr = (SDL_Rect) { srcr = (SDL_Rect) {
0, th - sliced->corner_size, 0, th - sliced->corner_size, sliced->corner_size, sliced->corner_size
sliced->corner_size, sliced->corner_size
}; };
dstr = get_dest_with_size((SDL_FRect){ dstr = get_dest_with_size((SDL_FRect){
0, rect.h - sliced->radius, rect.x, rect.y + rect.h - sliced->radius, sliced->radius, sliced->radius
sliced->radius, sliced->radius
}, cmd->ui); }, cmd->ui);
SDL_RenderCopyF(g_context.renderer, t, &srcr, &dstr); 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 sliced->corner_size, th - sliced->corner_size, tw - sliced->corner_size * 2, sliced->corner_size
}; };
dstr = get_dest_with_size((SDL_FRect) { 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); }, cmd->ui);
SDL_RenderCopyF(g_context.renderer, t, &srcr, &dstr); SDL_RenderCopyF(g_context.renderer, t, &srcr, &dstr);