UI: Make the multiview lines use the same color

master
Shaolin 2018-03-12 02:29:00 -03:00
parent 4ed9d02052
commit 40f8d4cfb2
1 changed files with 32 additions and 12 deletions

View File

@ -312,6 +312,29 @@ void OBSProjector::OBSRenderMultiview(void *data, uint32_t cx, uint32_t cy)
bool studioMode = main->IsPreviewProgramMode(); bool studioMode = main->IsPreviewProgramMode();
auto renderVB = [solid, color](gs_vertbuffer_t *vb, int cx, int cy,
uint32_t colorVal)
{
if (!vb)
return;
matrix4 transform;
matrix4_identity(&transform);
transform.x.x = cx;
transform.y.y = cy;
gs_load_vertexbuffer(vb);
gs_matrix_push();
gs_matrix_mul(&transform);
gs_effect_set_color(color, colorVal);
while (gs_effect_loop(solid, "Solid"))
gs_draw(GS_LINESTRIP, 0, 0);
gs_matrix_pop();
};
auto drawBox = [solid, color] (float cx, float cy, auto drawBox = [solid, color] (float cx, float cy,
uint32_t colorVal) uint32_t colorVal)
{ {
@ -462,8 +485,7 @@ void OBSProjector::OBSRenderMultiview(void *data, uint32_t cx, uint32_t cy)
obs_source_video_render(src); obs_source_video_render(src);
endRegion(); endRegion();
gs_effect_set_color(color, outerColor); renderVB(window->outerBox, targetCX, targetCY, outerColor);
renderVB(solid, window->outerBox, targetCX, targetCY);
gs_matrix_pop(); gs_matrix_pop();
@ -483,8 +505,6 @@ void OBSProjector::OBSRenderMultiview(void *data, uint32_t cx, uint32_t cy)
gs_matrix_pop(); gs_matrix_pop();
} }
gs_effect_set_color(color, outerColor);
/* ----------------------------- */ /* ----------------------------- */
/* draw preview */ /* draw preview */
@ -511,13 +531,13 @@ void OBSProjector::OBSRenderMultiview(void *data, uint32_t cx, uint32_t cy)
gs_matrix_translate3f(sourceX, sourceY, 0.0f); gs_matrix_translate3f(sourceX, sourceY, 0.0f);
gs_matrix_scale3f(hiScaleX, hiScaleY, 1.0f); gs_matrix_scale3f(hiScaleX, hiScaleY, 1.0f);
renderVB(solid, window->outerBox, targetCX, targetCY); renderVB(window->outerBox, targetCX, targetCY, outerColor);
renderVB(solid, window->innerBox, targetCX, targetCY); renderVB(window->innerBox, targetCX, targetCY, outerColor);
renderVB(solid, window->leftVLine, targetCX, targetCY); renderVB(window->leftVLine, targetCX, targetCY, outerColor);
renderVB(solid, window->rightVLine, targetCX, targetCY); renderVB(window->rightVLine, targetCX, targetCY, outerColor);
renderVB(solid, window->leftLine, targetCX, targetCY); renderVB(window->leftLine, targetCX, targetCY, outerColor);
renderVB(solid, window->topLine, targetCX, targetCY); renderVB(window->topLine, targetCX, targetCY, outerColor);
renderVB(solid, window->rightLine, targetCX, targetCY); renderVB(window->rightLine, targetCX, targetCY, outerColor);
gs_matrix_pop(); gs_matrix_pop();
@ -557,7 +577,7 @@ void OBSProjector::OBSRenderMultiview(void *data, uint32_t cx, uint32_t cy)
gs_matrix_translate3f(sourceX, sourceY, 0.0f); gs_matrix_translate3f(sourceX, sourceY, 0.0f);
gs_matrix_scale3f(hiScaleX, hiScaleY, 1.0f); gs_matrix_scale3f(hiScaleX, hiScaleY, 1.0f);
renderVB(solid, window->outerBox, targetCX, targetCY); renderVB(window->outerBox, targetCX, targetCY, outerColor);
gs_matrix_pop(); gs_matrix_pop();