win-capture: Don't draw cursor if outside area
parent
d6e98829ca
commit
d3abdf39a2
|
@ -188,15 +188,20 @@ void cursor_capture(struct cursor_data *data)
|
|||
}
|
||||
|
||||
void cursor_draw(struct cursor_data *data, long x_offset, long y_offset,
|
||||
float x_scale, float y_scale)
|
||||
float x_scale, float y_scale, long width, long height)
|
||||
{
|
||||
long x = data->cursor_pos.x + x_offset - data->x_hotspot;
|
||||
long y = data->cursor_pos.y + y_offset - data->y_hotspot;
|
||||
long x = data->cursor_pos.x + x_offset;
|
||||
long y = data->cursor_pos.y + y_offset;
|
||||
long x_draw = x - data->x_hotspot;
|
||||
long y_draw = y - data->y_hotspot;
|
||||
|
||||
if (x < 0 || x > width || y < 0 || y > height)
|
||||
return;
|
||||
|
||||
if (data->visible && !!data->texture) {
|
||||
gs_matrix_push();
|
||||
gs_matrix_scale3f(x_scale, y_scale, 1.0f);
|
||||
obs_source_draw(data->texture, x, y, 0, 0, false);
|
||||
obs_source_draw(data->texture, x_draw, y_draw, 0, 0, false);
|
||||
gs_matrix_pop();
|
||||
}
|
||||
}
|
||||
|
|
|
@ -13,5 +13,5 @@ struct cursor_data {
|
|||
|
||||
extern void cursor_capture(struct cursor_data *data);
|
||||
extern void cursor_draw(struct cursor_data *data, long x_offset, long y_offset,
|
||||
float x_scale, float y_scale);
|
||||
float x_scale, float y_scale, long width, long height);
|
||||
extern void cursor_data_free(struct cursor_data *data);
|
||||
|
|
|
@ -982,7 +982,9 @@ static inline void game_capture_render_cursor(struct game_capture *gc)
|
|||
float y_scale = (float)gc->global_hook_info->cy /
|
||||
(float)gc->global_hook_info->base_cy;
|
||||
|
||||
cursor_draw(&gc->cursor_data, -p.x, -p.y, x_scale, y_scale);
|
||||
cursor_draw(&gc->cursor_data, -p.x, -p.y, x_scale, y_scale,
|
||||
gc->global_hook_info->base_cx,
|
||||
gc->global_hook_info->base_cy);
|
||||
}
|
||||
|
||||
static void game_capture_render(void *data, gs_effect_t *effect)
|
||||
|
|
Loading…
Reference in New Issue