Commit 61707393 authored by Hanspeter Portner's avatar Hanspeter Portner

Squashed 'subprojects/d2tk/' changes from b145662..e7d28dd

e7d28dd backend: load images relative to bundle_path.

git-subtree-dir: subprojects/d2tk
git-subtree-split: e7d28dd34687a815e893ae7e0a228f378d4efc86
parent eb521cfa
......@@ -655,10 +655,14 @@ d2tk_cairo_process(void *data, d2tk_core_t *core, const d2tk_com_t *com,
if(!*sprite)
{
char *img_path = NULL;
assert(asprintf(&img_path, "%s%s", backend->bundle_path, body->path) != -1);
assert(img_path);
int W, H, N;
stbi_set_unpremultiply_on_load(1);
stbi_convert_iphone_png_to_rgb(1);
uint8_t *pixels = stbi_load(body->path, &W, &H, &N, 4);
uint8_t *pixels = stbi_load(img_path, &W, &H, &N, 4);
assert(pixels );
// bitswap and premultiply pixel data
......
......@@ -729,7 +729,11 @@ d2tk_nanovg_process(void *data, d2tk_core_t *core, const d2tk_com_t *com,
if(!*sprite)
{
*sprite = nvgCreateImage(ctx, body->path, NVG_IMAGE_GENERATE_MIPMAPS);
char *img_path = NULL;
assert(asprintf(&img_path, "%s%s", backend->bundle_path, body->path) != -1);
assert(img_path);
*sprite = nvgCreateImage(ctx, img_path, NVG_IMAGE_GENERATE_MIPMAPS);
}
const int img = *sprite;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment