mirror of
https://github.com/memononen/nanovg
synced 2026-09-26 16:19:07 +03:00
Merge pull request #677 from chentong-net/iphone-png-conversion-in-mem
Some checks are pending
CI / build (ubuntu-latest) (push) Waiting to run
Some checks are pending
CI / build (ubuntu-latest) (push) Waiting to run
Fix iPhone PNG color issues when loading images from memory in NanoVG
This commit is contained in:
commit
ce3bf745eb
1 changed files with 2 additions and 0 deletions
|
|
@ -814,6 +814,8 @@ int nvgCreateImage(NVGcontext* ctx, const char* filename, int imageFlags)
|
||||||
int nvgCreateImageMem(NVGcontext* ctx, int imageFlags, unsigned char* data, int ndata)
|
int nvgCreateImageMem(NVGcontext* ctx, int imageFlags, unsigned char* data, int ndata)
|
||||||
{
|
{
|
||||||
int w, h, n, image;
|
int w, h, n, image;
|
||||||
|
stbi_set_unpremultiply_on_load(1);
|
||||||
|
stbi_convert_iphone_png_to_rgb(1);
|
||||||
unsigned char* img = stbi_load_from_memory(data, ndata, &w, &h, &n, 4);
|
unsigned char* img = stbi_load_from_memory(data, ndata, &w, &h, &n, 4);
|
||||||
if (img == NULL) {
|
if (img == NULL) {
|
||||||
// printf("Failed to load %s - %s\n", filename, stbi_failure_reason());
|
// printf("Failed to load %s - %s\n", filename, stbi_failure_reason());
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue