From 280131585e07b6d5c8438af258b7de0afeff8266 Mon Sep 17 00:00:00 2001 From: dec05eba Date: Wed, 20 May 2026 08:10:47 +0200 Subject: plugin: add is_damaged and clear_damage --- plugin/examples/hello_triangle/triangle.c | 10 ++++++++++ plugin/plugin.h | 6 ++++++ 2 files changed, 16 insertions(+) (limited to 'plugin') diff --git a/plugin/examples/hello_triangle/triangle.c b/plugin/examples/hello_triangle/triangle.c index 194cf92..fd27a3d 100644 --- a/plugin/examples/hello_triangle/triangle.c +++ b/plugin/examples/hello_triangle/triangle.c @@ -62,6 +62,14 @@ static void draw(const gsr_plugin_draw_params *params, void *userdata) { ++triangle->counter; } +static bool is_damaged(void *userdata) { + return true; +} + +static void clear_damage(void *userdata) { + +} + bool gsr_plugin_init(const gsr_plugin_init_params *params, gsr_plugin_init_return *ret) { Triangle *triangle = calloc(1, sizeof(Triangle)); if(!triangle) @@ -98,6 +106,8 @@ bool gsr_plugin_init(const gsr_plugin_init_params *params, gsr_plugin_init_retur ret->version = 1; ret->userdata = triangle; ret->draw = draw; + ret->is_damaged = is_damaged; + ret->clear_damage = clear_damage; return true; } diff --git a/plugin/plugin.h b/plugin/plugin.h index 902d1d7..769a629 100644 --- a/plugin/plugin.h +++ b/plugin/plugin.h @@ -43,6 +43,12 @@ typedef struct { /* Optional, called when the plugin is expected to draw something to the current framebuffer */ void (*draw)(const gsr_plugin_draw_params *params, void *userdata); + /* Optional, returns false if this function is NULL. If this function is defined then this should return true + if there is an update visually that the plugin wants to display. This is useful when used with the "content" framerate mode + which only captures a frame when the frame has changed */ + bool (*is_damaged)(void *userdata); + /* Optional */ + void (*clear_damage)(void *userdata); } gsr_plugin_init_return; /* The plugin is expected to implement these functions and export them: */ -- cgit v1.2.3