remove swGetColorBuffer and tweak DRM
This commit is contained in:
parent
84181dddf0
commit
6ff1960727
21
src/external/rlsw.h
vendored
21
src/external/rlsw.h
vendored
|
|
@ -531,7 +531,6 @@ SWAPI void swClose(void);
|
|||
SWAPI bool swResizeFramebuffer(int w, int h);
|
||||
SWAPI void swCopyFramebuffer(int x, int y, int w, int h, SWformat format, SWtype type, void *pixels);
|
||||
SWAPI void swBlitFramebuffer(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 *w, int *h);
|
||||
|
||||
SWAPI void swEnable(SWstate state);
|
||||
SWAPI void swDisable(SWstate state);
|
||||
|
|
@ -3671,11 +3670,6 @@ void swBlitFramebuffer(int xDst, int yDst, int wDst, int hDst, int xSrc, int ySr
|
|||
{
|
||||
sw_pixelformat_t pFormat = (sw_pixelformat_t)sw_get_pixel_format(format, type);
|
||||
|
||||
if (xDst == xSrc && yDst == ySrc && wDst == wSrc && hDst == hSrc)
|
||||
{
|
||||
swCopyFramebuffer(xSrc, ySrc, wSrc, hSrc, format, type, pixels);
|
||||
}
|
||||
|
||||
if (wSrc <= 0) { RLSW.errCode = SW_INVALID_VALUE; return; }
|
||||
if (hSrc <= 0) { RLSW.errCode = SW_INVALID_VALUE; return; }
|
||||
|
||||
|
|
@ -3685,6 +3679,13 @@ void swBlitFramebuffer(int xDst, int yDst, int wDst, int hDst, int xSrc, int ySr
|
|||
xSrc = sw_clampi(xSrc, 0, wSrc);
|
||||
ySrc = sw_clampi(ySrc, 0, hSrc);
|
||||
|
||||
// Check if the sizes are identical after clamping the source to avoid unexpected issues
|
||||
// REVIEW: This repeats the operations if true, so we could make a copy function without these checks
|
||||
if (xDst == xSrc && yDst == ySrc && wDst == wSrc && hDst == hSrc)
|
||||
{
|
||||
swCopyFramebuffer(xSrc, ySrc, wSrc, hSrc, format, type, pixels);
|
||||
}
|
||||
|
||||
switch (pFormat)
|
||||
{
|
||||
case SW_PIXELFORMAT_UNCOMPRESSED_GRAYSCALE: sw_framebuffer_blit_to_GRAYALPHA(xDst, yDst, wDst, hDst, xSrc, ySrc, wSrc, hSrc, (uint8_t *)pixels); break;
|
||||
|
|
@ -3707,14 +3708,6 @@ void swBlitFramebuffer(int xDst, int yDst, int wDst, int hDst, int xSrc, int ySr
|
|||
}
|
||||
}
|
||||
|
||||
void *swGetColorBuffer(int *w, int *h)
|
||||
{
|
||||
if (w) *w = RLSW.framebuffer.width;
|
||||
if (h) *h = RLSW.framebuffer.height;
|
||||
|
||||
return (void *)RLSW.framebuffer.pixels->color;
|
||||
}
|
||||
|
||||
void swEnable(SWstate state)
|
||||
{
|
||||
switch (state)
|
||||
|
|
|
|||
|
|
@ -824,15 +824,6 @@ void SwapScreenBuffer(void)
|
|||
return;
|
||||
}
|
||||
|
||||
// Get the software rendered color buffer
|
||||
int bufferWidth = 0, bufferHeight = 0;
|
||||
void *colorBuffer = swGetColorBuffer(&bufferWidth, &bufferHeight);
|
||||
if (!colorBuffer)
|
||||
{
|
||||
TRACELOG(LOG_ERROR, "DISPLAY: Failed to get software color buffer");
|
||||
return;
|
||||
}
|
||||
|
||||
// Retrieving the dimensions of the display mode used
|
||||
drmModeModeInfo *mode = &platform.connector->modes[platform.modeIndex];
|
||||
uint32_t width = mode->hdisplay;
|
||||
|
|
@ -900,16 +891,8 @@ void SwapScreenBuffer(void)
|
|||
}
|
||||
|
||||
// Copy the software rendered buffer to the dumb buffer with scaling if needed
|
||||
if (bufferWidth == width && bufferHeight == height)
|
||||
{
|
||||
// Direct copy if sizes match
|
||||
swCopyFramebuffer(0, 0, bufferWidth, bufferHeight, SW_RGBA, SW_UNSIGNED_BYTE, dumbBuffer);
|
||||
}
|
||||
else
|
||||
{
|
||||
// Scale the software buffer to match the display mode
|
||||
swBlitFramebuffer(0, 0, width, height, 0, 0, bufferWidth, bufferHeight, SW_RGBA, SW_UNSIGNED_BYTE, dumbBuffer);
|
||||
}
|
||||
// NOTE: RLSW will make a simple copy if the dimensions match
|
||||
swBlitFramebuffer(0, 0, width, height, 0, 0, width, height, SW_RGBA, SW_UNSIGNED_BYTE, dumbBuffer);
|
||||
|
||||
// Unmap the buffer
|
||||
munmap(dumbBuffer, creq.size);
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user