mirror of
https://github.com/JannisHeydemann/BoredOS.git
synced 2026-05-30 10:26:59 +00:00
FIX: Fixed framebuffer freeze upon screenshot
This commit is contained in:
@@ -842,19 +842,22 @@ void graphics_flip_buffer(void) {
|
||||
void graphics_copy_screenbuffer(uint32_t *dest) {
|
||||
if (!g_fb || !dest) return;
|
||||
|
||||
uint64_t rflags;
|
||||
asm volatile("pushfq; pop %0; cli" : "=r"(rflags));
|
||||
int sw = g_fb->width;
|
||||
int sh = g_fb->height;
|
||||
extern uint64_t wm_lock_acquire(void);
|
||||
extern void wm_lock_release(uint64_t);
|
||||
uint64_t rflags = wm_lock_acquire();
|
||||
|
||||
int sw = (int)g_fb->width;
|
||||
int sh = (int)g_fb->height;
|
||||
|
||||
// Copy the internal back object to the dest directly
|
||||
// Copy from the composition back buffer
|
||||
for (int y = 0; y < sh; y++) {
|
||||
uint32_t *src_row = &g_back_buffer[y * sw];
|
||||
for (int x = 0; x < sw; x++) {
|
||||
dest[y * sw + x] = src_row[x];
|
||||
}
|
||||
}
|
||||
asm volatile("push %0; popfq" : : "r"(rflags));
|
||||
|
||||
wm_lock_release(rflags);
|
||||
}
|
||||
|
||||
void graphics_set_clipping(int x, int y, int w, int h) {
|
||||
|
||||
Reference in New Issue
Block a user