mirror of
https://github.com/obsproject/obs-studio.git
synced 2026-10-28 03:44:52 +08:00
clang-format: Increase column limit from 80 to 120
This commit is contained in:
+9
-22
@@ -19,16 +19,14 @@
|
||||
#include "obs.h"
|
||||
#include "obs-internal.h"
|
||||
|
||||
bool obs_display_init(struct obs_display *display,
|
||||
const struct gs_init_data *graphics_data)
|
||||
bool obs_display_init(struct obs_display *display, const struct gs_init_data *graphics_data)
|
||||
{
|
||||
pthread_mutex_init_value(&display->draw_callbacks_mutex);
|
||||
pthread_mutex_init_value(&display->draw_info_mutex);
|
||||
|
||||
#if defined(_WIN32)
|
||||
/* Conservative test for NVIDIA flickering in multi-GPU setups */
|
||||
display->use_clear_workaround = gs_get_adapter_count() > 1 &&
|
||||
!gs_can_adapter_fast_clear();
|
||||
display->use_clear_workaround = gs_get_adapter_count() > 1 && !gs_can_adapter_fast_clear();
|
||||
#elif defined(__APPLE__)
|
||||
/* Apple Silicon GL driver doesn't seem to track SRGB clears correctly */
|
||||
display->use_clear_workaround = true;
|
||||
@@ -65,8 +63,7 @@ bool obs_display_init(struct obs_display *display,
|
||||
return true;
|
||||
}
|
||||
|
||||
obs_display_t *obs_display_create(const struct gs_init_data *graphics_data,
|
||||
uint32_t background_color)
|
||||
obs_display_t *obs_display_create(const struct gs_init_data *graphics_data, uint32_t background_color)
|
||||
{
|
||||
struct obs_display *display = bzalloc(sizeof(struct obs_display));
|
||||
|
||||
@@ -147,9 +144,7 @@ void obs_display_update_color_space(obs_display_t *display)
|
||||
pthread_mutex_unlock(&display->draw_info_mutex);
|
||||
}
|
||||
|
||||
void obs_display_add_draw_callback(obs_display_t *display,
|
||||
void (*draw)(void *param, uint32_t cx,
|
||||
uint32_t cy),
|
||||
void obs_display_add_draw_callback(obs_display_t *display, void (*draw)(void *param, uint32_t cx, uint32_t cy),
|
||||
void *param)
|
||||
{
|
||||
if (!display)
|
||||
@@ -162,9 +157,7 @@ void obs_display_add_draw_callback(obs_display_t *display,
|
||||
pthread_mutex_unlock(&display->draw_callbacks_mutex);
|
||||
}
|
||||
|
||||
void obs_display_remove_draw_callback(obs_display_t *display,
|
||||
void (*draw)(void *param, uint32_t cx,
|
||||
uint32_t cy),
|
||||
void obs_display_remove_draw_callback(obs_display_t *display, void (*draw)(void *param, uint32_t cx, uint32_t cy),
|
||||
void *param)
|
||||
{
|
||||
if (!display)
|
||||
@@ -177,9 +170,7 @@ void obs_display_remove_draw_callback(obs_display_t *display,
|
||||
pthread_mutex_unlock(&display->draw_callbacks_mutex);
|
||||
}
|
||||
|
||||
static inline bool render_display_begin(struct obs_display *display,
|
||||
uint32_t cx, uint32_t cy,
|
||||
bool update_color_space)
|
||||
static inline bool render_display_begin(struct obs_display *display, uint32_t cx, uint32_t cy, bool update_color_space)
|
||||
{
|
||||
struct vec4 clear_color;
|
||||
|
||||
@@ -200,8 +191,7 @@ static inline bool render_display_begin(struct obs_display *display,
|
||||
if (gs_get_color_space() == GS_CS_SRGB)
|
||||
vec4_from_rgba(&clear_color, display->background_color);
|
||||
else
|
||||
vec4_from_rgba_srgb(&clear_color,
|
||||
display->background_color);
|
||||
vec4_from_rgba_srgb(&clear_color, display->background_color);
|
||||
clear_color.w = 1.0f;
|
||||
|
||||
const bool use_clear_workaround = display->use_clear_workaround;
|
||||
@@ -219,11 +209,8 @@ static inline bool render_display_begin(struct obs_display *display,
|
||||
gs_set_viewport(0, 0, cx, cy);
|
||||
|
||||
if (use_clear_workaround) {
|
||||
gs_effect_t *const solid_effect =
|
||||
obs->video.solid_effect;
|
||||
gs_effect_set_vec4(gs_effect_get_param_by_name(
|
||||
solid_effect, "color"),
|
||||
&clear_color);
|
||||
gs_effect_t *const solid_effect = obs->video.solid_effect;
|
||||
gs_effect_set_vec4(gs_effect_get_param_by_name(solid_effect, "color"), &clear_color);
|
||||
while (gs_effect_loop(solid_effect, "Solid"))
|
||||
gs_draw_sprite(NULL, 0, cx, cy);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user