-
Notifications
You must be signed in to change notification settings - Fork 640
Fix nk_font_bake_convert() for big-endian machines #758
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: master
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Please remove the binary file. |
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -17230,7 +17230,7 @@ nk_font_bake_convert(void *out_memory, int img_width, int img_height, | |
const void *in_memory) | ||
{ | ||
int n = 0; | ||
nk_rune *dst; | ||
nk_byte *dst; | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Thanks a lot for the update. Would you mind making this change in the src destroy? We use paq.sh to combine the files, so wouldn't want to lose your changes. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Thanks, I will do the needed changes today or tomorrow and I'll ping you back. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I tested the changes on a little endian machine, the conversion still works. I added the changes to the src directory as well; should I remove them from |
||
const nk_byte *src; | ||
|
||
NK_ASSERT(out_memory); | ||
|
@@ -17239,10 +17239,14 @@ nk_font_bake_convert(void *out_memory, int img_width, int img_height, | |
NK_ASSERT(img_height); | ||
if (!out_memory || !in_memory || !img_height || !img_width) return; | ||
|
||
dst = (nk_rune*)out_memory; | ||
dst = (nk_byte*)out_memory; | ||
src = (const nk_byte*)in_memory; | ||
for (n = (int)(img_width * img_height); n > 0; n--) | ||
*dst++ = ((nk_rune)(*src++) << 24) | 0x00FFFFFF; | ||
for (n = (int)(img_width * img_height); n > 0; n--) { | ||
*dst++ = 0xff; /* r */ | ||
*dst++ = 0xff; /* g */ | ||
*dst++ = 0xff; /* b */ | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. It might be faster to call |
||
*dst++ = *src++; /* a */ | ||
|
||
} | ||
} | ||
|
||
/* ------------------------------------------------------------- | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please remove the binary file.