mirror of
https://github.com/ghostty-org/ghostty.git
synced 2026-08-29 18:41:40 +00:00
move stb to src/stb, add stb_image for png decoding
This commit is contained in:
@@ -8,7 +8,7 @@ const std = @import("std");
|
||||
const builtin = @import("builtin");
|
||||
const freetype = @import("freetype");
|
||||
const harfbuzz = @import("harfbuzz");
|
||||
const resize = @import("stb_image_resize");
|
||||
const stb = @import("../../stb/main.zig");
|
||||
const assert = std.debug.assert;
|
||||
const testing = std.testing;
|
||||
const Allocator = std.mem.Allocator;
|
||||
@@ -204,7 +204,7 @@ pub const Face = struct {
|
||||
result.buffer = buf.ptr;
|
||||
errdefer alloc.free(buf);
|
||||
|
||||
if (resize.stbir_resize_uint8(
|
||||
if (stb.stbir_resize_uint8(
|
||||
bm.buffer,
|
||||
@intCast(bm.width),
|
||||
@intCast(bm.rows),
|
||||
|
||||
4
src/stb/main.zig
Normal file
4
src/stb/main.zig
Normal file
@@ -0,0 +1,4 @@
|
||||
pub usingnamespace @cImport({
|
||||
@cInclude("stb_image.h");
|
||||
@cInclude("stb_image_resize.h");
|
||||
});
|
||||
13
src/stb/stb.c
Normal file
13
src/stb/stb.c
Normal file
@@ -0,0 +1,13 @@
|
||||
// For STBI we only need PNG because the only use case we have right now
|
||||
// is the Kitty Graphics protocol which only supports PNG as a format
|
||||
// besides raw RGB/RGBA buffers.
|
||||
#define STBI_ONLY_PNG
|
||||
|
||||
// We don't want to support super large images.
|
||||
#define STBI_MAX_DIMENSIONS 131072
|
||||
|
||||
#define STB_IMAGE_IMPLEMENTATION
|
||||
#include <stb_image.h>
|
||||
|
||||
#define STB_IMAGE_RESIZE_IMPLEMENTATION
|
||||
#include <stb_image_resize.h>
|
||||
7987
src/stb/stb_image.h
Normal file
7987
src/stb/stb_image.h
Normal file
File diff suppressed because it is too large
Load Diff
2634
src/stb/stb_image_resize.h
Normal file
2634
src/stb/stb_image_resize.h
Normal file
File diff suppressed because it is too large
Load Diff
Reference in New Issue
Block a user