提交 959bdda4 编写于 作者: S Shaolin

UI: Adjust multiview label size

上级 b4d2d5d9
...@@ -235,7 +235,15 @@ static inline void renderVB(gs_effect_t *effect, gs_vertbuffer_t *vb, ...@@ -235,7 +235,15 @@ static inline void renderVB(gs_effect_t *effect, gs_vertbuffer_t *vb,
static inline uint32_t labelOffset(obs_source_t *label, uint32_t cx) static inline uint32_t labelOffset(obs_source_t *label, uint32_t cx)
{ {
uint32_t w = obs_source_get_width(label); uint32_t w = obs_source_get_width(label);
w = uint32_t(float(w) * 0.5f);
int n; // Number of scenes per row
switch (multiviewLayout) {
default:
n = 4;
break;
}
w = uint32_t(w * ((1.0f) / n));
return (cx / 2) - w; return (cx / 2) - w;
} }
...@@ -393,27 +401,27 @@ void OBSProjector::OBSRenderMultiview(void *data, uint32_t cx, uint32_t cy) ...@@ -393,27 +401,27 @@ void OBSProjector::OBSRenderMultiview(void *data, uint32_t cx, uint32_t cy)
sourceX = thickness; sourceX = thickness;
sourceY = halfCY + thickness; sourceY = halfCY + thickness;
labelX = offset; labelX = offset;
labelY = halfCY * 1.8f; labelY = halfCY * 1.85f;
if (program) { if (program) {
sourceY = thickness; sourceY = thickness;
labelY = halfCY * 0.8f; labelY = halfCY * 0.85f;
} }
break; break;
case MultiviewLayout::VERTICAL_RIGHT_8_SCENES: case MultiviewLayout::VERTICAL_RIGHT_8_SCENES:
sourceX = halfCX + thickness; sourceX = halfCX + thickness;
sourceY = halfCY + thickness; sourceY = halfCY + thickness;
labelX = halfCX + offset; labelX = halfCX + offset;
labelY = halfCY * 1.8f; labelY = halfCY * 1.85f;
if (program) { if (program) {
sourceY = thickness; sourceY = thickness;
labelY = halfCY * 0.8f; labelY = halfCY * 0.85f;
} }
break; break;
case MultiviewLayout::HORIZONTAL_BOTTOM_8_SCENES: case MultiviewLayout::HORIZONTAL_BOTTOM_8_SCENES:
sourceX = thickness; sourceX = thickness;
sourceY = halfCY + thickness; sourceY = halfCY + thickness;
labelX = offset; labelX = offset;
labelY = halfCY * 1.8f; labelY = halfCY * 1.85f;
if (program) { if (program) {
sourceX += halfCX; sourceX += halfCX;
labelX += halfCX; labelX += halfCX;
...@@ -423,7 +431,7 @@ void OBSProjector::OBSRenderMultiview(void *data, uint32_t cx, uint32_t cy) ...@@ -423,7 +431,7 @@ void OBSProjector::OBSRenderMultiview(void *data, uint32_t cx, uint32_t cy)
sourceX = thickness; sourceX = thickness;
sourceY = thickness; sourceY = thickness;
labelX = offset; labelX = offset;
labelY = halfCY * 0.8f; labelY = halfCY * 0.85f;
if (program) { if (program) {
sourceX += halfCX; sourceX += halfCX;
labelX += halfCX; labelX += halfCX;
...@@ -490,13 +498,14 @@ void OBSProjector::OBSRenderMultiview(void *data, uint32_t cx, uint32_t cy) ...@@ -490,13 +498,14 @@ void OBSProjector::OBSRenderMultiview(void *data, uint32_t cx, uint32_t cy)
continue; continue;
offset = labelOffset(label, quarterCX); offset = labelOffset(label, quarterCX);
cx = obs_source_get_width(label);
cy = obs_source_get_height(label);
gs_matrix_push(); gs_matrix_push();
gs_matrix_translate3f(sourceX + offset, gs_matrix_translate3f(sourceX + offset,
(quarterCY * 0.8f) + sourceY, 0.0f); (quarterCY * 0.85f) + sourceY, 0.0f);
drawBox(cx, cy + int(quarterCX * 0.015f), labelColor); gs_matrix_scale3f(hiScaleX, hiScaleY, 1.0f);
drawBox(obs_source_get_width(label),
obs_source_get_height(label) +
int(quarterCX * 0.015f), labelColor);
obs_source_video_render(label); obs_source_video_render(label);
gs_matrix_pop(); gs_matrix_pop();
} else { } else {
...@@ -541,6 +550,7 @@ void OBSProjector::OBSRenderMultiview(void *data, uint32_t cx, uint32_t cy) ...@@ -541,6 +550,7 @@ void OBSProjector::OBSRenderMultiview(void *data, uint32_t cx, uint32_t cy)
// Draw the Label // Draw the Label
gs_matrix_push(); gs_matrix_push();
gs_matrix_translate3f(labelX, labelY, 0.0f); gs_matrix_translate3f(labelX, labelY, 0.0f);
gs_matrix_scale3f(hiScaleX, hiScaleY, 1.0f);
drawBox(obs_source_get_width(previewLabel), drawBox(obs_source_get_width(previewLabel),
obs_source_get_height(previewLabel) + obs_source_get_height(previewLabel) +
int(halfCX * 0.015f), labelColor); int(halfCX * 0.015f), labelColor);
...@@ -568,6 +578,7 @@ void OBSProjector::OBSRenderMultiview(void *data, uint32_t cx, uint32_t cy) ...@@ -568,6 +578,7 @@ void OBSProjector::OBSRenderMultiview(void *data, uint32_t cx, uint32_t cy)
// Draw the Label // Draw the Label
gs_matrix_push(); gs_matrix_push();
gs_matrix_translate3f(labelX, labelY, 0.0f); gs_matrix_translate3f(labelX, labelY, 0.0f);
gs_matrix_scale3f(hiScaleX, hiScaleY, 1.0f);
drawBox(obs_source_get_width(programLabel), drawBox(obs_source_get_width(programLabel),
obs_source_get_height(programLabel) + obs_source_get_height(programLabel) +
int(halfCX * 0.015f), labelColor); int(halfCX * 0.015f), labelColor);
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册