renamed cairo to Cairo

This commit is contained in:
Janis 2022-12-17 15:12:18 +01:00
parent cc20141b6d
commit b93dcfb797

View file

@ -11,7 +11,7 @@ const xkb = @cImport({
@cInclude("xkbcommon/xkbcommon.h"); @cInclude("xkbcommon/xkbcommon.h");
}); });
const cairo = @cImport({ const Cairo = @cImport({
@cInclude("cairo/cairo.h"); @cInclude("cairo/cairo.h");
}); });
@ -53,8 +53,8 @@ const Buffer = struct {
buffer: *wl.Buffer = undefined, buffer: *wl.Buffer = undefined,
cairo: struct { cairo: struct {
surface: *cairo.cairo_surface_t = undefined, surface: *Cairo.cairo_surface_t = undefined,
ctx: *cairo.cairo_t = undefined, ctx: *Cairo.cairo_t = undefined,
} = .{}, } = .{},
size: Size = .{}, size: Size = .{},
data: []u8 = undefined, data: []u8 = undefined,
@ -99,15 +99,15 @@ const Buffer = struct {
.argb8888, .argb8888,
); );
const surface = cairo.cairo_image_surface_create_for_data( const surface = Cairo.cairo_image_surface_create_for_data(
@ptrCast([*c]u8, data), @ptrCast([*c]u8, data),
cairo.CAIRO_FORMAT_ARGB32, Cairo.CAIRO_FORMAT_ARGB32,
@intCast(c_int, size.width), @intCast(c_int, size.width),
@intCast(c_int, size.height), @intCast(c_int, size.height),
@intCast(c_int, stride), @intCast(c_int, stride),
) orelse return error.NoCairoSurface; ) orelse return error.NoCairoSurface;
const cairo_ctx = cairo.cairo_create(surface) orelse return error.NoCairoContext; const cairo_ctx = Cairo.cairo_create(surface) orelse return error.NoCairoContext;
self.* = .{ self.* = .{
.buffer = buffer, .buffer = buffer,
@ -124,8 +124,8 @@ const Buffer = struct {
std.os.munmap(@alignCast(0x1000, self.data)); std.os.munmap(@alignCast(0x1000, self.data));
self.buffer.destroy(); self.buffer.destroy();
cairo.cairo_destroy(self.cairo.ctx); Cairo.cairo_destroy(self.cairo.ctx);
cairo.cairo_surface_destroy(self.cairo.surface); Cairo.cairo_surface_destroy(self.cairo.surface);
} }
}; };