From 94a22bff6a5f045f531a0ec8927dab6ce1e78871 Mon Sep 17 00:00:00 2001 From: Carlos Aragones <> Date: Tue, 15 Sep 2020 13:39:55 +0200 Subject: [PATCH] added mfb_update_ex - MacOS X - Cocoa version (I cannot test it!!!) --- src/macosx/MacMiniFB.m | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/src/macosx/MacMiniFB.m b/src/macosx/MacMiniFB.m index 823a606..10a3907 100644 --- a/src/macosx/MacMiniFB.m +++ b/src/macosx/MacMiniFB.m @@ -264,6 +264,20 @@ mfb_update_ex(struct mfb_window *window, void *buffer, unsigned width, unsigned memcpy(window_data->draw_buffer, buffer, window_data->buffer_stride * window_data->buffer_height); #else + if(window_data->buffer_width != width || window_data->buffer_height != height) { + float deltaX = (float) width / (float) window_data->buffer_width; + float deltaY = (float) height / (float) window_data->buffer_height; + + window_data->dst_offset_x *= deltaX; + window_data->dst_offset_y *= deltaY; + window_data->dst_width *= deltaX; + window_data->dst_height *= deltaY; + + window_data->buffer_width = width; + window_data->buffer_stride = width * 4; + window_data->buffer_height = height; + } + window_data->draw_buffer = buffer; #endif