Skip to content

Commit 04c5dc4

Browse files
committed
REVIEWED: PR #5674
1 parent bca4f83 commit 04c5dc4

File tree

2 files changed

+14
-17
lines changed

2 files changed

+14
-17
lines changed

src/external/rlsw.h

Lines changed: 9 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -671,6 +671,7 @@ SWAPI void swClose(void);
671671
SWAPI bool swResize(int w, int h);
672672
SWAPI void swReadPixels(int x, int y, int w, int h, SWformat format, SWtype type, void *pixels);
673673
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);
674+
SWAPI void *swGetColorBuffer(int *width, int *height); // Restored for ESP-IDF compatibility
674675

675676
SWAPI void swEnable(SWstate state);
676677
SWAPI void swDisable(SWstate state);
@@ -689,7 +690,6 @@ SWAPI void swClear(uint32_t bitmask);
689690
SWAPI void swBlendFunc(SWfactor sfactor, SWfactor dfactor);
690691
SWAPI void swPolygonMode(SWpoly mode);
691692
SWAPI void swCullFace(SWface face);
692-
SWAPI void *swGetColorBuffer(int *width, int *height); // Restored for ESP-IDF compatibility
693693

694694
SWAPI void swPointSize(float size);
695695
SWAPI void swLineWidth(float width);
@@ -3952,6 +3952,14 @@ void swBlitPixels(int xDst, int yDst, int wDst, int hDst, int xSrc, int ySrc, in
39523952
}
39533953
}
39543954

3955+
// Get framefuffer pixel data pointer and size
3956+
void *swGetColorBuffer(int *width, int *height)
3957+
{
3958+
if (width != NULL) *width = RLSW.framebuffer.color->width;
3959+
if (height != NULL) *height = RLSW.framebuffer.color->height;
3960+
return RLSW.framebuffer.color->pixels;
3961+
}
3962+
39553963
void swEnable(SWstate state)
39563964
{
39573965
switch (state)
@@ -4201,15 +4209,6 @@ void swCullFace(SWface face)
42014209
RLSW.cullFace = face;
42024210
}
42034211

4204-
// Get direct pointer to the default framebuffer's pixel data
4205-
// Restored for ESP-IDF compatibility - removed in Raylib 6.0 PR #5655
4206-
void *swGetColorBuffer(int *width, int *height)
4207-
{
4208-
if (width) *width = RLSW.colorBuffer->width;
4209-
if (height) *height = RLSW.colorBuffer->height;
4210-
return RLSW.colorBuffer->pixels;
4211-
}
4212-
42134212
void swPointSize(float size)
42144213
{
42154214
RLSW.pointRadius = floorf(size*0.5f);

src/rcore.c

Lines changed: 5 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -683,13 +683,11 @@ void InitWindow(int width, int height, const char *title)
683683
return;
684684
}
685685

686-
// FIX: Initialize render dimensions for embedded platforms
687-
// On desktop platforms (GLFW, SDL, etc.), CORE.Window.render.width/height are
688-
// set during window creation. On embedded platforms with no window manager,
689-
// InitPlatform() doesn't set these values, so we initialize them here from
690-
// the screen dimensions (which are set from the InitWindow parameters).
691-
// This fix is required for embedded platforms.
692-
if (CORE.Window.render.width == 0 || CORE.Window.render.height == 0)
686+
// Initialize render dimensions for embedded platforms
687+
// NOTE: On desktop platforms (GLFW, SDL, etc.), CORE.Window.render.width/height are set during window creation
688+
// On embedded platforms with no window manager, InitPlatform() doesn't set these values, so they should be initialized
689+
// here from screen dimensions (which are set from the InitWindow parameters)
690+
if ((CORE.Window.render.width == 0) || (CORE.Window.render.height == 0))
693691
{
694692
CORE.Window.render.width = CORE.Window.screen.width;
695693
CORE.Window.render.height = CORE.Window.screen.height;

0 commit comments

Comments
 (0)