mirror of
https://github.com/jorio/Pomme.git
synced 2024-06-10 06:29:31 +00:00
Graphics big-endian compatibility
This commit is contained in:
parent
e567db5327
commit
543b50c1eb
|
@ -394,7 +394,7 @@ static void _FillRect(const int left, const int top, const int right, const int
|
||||||
}
|
}
|
||||||
curPort->DamageRegion(clippedDstRect);
|
curPort->DamageRegion(clippedDstRect);
|
||||||
|
|
||||||
fillColor = ByteswapScalar(fillColor); // convert to big-endian
|
fillColor = PackU32BE(&fillColor); // convert to big-endian
|
||||||
|
|
||||||
UInt32* dst = curPort->pixels.GetPtr(clippedDstRect.left, clippedDstRect.top);
|
UInt32* dst = curPort->pixels.GetPtr(clippedDstRect.left, clippedDstRect.top);
|
||||||
|
|
||||||
|
@ -420,7 +420,7 @@ void EraseRect(const struct Rect* r)
|
||||||
|
|
||||||
void LineTo(short x1, short y1)
|
void LineTo(short x1, short y1)
|
||||||
{
|
{
|
||||||
auto color = ByteswapScalar(penFG);
|
UInt32 color = PackU32BE(&penFG);
|
||||||
|
|
||||||
auto offx = curPort->port.portRect.left;
|
auto offx = curPort->port.portRect.left;
|
||||||
auto offy = curPort->port.portRect.top;
|
auto offy = curPort->port.portRect.top;
|
||||||
|
@ -455,7 +455,8 @@ void LineTo(short x1, short y1)
|
||||||
|
|
||||||
void FrameRect(const Rect* r)
|
void FrameRect(const Rect* r)
|
||||||
{
|
{
|
||||||
auto color = ByteswapScalar(penFG);
|
UInt32 color = PackU32BE(&penFG);
|
||||||
|
|
||||||
auto& pm = curPort->pixels;
|
auto& pm = curPort->pixels;
|
||||||
auto offx = curPort->port.portRect.left;
|
auto offx = curPort->port.portRect.left;
|
||||||
auto offy = curPort->port.portRect.top;
|
auto offy = curPort->port.portRect.top;
|
||||||
|
@ -643,7 +644,7 @@ void DrawStringC(const char* cstr)
|
||||||
|
|
||||||
void DrawChar(char c)
|
void DrawChar(char c)
|
||||||
{
|
{
|
||||||
UInt32 fg = ByteswapScalar(penFG);
|
UInt32 fg = PackU32BE(&penFG);
|
||||||
|
|
||||||
auto& glyph = SysFont::GetGlyph(c);
|
auto& glyph = SysFont::GetGlyph(c);
|
||||||
|
|
||||||
|
|
|
@ -29,9 +29,9 @@ static Handle Get4bitIconAsARGB(Handle colorIcon, Ptr bwMask, int width)
|
||||||
if (!bwMask)
|
if (!bwMask)
|
||||||
;
|
;
|
||||||
else if (width == 32)
|
else if (width == 32)
|
||||||
scanlineMask = Byteswap32(bwMask + y*4);
|
scanlineMask = UnpackU32BE(bwMask + y*4);
|
||||||
else if (width == 16)
|
else if (width == 16)
|
||||||
scanlineMask = Byteswap16(bwMask + y*2);
|
scanlineMask = UnpackU16BE(bwMask + y*2);
|
||||||
|
|
||||||
for (int x = 0; x < width; x++)
|
for (int x = 0; x < width; x++)
|
||||||
{
|
{
|
||||||
|
@ -73,9 +73,9 @@ static Handle Get8bitIconAsARGB(Handle colorIcon, Ptr bwMask, int width)
|
||||||
if (!bwMask)
|
if (!bwMask)
|
||||||
;
|
;
|
||||||
else if (width == 32)
|
else if (width == 32)
|
||||||
scanlineMask = Byteswap32(bwMask + y*4);
|
scanlineMask = UnpackU32BE(bwMask + y*4);
|
||||||
else if (width == 16)
|
else if (width == 16)
|
||||||
scanlineMask = Byteswap16(bwMask + y*2);
|
scanlineMask = UnpackU16BE(bwMask + y*2);
|
||||||
|
|
||||||
for (int x = 0; x < width; x++)
|
for (int x = 0; x < width; x++)
|
||||||
{
|
{
|
||||||
|
|
|
@ -191,6 +191,12 @@ static inline int32_t UnpackI32BEInPlace(void* data) { return (int32_t) UnpackU3
|
||||||
static inline int16_t UnpackI16LEInPlace(void* data) { return (int16_t) UnpackU16LEInPlace(data); }
|
static inline int16_t UnpackI16LEInPlace(void* data) { return (int16_t) UnpackU16LEInPlace(data); }
|
||||||
static inline int32_t UnpackI32LEInPlace(void* data) { return (int32_t) UnpackU32LEInPlace(data); }
|
static inline int32_t UnpackI32LEInPlace(void* data) { return (int32_t) UnpackU32LEInPlace(data); }
|
||||||
|
|
||||||
|
//-----------------------------------------------------------------------------
|
||||||
|
// Pack variants. Functionally identical to unpack, but with a different intent:
|
||||||
|
// convert a native scalar to a specific endianness.
|
||||||
|
|
||||||
|
static inline uint32_t PackU32BE(const void *nativeEndianData) { return UnpackU32BE(nativeEndianData); }
|
||||||
|
|
||||||
#ifdef __cplusplus
|
#ifdef __cplusplus
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
Loading…
Reference in New Issue
Block a user