mirror of
https://github.com/obsproject/obs-studio.git
synced 2024-09-19 20:32:15 +02:00
UI: Calculate label position using height and border
This commit is contained in:
parent
8500515d27
commit
40885b6b19
@ -320,7 +320,7 @@ void Multiview::Render(uint32_t cx, uint32_t cy)
|
||||
sourceX = thickness + pvwprgCX / 2;
|
||||
sourceY = thickness;
|
||||
labelX = offset + pvwprgCX / 2;
|
||||
labelY = pvwprgCY * 0.85f;
|
||||
labelY = pvwprgCY;
|
||||
if (program) {
|
||||
sourceX += pvwprgCX;
|
||||
labelX += pvwprgCX;
|
||||
@ -330,27 +330,27 @@ void Multiview::Render(uint32_t cx, uint32_t cy)
|
||||
sourceX = thickness;
|
||||
sourceY = pvwprgCY + thickness;
|
||||
labelX = offset;
|
||||
labelY = pvwprgCY * 1.85f;
|
||||
labelY = pvwprgCY * 2;
|
||||
if (program) {
|
||||
sourceY = thickness;
|
||||
labelY = pvwprgCY * 0.85f;
|
||||
labelY = pvwprgCY;
|
||||
}
|
||||
break;
|
||||
case MultiviewLayout::VERTICAL_RIGHT_8_SCENES:
|
||||
sourceX = pvwprgCX + thickness;
|
||||
sourceY = pvwprgCY + thickness;
|
||||
labelX = pvwprgCX + offset;
|
||||
labelY = pvwprgCY * 1.85f;
|
||||
labelY = pvwprgCY * 2;
|
||||
if (program) {
|
||||
sourceY = thickness;
|
||||
labelY = pvwprgCY * 0.85f;
|
||||
labelY = pvwprgCY;
|
||||
}
|
||||
break;
|
||||
case MultiviewLayout::HORIZONTAL_BOTTOM_8_SCENES:
|
||||
sourceX = thickness;
|
||||
sourceY = pvwprgCY + thickness;
|
||||
labelX = offset;
|
||||
labelY = pvwprgCY * 1.85f;
|
||||
labelY = pvwprgCY * 2;
|
||||
if (program) {
|
||||
sourceX += pvwprgCX;
|
||||
labelX += pvwprgCX;
|
||||
@ -367,7 +367,7 @@ void Multiview::Render(uint32_t cx, uint32_t cy)
|
||||
sourceX = thickness;
|
||||
sourceY = thickness;
|
||||
labelX = offset;
|
||||
labelY = pvwprgCY * 0.85f;
|
||||
labelY = pvwprgCY;
|
||||
if (program) {
|
||||
sourceX += pvwprgCX;
|
||||
labelX += pvwprgCX;
|
||||
@ -444,12 +444,16 @@ void Multiview::Render(uint32_t cx, uint32_t cy)
|
||||
offset = labelOffset(multiviewLayout, label, scenesCX);
|
||||
|
||||
gs_matrix_push();
|
||||
gs_matrix_translate3f(sourceX + offset,
|
||||
(scenesCY * 0.85f) + sourceY, 0.0f);
|
||||
gs_matrix_translate3f(
|
||||
sourceX + offset,
|
||||
sourceY + scenesCY -
|
||||
(obs_source_get_height(label) * ppiScaleY) -
|
||||
(thickness * 3),
|
||||
0.0f);
|
||||
gs_matrix_scale3f(ppiScaleX, ppiScaleY, 1.0f);
|
||||
drawBox(obs_source_get_width(label),
|
||||
obs_source_get_height(label) + int(sourceY * 0.015f),
|
||||
labelColor);
|
||||
obs_source_get_height(label) + thicknessx2, labelColor);
|
||||
gs_matrix_translate3f(0, thickness, 0.0f);
|
||||
obs_source_video_render(label);
|
||||
gs_matrix_pop();
|
||||
}
|
||||
@ -499,12 +503,18 @@ void Multiview::Render(uint32_t cx, uint32_t cy)
|
||||
// Draw the Label
|
||||
if (drawLabel) {
|
||||
gs_matrix_push();
|
||||
gs_matrix_translate3f(labelX, labelY, 0.0f);
|
||||
gs_matrix_translate3f(
|
||||
labelX,
|
||||
labelY -
|
||||
(obs_source_get_height(previewLabel) *
|
||||
ppiScaleY) -
|
||||
(thickness * 3),
|
||||
0.0f);
|
||||
gs_matrix_scale3f(ppiScaleX, ppiScaleY, 1.0f);
|
||||
drawBox(obs_source_get_width(previewLabel),
|
||||
obs_source_get_height(previewLabel) +
|
||||
int(pvwprgCX * 0.015f),
|
||||
obs_source_get_height(previewLabel) + thicknessx2,
|
||||
labelColor);
|
||||
gs_matrix_translate3f(0, thickness, 0.0f);
|
||||
obs_source_video_render(previewLabel);
|
||||
gs_matrix_pop();
|
||||
}
|
||||
@ -532,12 +542,18 @@ void Multiview::Render(uint32_t cx, uint32_t cy)
|
||||
// Draw the Label
|
||||
if (drawLabel) {
|
||||
gs_matrix_push();
|
||||
gs_matrix_translate3f(labelX, labelY, 0.0f);
|
||||
gs_matrix_translate3f(
|
||||
labelX,
|
||||
labelY -
|
||||
(obs_source_get_height(programLabel) *
|
||||
ppiScaleY) -
|
||||
(thickness * 3),
|
||||
0.0f);
|
||||
gs_matrix_scale3f(ppiScaleX, ppiScaleY, 1.0f);
|
||||
drawBox(obs_source_get_width(programLabel),
|
||||
obs_source_get_height(programLabel) +
|
||||
int(pvwprgCX * 0.015f),
|
||||
obs_source_get_height(programLabel) + thicknessx2,
|
||||
labelColor);
|
||||
gs_matrix_translate3f(0, thickness, 0.0f);
|
||||
obs_source_video_render(programLabel);
|
||||
gs_matrix_pop();
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user