Skip to content

Commit 8474f74

Browse files
Fix whole screen issue when building screenshots
1 parent 98b8ab6 commit 8474f74

File tree

1 file changed

+18
-0
lines changed

1 file changed

+18
-0
lines changed

lib_nbgl/src/nbgl_obj.c

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -355,19 +355,37 @@ static void compute_position(nbgl_obj_t *obj, nbgl_obj_t *prevObj)
355355
obj->area.y0 = parent->obj.area.y0 + obj->rel_y0;
356356

357357
if ((obj->area.x0 + obj->area.width) > SCREEN_WIDTH) {
358+
#ifdef BUILD_SCREENSHOTS
359+
obj->area.width = SCREEN_WIDTH - obj->area.x0;
360+
// Be sure the area is not empty
361+
if (!obj->area.width) {
362+
obj->area.width = 1;
363+
obj->area.x0 -= 1;
364+
}
365+
#else // BUILD_SCREENSHOTS
358366
LOG_FATAL(OBJ_LOGGER,
359367
"compute_position(), forbidden width, obj->type = %d, x0=%d, width=%d\n",
360368
obj->type,
361369
obj->area.x0,
362370
obj->area.width);
371+
#endif // BUILD_SCREENSHOTS
363372
}
364373
#ifdef HAVE_SE_TOUCH
365374
if ((obj->area.y0 + obj->area.height) > SCREEN_HEIGHT) {
375+
#ifdef BUILD_SCREENSHOTS
376+
obj->area.height = SCREEN_HEIGHT - obj->area.y0;
377+
// Be sure the area is not empty
378+
if (!obj->area.height) {
379+
obj->area.height = 1;
380+
obj->area.y0 -= 1;
381+
}
382+
#else // BUILD_SCREENSHOTS
366383
LOG_FATAL(OBJ_LOGGER,
367384
"compute_position(), forbidden height, obj->type = %d, y0=%d, height=%d\n",
368385
obj->type,
369386
obj->area.y0,
370387
obj->area.height);
388+
#endif // BUILD_SCREENSHOTS
371389
}
372390
#endif // HAVE_SE_TOUCH
373391
}

0 commit comments

Comments
 (0)