Skip to content

Commit bdb607a

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

File tree

1 file changed

+20
-3
lines changed

1 file changed

+20
-3
lines changed

lib_nbgl/src/nbgl_obj.c

Lines changed: 20 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -353,21 +353,38 @@ static void compute_position(nbgl_obj_t *obj, nbgl_obj_t *prevObj)
353353

354354
obj->area.x0 = parent->obj.area.x0 + obj->rel_x0;
355355
obj->area.y0 = parent->obj.area.y0 + obj->rel_y0;
356-
357-
if ((obj->area.x0 + obj->area.width) > SCREEN_WIDTH) {
356+
if ((obj->area.x0 + obj->area.width) > (parent->obj.area.x0 + parent->obj.area.width)) {
357+
#ifdef BUILD_SCREENSHOTS
358+
obj->area.width = parent->obj.area.x0 + parent->obj.area.width - obj->area.x0;
359+
// Be sure the area is not empty
360+
if (!obj->area.width) {
361+
obj->area.width = 1;
362+
obj->area.x0 -= 1;
363+
}
364+
#else // BUILD_SCREENSHOTS
358365
LOG_FATAL(OBJ_LOGGER,
359366
"compute_position(), forbidden width, obj->type = %d, x0=%d, width=%d\n",
360367
obj->type,
361368
obj->area.x0,
362369
obj->area.width);
370+
#endif // BUILD_SCREENSHOTS
363371
}
364372
#ifdef HAVE_SE_TOUCH
365-
if ((obj->area.y0 + obj->area.height) > SCREEN_HEIGHT) {
373+
if ((obj->area.y0 + obj->area.height) > (parent->obj.area.y0 + parent->obj.area.height)) {
374+
#ifdef BUILD_SCREENSHOTS
375+
obj->area.height = parent->obj.area.y0 + parent->obj.area.height - obj->area.y0;
376+
// Be sure the area is not empty
377+
if (!obj->area.height) {
378+
obj->area.height = 1;
379+
obj->area.y0 -= 1;
380+
}
381+
#else // BUILD_SCREENSHOTS
366382
LOG_FATAL(OBJ_LOGGER,
367383
"compute_position(), forbidden height, obj->type = %d, y0=%d, height=%d\n",
368384
obj->type,
369385
obj->area.y0,
370386
obj->area.height);
387+
#endif // BUILD_SCREENSHOTS
371388
}
372389
#endif // HAVE_SE_TOUCH
373390
}

0 commit comments

Comments
 (0)