added mfb_update_ex - Linux - X11 version

This commit is contained in:
Carlos Aragones 2020-09-15 14:09:25 +02:00
parent 94a22bff6a
commit 8d68f620df

View File

@ -328,6 +328,18 @@ mfb_update(struct mfb_window *window, void *buffer) {
return STATE_INVALID_WINDOW; return STATE_INVALID_WINDOW;
} }
SWindowData *window_data = (SWindowData *) window;
mfb_update_ex(window, buffer, window_data->buffer_width, window_data->buffer_height);
}
///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
mfb_update_state
mfb_update_ex(struct mfb_window *window, void *buffer, unsigned width, unsigned height) {
if (window == 0x0) {
return STATE_INVALID_WINDOW;
}
SWindowData *window_data = (SWindowData *) window; SWindowData *window_data = (SWindowData *) window;
if (window_data->close) { if (window_data->close) {
destroy_window_data(window_data); destroy_window_data(window_data);
@ -340,6 +352,20 @@ mfb_update(struct mfb_window *window, void *buffer) {
SWindowData_X11 *window_data_x11 = (SWindowData_X11 *) window_data->specific; SWindowData_X11 *window_data_x11 = (SWindowData_X11 *) window_data->specific;
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;
}
if (window_data->buffer_width != window_data->dst_width || window_data->buffer_height != window_data->dst_height) { if (window_data->buffer_width != window_data->dst_width || window_data->buffer_height != window_data->dst_height) {
if (window_data_x11->image_scaler_width != window_data->dst_width || window_data_x11->image_scaler_height != window_data->dst_height) { if (window_data_x11->image_scaler_width != window_data->dst_width || window_data_x11->image_scaler_height != window_data->dst_height) {
if (window_data_x11->image_scaler != 0x0) { if (window_data_x11->image_scaler != 0x0) {