Skip to content

Commit 2d7b7ed

Browse files
authored
draw translation service overlay within content viewport (#18986)
1 parent 25ade82 commit 2d7b7ed

1 file changed

Lines changed: 27 additions & 15 deletions

File tree

gfx/gfx_widgets.c

Lines changed: 27 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -1639,13 +1639,25 @@ void gfx_widgets_frame(void *data)
16391639
/* AI Service overlay */
16401640
if (p_dispwidget->ai_service_overlay_state > 0)
16411641
{
1642+
video_viewport_t content_vp;
1643+
int overlay_x = 0;
1644+
int overlay_y = 0;
1645+
unsigned overlay_width = video_width;
1646+
unsigned overlay_height = video_height;
16421647
float outline_color[16] = {
16431648
0.00, 1.00, 0.00, 1.00,
16441649
0.00, 1.00, 0.00, 1.00,
16451650
0.00, 1.00, 0.00, 1.00,
16461651
0.00, 1.00, 0.00, 1.00,
16471652
};
16481653

1654+
if (video_driver_get_viewport_info(&content_vp) && content_vp.width && content_vp.height)
1655+
{
1656+
overlay_x = content_vp.x;
1657+
overlay_y = content_vp.y;
1658+
overlay_width = content_vp.width;
1659+
overlay_height = content_vp.height;
1660+
}
16491661
gfx_display_set_alpha(p_dispwidget->pure_white, 1.0f);
16501662

16511663
if (p_dispwidget->ai_service_overlay_texture)
@@ -1657,11 +1669,11 @@ void gfx_widgets_frame(void *data)
16571669
p_disp,
16581670
video_width,
16591671
video_height,
1660-
video_width,
1661-
video_height,
1672+
overlay_width,
1673+
overlay_height,
16621674
p_dispwidget->ai_service_overlay_texture,
1663-
0,
1664-
0,
1675+
overlay_x,
1676+
overlay_y,
16651677
0.0f, /* rad */
16661678
1.0f, /* cos(rad) = cos(0) = 1.0f */
16671679
0.0f, /* sine(rad) = sine(0) = 0.0f */
@@ -1676,8 +1688,8 @@ void gfx_widgets_frame(void *data)
16761688
p_disp,
16771689
userdata,
16781690
video_width, video_height,
1679-
0, 0,
1680-
video_width,
1691+
overlay_x, overlay_y,
1692+
overlay_width,
16811693
p_dispwidget->divider_width_1px,
16821694
video_width,
16831695
video_height,
@@ -1689,9 +1701,9 @@ void gfx_widgets_frame(void *data)
16891701
p_disp,
16901702
userdata,
16911703
video_width, video_height,
1692-
0,
1693-
video_height - p_dispwidget->divider_width_1px,
1694-
video_width,
1704+
overlay_x,
1705+
overlay_y + overlay_height - p_dispwidget->divider_width_1px,
1706+
overlay_width,
16951707
p_dispwidget->divider_width_1px,
16961708
video_width,
16971709
video_height,
@@ -1704,10 +1716,10 @@ void gfx_widgets_frame(void *data)
17041716
userdata,
17051717
video_width,
17061718
video_height,
1707-
0,
1708-
0,
1719+
overlay_x,
1720+
overlay_y,
17091721
p_dispwidget->divider_width_1px,
1710-
video_height,
1722+
overlay_height,
17111723
video_width,
17121724
video_height,
17131725
outline_color,
@@ -1718,10 +1730,10 @@ void gfx_widgets_frame(void *data)
17181730
p_disp,
17191731
userdata,
17201732
video_width, video_height,
1721-
video_width - p_dispwidget->divider_width_1px,
1722-
0,
1733+
overlay_x + overlay_width - p_dispwidget->divider_width_1px,
1734+
overlay_y,
17231735
p_dispwidget->divider_width_1px,
1724-
video_height,
1736+
overlay_height,
17251737
video_width,
17261738
video_height,
17271739
outline_color,

0 commit comments

Comments
 (0)