From 433d41fa9abeb40e022b39420862f6a884ecd8d1 Mon Sep 17 00:00:00 2001 From: Mitchell Hashimoto Date: Wed, 23 Nov 2022 20:56:24 -0800 Subject: [PATCH] pkg/pixman: add more types --- pkg/pixman/format.zig | 8 ++++++++ pkg/pixman/image.zig | 2 +- pkg/pixman/types.zig | 10 ++++++++++ 3 files changed, 19 insertions(+), 1 deletion(-) diff --git a/pkg/pixman/format.zig b/pkg/pixman/format.zig index 541446805..39dc704f3 100644 --- a/pkg/pixman/format.zig +++ b/pkg/pixman/format.zig @@ -108,3 +108,11 @@ test "bpp" { try testing.expectEqual(@as(u32, 4), FormatCode.g4.bpp()); try testing.expectEqual(@as(u32, 8), FormatCode.g8.bpp()); } + +test "stride" { + const testing = std.testing; + + try testing.expectEqual(@as(c_int, 4), FormatCode.g1.strideForWidth(10)); + try testing.expectEqual(@as(c_int, 8), FormatCode.g4.strideForWidth(10)); + try testing.expectEqual(@as(c_int, 12), FormatCode.g8.strideForWidth(10)); +} diff --git a/pkg/pixman/image.zig b/pkg/pixman/image.zig index 9dc9d8118..dc888e7df 100644 --- a/pkg/pixman/image.zig +++ b/pkg/pixman/image.zig @@ -56,7 +56,7 @@ test "create and destroy" { try testing.expect(img.unref()); } -test "fill boxes" { +test "fill boxes a1" { const testing = std.testing; const alloc = testing.allocator; diff --git a/pkg/pixman/types.zig b/pkg/pixman/types.zig index fef250f25..d3cad88ae 100644 --- a/pkg/pixman/types.zig +++ b/pkg/pixman/types.zig @@ -74,3 +74,13 @@ pub const Box32 = extern struct { x2: i32, y2: i32, }; + +pub const Indexed = extern struct { + color: bool, + rgba: [256]u32, + ent: [32768]u8, +}; + +test { + std.testing.refAllDecls(@This()); +}