summaryrefslogtreecommitdiffstats
path: root/src/tk/text.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/tk/text.c')
-rw-r--r--src/tk/text.c25
1 files changed, 9 insertions, 16 deletions
diff --git a/src/tk/text.c b/src/tk/text.c
index 2b9a026..d83d5da 100644
--- a/src/tk/text.c
+++ b/src/tk/text.c
@@ -288,10 +288,7 @@ _mftk_text_render(struct mftk_widget *w, SDL_Renderer *renderer, int x, int y)
if (SDL_SetRenderDrawColor(renderer, color.r, color.g,
color.b, color.a) < 0 ||
SDL_RenderFillRect(renderer, &rect) < 0) {
- SDL_LogError(SDL_LOG_CATEGORY_APPLICATION,
- "Couldn't render widget: %s",
- SDL_GetError());
- return -1;
+ goto err;
}
rect.x += t->border;
rect.y += t->border;
@@ -301,10 +298,7 @@ _mftk_text_render(struct mftk_widget *w, SDL_Renderer *renderer, int x, int y)
MFTK_COLOR_BACK_R, MFTK_COLOR_BACK_G,
MFTK_COLOR_BACK_B, MFTK_COLOR_BACK_A) <
0 || SDL_RenderFillRect(renderer, &rect) < 0) {
- SDL_LogError(SDL_LOG_CATEGORY_APPLICATION,
- "Couldn't render widget: %s",
- SDL_GetError());
- return -1;
+ goto err;
}
}
@@ -321,10 +315,7 @@ _mftk_text_render(struct mftk_widget *w, SDL_Renderer *renderer, int x, int y)
if (t->val[0] != '\0' &&
SDL_RenderCopy(renderer, t->texture, NULL, &rect) < 0) {
- SDL_LogError(SDL_LOG_CATEGORY_APPLICATION,
- "Couldn't render widget: %s",
- SDL_GetError());
- return -1;
+ goto err;
}
timer = SDL_GetTicks();
if (timer - t->blink_timer >= MFTK_CURSOR_BLINK_MS) {
@@ -343,14 +334,16 @@ _mftk_text_render(struct mftk_widget *w, SDL_Renderer *renderer, int x, int y)
SDL_RenderDrawLine(renderer,
x + cur_x, y + t->y,
x + cur_x, y + t->h) < 0) {
- SDL_LogError(SDL_LOG_CATEGORY_APPLICATION,
- "Couldn't render widget: %s",
- SDL_GetError());
- return -1;
+ goto err;
}
}
return 0;
+
+ err:
+ SDL_LogError(SDL_LOG_CATEGORY_APPLICATION,
+ "Couldn't render widget: %s", SDL_GetError());
+ return -1;
}
static void