diff --git a/pkg/wuffs/src/jpeg.zig b/pkg/wuffs/src/jpeg.zig index 63ca428d1..69628f582 100644 --- a/pkg/wuffs/src/jpeg.zig +++ b/pkg/wuffs/src/jpeg.zig @@ -3,15 +3,12 @@ const Allocator = std.mem.Allocator; const c = @import("c.zig").c; const Error = @import("error.zig").Error; const check = @import("error.zig").check; +const ImageData = @import("main.zig").ImageData; const log = std.log.scoped(.wuffs_jpeg); /// Decode a JPEG image. -pub fn decode(alloc: Allocator, data: []const u8) Error!struct { - width: u32, - height: u32, - data: []const u8, -} { +pub fn decode(alloc: Allocator, data: []const u8) Error!ImageData { // Work around some weirdness in WUFFS/Zig, there are some structs that // are defined as "extern" by the Zig compiler which means that Zig won't // allocate them on the stack at compile time. WUFFS has functions for diff --git a/pkg/wuffs/src/main.zig b/pkg/wuffs/src/main.zig index f5fc01501..f282261c2 100644 --- a/pkg/wuffs/src/main.zig +++ b/pkg/wuffs/src/main.zig @@ -4,6 +4,12 @@ pub const png = @import("png.zig"); pub const jpeg = @import("jpeg.zig"); pub const swizzle = @import("swizzle.zig"); +pub const ImageData = struct { + width: u32, + height: u32, + data: []const u8, +}; + test { std.testing.refAllDeclsRecursive(@This()); } diff --git a/pkg/wuffs/src/png.zig b/pkg/wuffs/src/png.zig index 4597c6ccb..b85e4d747 100644 --- a/pkg/wuffs/src/png.zig +++ b/pkg/wuffs/src/png.zig @@ -3,15 +3,12 @@ const Allocator = std.mem.Allocator; const c = @import("c.zig").c; const Error = @import("error.zig").Error; const check = @import("error.zig").check; +const ImageData = @import("main.zig").ImageData; const log = std.log.scoped(.wuffs_png); /// Decode a PNG image. -pub fn decode(alloc: Allocator, data: []const u8) Error!struct { - width: u32, - height: u32, - data: []const u8, -} { +pub fn decode(alloc: Allocator, data: []const u8) Error!ImageData { // Work around some weirdness in WUFFS/Zig, there are some structs that // are defined as "extern" by the Zig compiler which means that Zig won't // allocate them on the stack at compile time. WUFFS has functions for