Skip to content

Commit

Permalink
UI: Give private spacing helper sources names
Browse files Browse the repository at this point in the history
  • Loading branch information
gxalpha authored and RytoEX committed May 12, 2024
1 parent 03313a6 commit 67e4853
Showing 1 changed file with 6 additions and 3 deletions.
9 changes: 6 additions & 3 deletions UI/window-basic-preview.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
#include <string>
#include <graphics/vec4.h>
#include <graphics/matrix4.h>
#include <util/dstr.hpp>
#include "window-basic-preview.hpp"
#include "window-basic-main.hpp"
#include "obs-app.hpp"
Expand Down Expand Up @@ -2331,7 +2332,7 @@ OBSBasicPreview *OBSBasicPreview::Get()
return OBSBasic::Get()->ui->preview;
}

static obs_source_t *CreateLabel(float pixelRatio)
static obs_source_t *CreateLabel(float pixelRatio, int i)
{
OBSDataAutoRelease settings = obs_data_create();
OBSDataAutoRelease font = obs_data_create();
Expand All @@ -2357,7 +2358,9 @@ static obs_source_t *CreateLabel(float pixelRatio)
const char *text_source_id = "text_ft2_source";
#endif

return obs_source_create_private(text_source_id, NULL, settings);
DStr name;
dstr_printf(name, "Preview spacing label %d", i);
return obs_source_create_private(text_source_id, name, settings);
}

static void SetLabelText(int sourceIndex, int px)
Expand Down Expand Up @@ -2639,7 +2642,7 @@ void OBSBasicPreview::DrawSpacingHelpers()
float pixelRatio = main->GetDevicePixelRatio();
for (int i = 0; i < 4; i++) {
if (!spacerLabel[i])
spacerLabel[i] = CreateLabel(pixelRatio);
spacerLabel[i] = CreateLabel(pixelRatio, i);
}

vec3_set(&start, top.x, 0.0f, 1.0f);
Expand Down

0 comments on commit 67e4853

Please sign in to comment.