mirror of
https://github.com/obsproject/obs-studio.git
synced 2026-04-10 17:50:28 -04:00
UI: Add option to draw safe areas in preview
This commit is contained in:
@@ -458,6 +458,8 @@ OBSBasic::OBSBasic(QWidget *parent)
|
||||
|
||||
connect(ui->broadcastButton, &QPushButton::clicked, this,
|
||||
&OBSBasic::BroadcastButtonClicked);
|
||||
|
||||
UpdatePreviewSafeAreas();
|
||||
}
|
||||
|
||||
static void SaveAudioDevice(const char *name, int channel, obs_data_t *parent,
|
||||
@@ -1642,6 +1644,8 @@ void OBSBasic::InitPrimitives()
|
||||
}
|
||||
circle = gs_render_save();
|
||||
|
||||
InitSafeAreas(&actionSafeMargin, &graphicsSafeMargin,
|
||||
&fourByThreeSafeMargin, &leftLine, &topLine, &rightLine);
|
||||
obs_leave_graphics();
|
||||
}
|
||||
|
||||
@@ -2643,6 +2647,12 @@ OBSBasic::~OBSBasic()
|
||||
gs_vertexbuffer_destroy(boxRight);
|
||||
gs_vertexbuffer_destroy(boxBottom);
|
||||
gs_vertexbuffer_destroy(circle);
|
||||
gs_vertexbuffer_destroy(actionSafeMargin);
|
||||
gs_vertexbuffer_destroy(graphicsSafeMargin);
|
||||
gs_vertexbuffer_destroy(fourByThreeSafeMargin);
|
||||
gs_vertexbuffer_destroy(leftLine);
|
||||
gs_vertexbuffer_destroy(topLine);
|
||||
gs_vertexbuffer_destroy(rightLine);
|
||||
obs_leave_graphics();
|
||||
|
||||
/* When shutting down, sometimes source references can get in to the
|
||||
@@ -4081,6 +4091,19 @@ void OBSBasic::RenderMain(void *data, uint32_t cx, uint32_t cy)
|
||||
|
||||
window->ui->preview->DrawSceneEditing();
|
||||
|
||||
uint32_t targetCX = window->previewCX;
|
||||
uint32_t targetCY = window->previewCY;
|
||||
|
||||
if (window->drawSafeAreas) {
|
||||
RenderSafeAreas(window->actionSafeMargin, targetCX, targetCY);
|
||||
RenderSafeAreas(window->graphicsSafeMargin, targetCX, targetCY);
|
||||
RenderSafeAreas(window->fourByThreeSafeMargin, targetCX,
|
||||
targetCY);
|
||||
RenderSafeAreas(window->leftLine, targetCX, targetCY);
|
||||
RenderSafeAreas(window->topLine, targetCX, targetCY);
|
||||
RenderSafeAreas(window->rightLine, targetCX, targetCY);
|
||||
}
|
||||
|
||||
/* --------------------------------------- */
|
||||
|
||||
gs_projection_pop();
|
||||
@@ -9650,3 +9673,9 @@ void OBSBasic::ShowStatusBarMessage(const QString &message)
|
||||
ui->statusbar->clearMessage();
|
||||
ui->statusbar->showMessage(message, 10000);
|
||||
}
|
||||
|
||||
void OBSBasic::UpdatePreviewSafeAreas()
|
||||
{
|
||||
drawSafeAreas = config_get_bool(App()->GlobalConfig(), "BasicWindow",
|
||||
"ShowSafeAreas");
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user