clang-format: Apply formatting
Code submissions have continually suffered from formatting inconsistencies that constantly have to be addressed. Using clang-format simplifies this by making code formatting more consistent, and allows automation of the code formatting so that maintainers can focus more on the code itself instead of code formatting.
This commit is contained in:
@@ -6,12 +6,12 @@
|
||||
static inline void init_textures(struct dc_capture *capture)
|
||||
{
|
||||
if (capture->compatibility)
|
||||
capture->texture = gs_texture_create(
|
||||
capture->width, capture->height,
|
||||
GS_BGRA, 1, NULL, GS_DYNAMIC);
|
||||
capture->texture = gs_texture_create(capture->width,
|
||||
capture->height, GS_BGRA,
|
||||
1, NULL, GS_DYNAMIC);
|
||||
else
|
||||
capture->texture = gs_texture_create_gdi(
|
||||
capture->width, capture->height);
|
||||
capture->texture =
|
||||
gs_texture_create_gdi(capture->width, capture->height);
|
||||
|
||||
if (!capture->texture) {
|
||||
blog(LOG_WARNING, "[dc_capture_init] Failed to "
|
||||
@@ -22,16 +22,15 @@ static inline void init_textures(struct dc_capture *capture)
|
||||
capture->valid = true;
|
||||
}
|
||||
|
||||
void dc_capture_init(struct dc_capture *capture, int x, int y,
|
||||
uint32_t width, uint32_t height, bool cursor,
|
||||
bool compatibility)
|
||||
void dc_capture_init(struct dc_capture *capture, int x, int y, uint32_t width,
|
||||
uint32_t height, bool cursor, bool compatibility)
|
||||
{
|
||||
memset(capture, 0, sizeof(struct dc_capture));
|
||||
|
||||
capture->x = x;
|
||||
capture->y = y;
|
||||
capture->width = width;
|
||||
capture->height = height;
|
||||
capture->x = x;
|
||||
capture->y = y;
|
||||
capture->width = width;
|
||||
capture->height = height;
|
||||
capture->capture_cursor = cursor;
|
||||
|
||||
obs_enter_graphics();
|
||||
@@ -51,16 +50,16 @@ void dc_capture_init(struct dc_capture *capture, int x, int y,
|
||||
if (compatibility) {
|
||||
BITMAPINFO bi = {0};
|
||||
BITMAPINFOHEADER *bih = &bi.bmiHeader;
|
||||
bih->biSize = sizeof(BITMAPINFOHEADER);
|
||||
bih->biSize = sizeof(BITMAPINFOHEADER);
|
||||
bih->biBitCount = 32;
|
||||
bih->biWidth = width;
|
||||
bih->biHeight = height;
|
||||
bih->biPlanes = 1;
|
||||
bih->biWidth = width;
|
||||
bih->biHeight = height;
|
||||
bih->biPlanes = 1;
|
||||
|
||||
capture->hdc = CreateCompatibleDC(NULL);
|
||||
capture->bmp = CreateDIBSection(capture->hdc, &bi,
|
||||
DIB_RGB_COLORS, (void**)&capture->bits,
|
||||
NULL, 0);
|
||||
capture->bmp =
|
||||
CreateDIBSection(capture->hdc, &bi, DIB_RGB_COLORS,
|
||||
(void **)&capture->bits, NULL, 0);
|
||||
capture->old_bmp = SelectObject(capture->hdc, capture->bmp);
|
||||
}
|
||||
}
|
||||
@@ -82,10 +81,10 @@ void dc_capture_free(struct dc_capture *capture)
|
||||
|
||||
static void draw_cursor(struct dc_capture *capture, HDC hdc, HWND window)
|
||||
{
|
||||
HICON icon;
|
||||
ICONINFO ii;
|
||||
HICON icon;
|
||||
ICONINFO ii;
|
||||
CURSORINFO *ci = &capture->ci;
|
||||
POINT win_pos = {capture->x, capture->y};
|
||||
POINT win_pos = {capture->x, capture->y};
|
||||
|
||||
if (!(capture->ci.flags & CURSOR_SHOWING))
|
||||
return;
|
||||
@@ -103,8 +102,7 @@ static void draw_cursor(struct dc_capture *capture, HDC hdc, HWND window)
|
||||
pos.x = ci->ptScreenPos.x - (int)ii.xHotspot - win_pos.x;
|
||||
pos.y = ci->ptScreenPos.y - (int)ii.yHotspot - win_pos.y;
|
||||
|
||||
DrawIconEx(hdc, pos.x, pos.y, icon, 0, 0, 0, NULL,
|
||||
DI_NORMAL);
|
||||
DrawIconEx(hdc, pos.x, pos.y, icon, 0, 0, 0, NULL, DI_NORMAL);
|
||||
|
||||
DeleteObject(ii.hbmColor);
|
||||
DeleteObject(ii.hbmMask);
|
||||
@@ -127,8 +125,8 @@ static inline HDC dc_capture_get_dc(struct dc_capture *capture)
|
||||
static inline void dc_capture_release_dc(struct dc_capture *capture)
|
||||
{
|
||||
if (capture->compatibility) {
|
||||
gs_texture_set_image(capture->texture,
|
||||
capture->bits, capture->width*4, false);
|
||||
gs_texture_set_image(capture->texture, capture->bits,
|
||||
capture->width * 4, false);
|
||||
} else {
|
||||
gs_texture_release_dc(capture->texture);
|
||||
}
|
||||
@@ -148,14 +146,14 @@ void dc_capture_capture(struct dc_capture *capture, HWND window)
|
||||
hdc = dc_capture_get_dc(capture);
|
||||
if (!hdc) {
|
||||
blog(LOG_WARNING, "[capture_screen] Failed to get "
|
||||
"texture DC");
|
||||
"texture DC");
|
||||
return;
|
||||
}
|
||||
|
||||
hdc_target = GetDC(window);
|
||||
|
||||
BitBlt(hdc, 0, 0, capture->width, capture->height,
|
||||
hdc_target, capture->x, capture->y, SRCCOPY);
|
||||
BitBlt(hdc, 0, 0, capture->width, capture->height, hdc_target,
|
||||
capture->x, capture->y, SRCCOPY);
|
||||
|
||||
ReleaseDC(NULL, hdc_target);
|
||||
|
||||
@@ -169,10 +167,10 @@ void dc_capture_capture(struct dc_capture *capture, HWND window)
|
||||
|
||||
static void draw_texture(struct dc_capture *capture, gs_effect_t *effect)
|
||||
{
|
||||
gs_texture_t *texture = capture->texture;
|
||||
gs_technique_t *tech = gs_effect_get_technique(effect, "Draw");
|
||||
gs_eparam_t *image = gs_effect_get_param_by_name(effect, "image");
|
||||
size_t passes;
|
||||
gs_texture_t *texture = capture->texture;
|
||||
gs_technique_t *tech = gs_effect_get_technique(effect, "Draw");
|
||||
gs_eparam_t *image = gs_effect_get_param_by_name(effect, "image");
|
||||
size_t passes;
|
||||
|
||||
gs_effect_set_texture(image, texture);
|
||||
|
||||
|
Reference in New Issue
Block a user