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;
|
sourceX = thickness + pvwprgCX / 2;
|
||||||
sourceY = thickness;
|
sourceY = thickness;
|
||||||
labelX = offset + pvwprgCX / 2;
|
labelX = offset + pvwprgCX / 2;
|
||||||
labelY = pvwprgCY * 0.85f;
|
labelY = pvwprgCY;
|
||||||
if (program) {
|
if (program) {
|
||||||
sourceX += pvwprgCX;
|
sourceX += pvwprgCX;
|
||||||
labelX += pvwprgCX;
|
labelX += pvwprgCX;
|
||||||
@ -330,27 +330,27 @@ void Multiview::Render(uint32_t cx, uint32_t cy)
|
|||||||
sourceX = thickness;
|
sourceX = thickness;
|
||||||
sourceY = pvwprgCY + thickness;
|
sourceY = pvwprgCY + thickness;
|
||||||
labelX = offset;
|
labelX = offset;
|
||||||
labelY = pvwprgCY * 1.85f;
|
labelY = pvwprgCY * 2;
|
||||||
if (program) {
|
if (program) {
|
||||||
sourceY = thickness;
|
sourceY = thickness;
|
||||||
labelY = pvwprgCY * 0.85f;
|
labelY = pvwprgCY;
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case MultiviewLayout::VERTICAL_RIGHT_8_SCENES:
|
case MultiviewLayout::VERTICAL_RIGHT_8_SCENES:
|
||||||
sourceX = pvwprgCX + thickness;
|
sourceX = pvwprgCX + thickness;
|
||||||
sourceY = pvwprgCY + thickness;
|
sourceY = pvwprgCY + thickness;
|
||||||
labelX = pvwprgCX + offset;
|
labelX = pvwprgCX + offset;
|
||||||
labelY = pvwprgCY * 1.85f;
|
labelY = pvwprgCY * 2;
|
||||||
if (program) {
|
if (program) {
|
||||||
sourceY = thickness;
|
sourceY = thickness;
|
||||||
labelY = pvwprgCY * 0.85f;
|
labelY = pvwprgCY;
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case MultiviewLayout::HORIZONTAL_BOTTOM_8_SCENES:
|
case MultiviewLayout::HORIZONTAL_BOTTOM_8_SCENES:
|
||||||
sourceX = thickness;
|
sourceX = thickness;
|
||||||
sourceY = pvwprgCY + thickness;
|
sourceY = pvwprgCY + thickness;
|
||||||
labelX = offset;
|
labelX = offset;
|
||||||
labelY = pvwprgCY * 1.85f;
|
labelY = pvwprgCY * 2;
|
||||||
if (program) {
|
if (program) {
|
||||||
sourceX += pvwprgCX;
|
sourceX += pvwprgCX;
|
||||||
labelX += pvwprgCX;
|
labelX += pvwprgCX;
|
||||||
@ -367,7 +367,7 @@ void Multiview::Render(uint32_t cx, uint32_t cy)
|
|||||||
sourceX = thickness;
|
sourceX = thickness;
|
||||||
sourceY = thickness;
|
sourceY = thickness;
|
||||||
labelX = offset;
|
labelX = offset;
|
||||||
labelY = pvwprgCY * 0.85f;
|
labelY = pvwprgCY;
|
||||||
if (program) {
|
if (program) {
|
||||||
sourceX += pvwprgCX;
|
sourceX += pvwprgCX;
|
||||||
labelX += pvwprgCX;
|
labelX += pvwprgCX;
|
||||||
@ -444,12 +444,16 @@ void Multiview::Render(uint32_t cx, uint32_t cy)
|
|||||||
offset = labelOffset(multiviewLayout, label, scenesCX);
|
offset = labelOffset(multiviewLayout, label, scenesCX);
|
||||||
|
|
||||||
gs_matrix_push();
|
gs_matrix_push();
|
||||||
gs_matrix_translate3f(sourceX + offset,
|
gs_matrix_translate3f(
|
||||||
(scenesCY * 0.85f) + sourceY, 0.0f);
|
sourceX + offset,
|
||||||
|
sourceY + scenesCY -
|
||||||
|
(obs_source_get_height(label) * ppiScaleY) -
|
||||||
|
(thickness * 3),
|
||||||
|
0.0f);
|
||||||
gs_matrix_scale3f(ppiScaleX, ppiScaleY, 1.0f);
|
gs_matrix_scale3f(ppiScaleX, ppiScaleY, 1.0f);
|
||||||
drawBox(obs_source_get_width(label),
|
drawBox(obs_source_get_width(label),
|
||||||
obs_source_get_height(label) + int(sourceY * 0.015f),
|
obs_source_get_height(label) + thicknessx2, labelColor);
|
||||||
labelColor);
|
gs_matrix_translate3f(0, thickness, 0.0f);
|
||||||
obs_source_video_render(label);
|
obs_source_video_render(label);
|
||||||
gs_matrix_pop();
|
gs_matrix_pop();
|
||||||
}
|
}
|
||||||
@ -499,12 +503,18 @@ void Multiview::Render(uint32_t cx, uint32_t cy)
|
|||||||
// Draw the Label
|
// Draw the Label
|
||||||
if (drawLabel) {
|
if (drawLabel) {
|
||||||
gs_matrix_push();
|
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);
|
gs_matrix_scale3f(ppiScaleX, ppiScaleY, 1.0f);
|
||||||
drawBox(obs_source_get_width(previewLabel),
|
drawBox(obs_source_get_width(previewLabel),
|
||||||
obs_source_get_height(previewLabel) +
|
obs_source_get_height(previewLabel) + thicknessx2,
|
||||||
int(pvwprgCX * 0.015f),
|
|
||||||
labelColor);
|
labelColor);
|
||||||
|
gs_matrix_translate3f(0, thickness, 0.0f);
|
||||||
obs_source_video_render(previewLabel);
|
obs_source_video_render(previewLabel);
|
||||||
gs_matrix_pop();
|
gs_matrix_pop();
|
||||||
}
|
}
|
||||||
@ -532,12 +542,18 @@ void Multiview::Render(uint32_t cx, uint32_t cy)
|
|||||||
// Draw the Label
|
// Draw the Label
|
||||||
if (drawLabel) {
|
if (drawLabel) {
|
||||||
gs_matrix_push();
|
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);
|
gs_matrix_scale3f(ppiScaleX, ppiScaleY, 1.0f);
|
||||||
drawBox(obs_source_get_width(programLabel),
|
drawBox(obs_source_get_width(programLabel),
|
||||||
obs_source_get_height(programLabel) +
|
obs_source_get_height(programLabel) + thicknessx2,
|
||||||
int(pvwprgCX * 0.015f),
|
|
||||||
labelColor);
|
labelColor);
|
||||||
|
gs_matrix_translate3f(0, thickness, 0.0f);
|
||||||
obs_source_video_render(programLabel);
|
obs_source_video_render(programLabel);
|
||||||
gs_matrix_pop();
|
gs_matrix_pop();
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user