Skip to content

Commit

Permalink
display: add display_get_current_framebuffer
Browse files Browse the repository at this point in the history
  • Loading branch information
snacchus authored and rasky committed Nov 18, 2024
1 parent a2c2f9f commit 253dbc9
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 0 deletions.
5 changes: 5 additions & 0 deletions include/display.h
Original file line number Diff line number Diff line change
Expand Up @@ -342,6 +342,11 @@ float display_get_delta_time(void);
*/
void display_set_fps_limit(float fps);

/**
* @brief Returns a surface that points to the framebuffer currently being shown on screen.
*/
surface_t display_get_current_framebuffer(void);

/** @cond */
__attribute__((deprecated("use display_get or display_try_get instead")))
static inline surface_t* display_lock(void) {
Expand Down
9 changes: 9 additions & 0 deletions src/display.c
Original file line number Diff line number Diff line change
Expand Up @@ -640,4 +640,13 @@ void display_set_fps_limit(float fps)
enable_interrupts();
}

surface_t display_get_current_framebuffer(void)
{
return surface_make_linear(
VirtualUncachedAddr(*VI_ORIGIN),
display_get_bitdepth() == 2 ? FMT_RGBA16 : FMT_RGBA32,
display_get_width(),
display_get_height());
}

extern inline void vi_write_config(const vi_config_t* config);

0 comments on commit 253dbc9

Please sign in to comment.