summaryrefslogtreecommitdiff
path: root/payloads/libpayload/drivers/video/graphics.c
diff options
context:
space:
mode:
Diffstat (limited to 'payloads/libpayload/drivers/video/graphics.c')
-rw-r--r--payloads/libpayload/drivers/video/graphics.c7
1 files changed, 4 insertions, 3 deletions
diff --git a/payloads/libpayload/drivers/video/graphics.c b/payloads/libpayload/drivers/video/graphics.c
index 49563267a9..85a8642c72 100644
--- a/payloads/libpayload/drivers/video/graphics.c
+++ b/payloads/libpayload/drivers/video/graphics.c
@@ -183,6 +183,10 @@ int draw_box(const struct rect *box, const struct rgb_color *rgb)
struct vector top_left;
struct vector size;
struct vector p, t;
+
+ if (cbgfx_init())
+ return CBGFX_ERROR_INIT;
+
const uint32_t color = calculate_color(rgb, 0);
const struct scale top_left_s = {
.x = { .n = box->offset.x, .d = CANVAS_SCALE, },
@@ -193,9 +197,6 @@ int draw_box(const struct rect *box, const struct rgb_color *rgb)
.y = { .n = box->size.y, .d = CANVAS_SCALE, }
};
- if (cbgfx_init())
- return CBGFX_ERROR_INIT;
-
transform_vector(&top_left, &canvas.size, &top_left_s, &canvas.offset);
transform_vector(&size, &canvas.size, &size_s, &vzero);
add_vectors(&t, &top_left, &size);