Big endian define garbage
This commit is contained in:
parent
21323b964c
commit
962bb9d477
1 changed files with 3 additions and 7 deletions
|
@ -14,10 +14,6 @@
|
||||||
#define MIN(a, b) ((a) < (b) ? (a) : (b))
|
#define MIN(a, b) ((a) < (b) ? (a) : (b))
|
||||||
#define MAX(a, b) ((a) > (b) ? (a) : (b))
|
#define MAX(a, b) ((a) > (b) ? (a) : (b))
|
||||||
|
|
||||||
#ifndef __BYTE_ORDER__
|
|
||||||
#define __BYTE_ORDER__ __ORDER_BIG_ENDIAN__
|
|
||||||
#endif
|
|
||||||
|
|
||||||
typedef struct RenderBackend_Surface
|
typedef struct RenderBackend_Surface
|
||||||
{
|
{
|
||||||
unsigned char *pixels;
|
unsigned char *pixels;
|
||||||
|
@ -120,7 +116,7 @@ void RenderBackend_UploadSurface(RenderBackend_Surface *surface, const unsigned
|
||||||
for (size_t x = 0; x < width; ++x) {
|
for (size_t x = 0; x < width; ++x) {
|
||||||
int srcr = x * 3;
|
int srcr = x * 3;
|
||||||
int dstr = x * 4;
|
int dstr = x * 4;
|
||||||
#if __BYTE_ORDER__ == __ORDER_LITTLE_ENDIAN__
|
#ifdef LITTLE_ENDIAN
|
||||||
surface->pixels[dstl + dstr + 0] = pixels[srcl + srcr + 2];
|
surface->pixels[dstl + dstr + 0] = pixels[srcl + srcr + 2];
|
||||||
surface->pixels[dstl + dstr + 1] = pixels[srcl + srcr + 1];
|
surface->pixels[dstl + dstr + 1] = pixels[srcl + srcr + 1];
|
||||||
surface->pixels[dstl + dstr + 2] = pixels[srcl + srcr + 0];
|
surface->pixels[dstl + dstr + 2] = pixels[srcl + srcr + 0];
|
||||||
|
@ -190,7 +186,7 @@ ATTRIBUTE_HOT void RenderBackend_Blit(RenderBackend_Surface *source_surface, con
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
#if __BYTE_ORDER__ == __ORDER_LITTLE_ENDIAN__
|
#ifdef LITTLE_ENDIAN
|
||||||
*destination_pointer++ = *source_pointer++;
|
*destination_pointer++ = *source_pointer++;
|
||||||
*destination_pointer++ = *source_pointer++;
|
*destination_pointer++ = *source_pointer++;
|
||||||
*destination_pointer++ = *source_pointer++;
|
*destination_pointer++ = *source_pointer++;
|
||||||
|
@ -262,7 +258,7 @@ ATTRIBUTE_HOT void RenderBackend_ColourFill(RenderBackend_Surface *surface, cons
|
||||||
|
|
||||||
for (long i = 0; i < rect_clamped.right - rect_clamped.left; ++i)
|
for (long i = 0; i < rect_clamped.right - rect_clamped.left; ++i)
|
||||||
{
|
{
|
||||||
#if __BYTE_ORDER__ == __ORDER_LITTLE_ENDIAN__
|
#ifdef LITTLE_ENDIAN
|
||||||
*destination_pointer++ = blue;
|
*destination_pointer++ = blue;
|
||||||
*destination_pointer++ = green;
|
*destination_pointer++ = green;
|
||||||
*destination_pointer++ = red;
|
*destination_pointer++ = red;
|
||||||
|
|
Loading…
Add table
Reference in a new issue