Fix bugs on Sun (hopefully)
This commit is contained in:
parent
df2e2ce792
commit
82566dabd2
2 changed files with 26 additions and 5 deletions
|
@ -116,9 +116,15 @@ void RenderBackend_UploadSurface(RenderBackend_Surface *surface, const unsigned
|
|||
for (size_t x = 0; x < width; ++x) {
|
||||
int srcr = x * 3;
|
||||
int dstr = x * 4;
|
||||
surface->pixels[dstl + dstr + 0] = pixels[srcl + srcr + 0];
|
||||
#if __BYTE_ORDER__ == __ORDER_LITTLE_ENDIAN__
|
||||
surface->pixels[dstl + dstr + 0] = pixels[srcl + srcr + 2];
|
||||
surface->pixels[dstl + dstr + 1] = pixels[srcl + srcr + 1];
|
||||
surface->pixels[dstl + dstr + 2] = pixels[srcl + srcr + 2];
|
||||
surface->pixels[dstl + dstr + 2] = pixels[srcl + srcr + 0];
|
||||
#else
|
||||
surface->pixels[dstl + dstr + 1] = pixels[srcl + srcr + 0];
|
||||
surface->pixels[dstl + dstr + 2] = pixels[srcl + srcr + 1];
|
||||
surface->pixels[dstl + dstr + 3] = pixels[srcl + srcr + 2];
|
||||
#endif
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -180,11 +186,19 @@ ATTRIBUTE_HOT void RenderBackend_Blit(RenderBackend_Surface *source_surface, con
|
|||
}
|
||||
else
|
||||
{
|
||||
#if __BYTE_ORDER__ == __ORDER_LITTLE_ENDIAN__
|
||||
*destination_pointer++ = *source_pointer++;
|
||||
*destination_pointer++ = *source_pointer++;
|
||||
*destination_pointer++ = *source_pointer++;
|
||||
destination_pointer++;
|
||||
source_pointer++;
|
||||
#else
|
||||
destination_pointer++;
|
||||
source_pointer++;
|
||||
*destination_pointer++ = *source_pointer++;
|
||||
*destination_pointer++ = *source_pointer++;
|
||||
*destination_pointer++ = *source_pointer++;
|
||||
#endif
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -244,10 +258,17 @@ ATTRIBUTE_HOT void RenderBackend_ColourFill(RenderBackend_Surface *surface, cons
|
|||
|
||||
for (long i = 0; i < rect_clamped.right - rect_clamped.left; ++i)
|
||||
{
|
||||
*destination_pointer++ = red;
|
||||
*destination_pointer++ = green;
|
||||
#if __BYTE_ORDER__ == __ORDER_LITTLE_ENDIAN__
|
||||
*destination_pointer++ = blue;
|
||||
*destination_pointer++ = green;
|
||||
*destination_pointer++ = red;
|
||||
destination_pointer++;
|
||||
#else
|
||||
destination_pointer++;
|
||||
*destination_pointer++ = blue;
|
||||
*destination_pointer++ = green;
|
||||
*destination_pointer++ = red;
|
||||
#endif
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -53,7 +53,7 @@ void createFramebuffer() {
|
|||
&seginfo, screenWidth, screenHeight);
|
||||
seginfo.shmid = shmget(IPC_PRIVATE,
|
||||
framebufferImage->bytes_per_line * framebufferImage->height,
|
||||
IPC_CREAT);
|
||||
IPC_CREAT | 0777);
|
||||
seginfo.shmaddr = xfriendlyFB = framebufferImage->data = (char*)shmat(seginfo.shmid, NULL, 0);
|
||||
XShmAttach(xDisplay, &seginfo);
|
||||
} else {
|
||||
|
|
Loading…
Add table
Reference in a new issue