From 04c5dc449331bcb9ee27ff1fadae2ea4343f34ca Mon Sep 17 00:00:00 2001 From: Ray Date: Thu, 19 Mar 2026 23:35:18 +0100 Subject: [PATCH] REVIEWED: PR #5674 --- src/external/rlsw.h | 19 +++++++++---------- src/rcore.c | 12 +++++------- 2 files changed, 14 insertions(+), 17 deletions(-) diff --git a/src/external/rlsw.h b/src/external/rlsw.h index 2be21def5..9d56ce55d 100644 --- a/src/external/rlsw.h +++ b/src/external/rlsw.h @@ -671,6 +671,7 @@ SWAPI void swClose(void); SWAPI bool swResize(int w, int h); SWAPI void swReadPixels(int x, int y, int w, int h, SWformat format, SWtype type, void *pixels); SWAPI void swBlitPixels(int xDst, int yDst, int wDst, int hDst, int xSrc, int ySrc, int wSrc, int hSrc, SWformat format, SWtype type, void *pixels); +SWAPI void *swGetColorBuffer(int *width, int *height); // Restored for ESP-IDF compatibility SWAPI void swEnable(SWstate state); SWAPI void swDisable(SWstate state); @@ -689,7 +690,6 @@ SWAPI void swClear(uint32_t bitmask); SWAPI void swBlendFunc(SWfactor sfactor, SWfactor dfactor); SWAPI void swPolygonMode(SWpoly mode); SWAPI void swCullFace(SWface face); -SWAPI void *swGetColorBuffer(int *width, int *height); // Restored for ESP-IDF compatibility SWAPI void swPointSize(float size); SWAPI void swLineWidth(float width); @@ -3952,6 +3952,14 @@ void swBlitPixels(int xDst, int yDst, int wDst, int hDst, int xSrc, int ySrc, in } } +// Get framefuffer pixel data pointer and size +void *swGetColorBuffer(int *width, int *height) +{ + if (width != NULL) *width = RLSW.framebuffer.color->width; + if (height != NULL) *height = RLSW.framebuffer.color->height; + return RLSW.framebuffer.color->pixels; +} + void swEnable(SWstate state) { switch (state) @@ -4201,15 +4209,6 @@ void swCullFace(SWface face) RLSW.cullFace = face; } -// Get direct pointer to the default framebuffer's pixel data -// Restored for ESP-IDF compatibility - removed in Raylib 6.0 PR #5655 -void *swGetColorBuffer(int *width, int *height) -{ - if (width) *width = RLSW.colorBuffer->width; - if (height) *height = RLSW.colorBuffer->height; - return RLSW.colorBuffer->pixels; -} - void swPointSize(float size) { RLSW.pointRadius = floorf(size*0.5f); diff --git a/src/rcore.c b/src/rcore.c index 0bb32ba27..5cdc8aca1 100644 --- a/src/rcore.c +++ b/src/rcore.c @@ -683,13 +683,11 @@ void InitWindow(int width, int height, const char *title) return; } - // FIX: Initialize render dimensions for embedded platforms - // On desktop platforms (GLFW, SDL, etc.), CORE.Window.render.width/height are - // set during window creation. On embedded platforms with no window manager, - // InitPlatform() doesn't set these values, so we initialize them here from - // the screen dimensions (which are set from the InitWindow parameters). - // This fix is required for embedded platforms. - if (CORE.Window.render.width == 0 || CORE.Window.render.height == 0) + // Initialize render dimensions for embedded platforms + // NOTE: On desktop platforms (GLFW, SDL, etc.), CORE.Window.render.width/height are set during window creation + // On embedded platforms with no window manager, InitPlatform() doesn't set these values, so they should be initialized + // here from screen dimensions (which are set from the InitWindow parameters) + if ((CORE.Window.render.width == 0) || (CORE.Window.render.height == 0)) { CORE.Window.render.width = CORE.Window.screen.width; CORE.Window.render.height = CORE.Window.screen.height;