0
0
mirror of https://github.com/obsproject/obs-studio.git synced 2024-09-20 21:13:04 +02:00
obs-studio/plugins/win-capture/cursor-capture.h
jp9000 81ab13a2a4 win-capture: Cache cursor textures to prevent reallocation
Whenever a cursor is captured and the cursor icon changes, it creates a
new texture.  This isn't particularly optimal, so instead just store a
cache of cursor textures (based on size), and make the textures dynamic.
Doing this will prevent unnecessary texture reallocation.
2016-11-03 09:23:25 -07:00

29 lines
781 B
C

#pragma once
#include <stdint.h>
struct cached_cursor {
gs_texture_t *texture;
uint32_t cx;
uint32_t cy;
};
struct cursor_data {
gs_texture_t *texture;
HCURSOR current_cursor;
POINT cursor_pos;
long x_hotspot;
long y_hotspot;
bool visible;
uint32_t last_cx;
uint32_t last_cy;
DARRAY(struct cached_cursor) cached_textures;
};
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, long width, long height);
extern void cursor_data_free(struct cursor_data *data);