~mil/mepo-devel

Add support for JPEG tiles v1 SUPERSEDED

Hanspeter Portner: 1
 Add support for JPEG tiles

 1 files changed, 2 insertions(+), 1 deletions(-)
Export patchset (mbox)
How do I use this?

Copy & paste the following snippet into your terminal to import this patchset into git:

curl -s https://lists.sr.ht/~mil/mepo-devel/patches/53238/mbox | git am -3
Learn more about email & git

[PATCH] Add support for JPEG tiles Export this patch

The tile server [1] I'd like to use only provides JPEG tiles and `mepo`
currently refuses to load anything else than PNGs.

As nothing else in the code seems to depend on the PNG format
specifically and SDL can handle any image type it supports, this change
just adds a check for JPEG images.

Tested with tile server [1] (zoom in to Switzerland to see something).
---
 src/TileCache.zig | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/src/TileCache.zig b/src/TileCache.zig
index 17e662c..d8d0269 100644
--- a/src/TileCache.zig
+++ b/src/TileCache.zig
@@ -420,10 +420,11 @@ fn download_loop_transfer_complete(tile_cache: *@This(), msg: *curl.CURLMsg) !vo
                        sdl.SDL_RWFromConstMem(@ptrCast(&datum_array[0]), @intCast(datum_array.len)),
                    );
                    const is_valid_png_data = sdl.SDL_TRUE == sdl.IMG_isPNG(memory);
                    const is_valid_jpg_data = sdl.SDL_TRUE == sdl.IMG_isJPG(memory);
                    try utilsdl.errorcheck(sdl.SDL_RWclose(memory));

                    // Save to FS
                    if (is_valid_png_data) {
                    if (is_valid_png_data or is_valid_jpg_data) {
                        const path = try png_path(tile_cache.allocator, p.get(p.pref.tile_cache_url).t.?, coords);
                        try cache_dir.writeFile(.{ .sub_path = path, .data = datum_array });
                    }
-- 
2.45.2