glfw: update system_sdk.zig to latest Zig master

This commit is contained in:
BratishkaErik 2021-12-06 17:35:47 +06:00 committed by Stephen Gutekanst
parent 5b2cb46700
commit 784aa40093
5 changed files with 10 additions and 10 deletions

View file

@ -22,7 +22,7 @@ owned: bool,
/// Initializes a new owned gamma ramp with the given array size and undefined values.
///
/// see also: glfw.Monitor.getGammaRamp
pub inline fn init(allocator: *mem.Allocator, size: usize) !GammaRamp {
pub inline fn init(allocator: mem.Allocator, size: usize) !GammaRamp {
const buf = try allocator.alloc(u16, size * 3);
return GammaRamp{
.red = buf[size * 0 .. (size * 0) + size],
@ -59,7 +59,7 @@ pub inline fn toC(self: GammaRamp) c.GLFWgammaramp {
}
/// Deinitializes the memory using the allocator iff `.owned = true`.
pub inline fn deinit(self: GammaRamp, allocator: *mem.Allocator) void {
pub inline fn deinit(self: GammaRamp, allocator: mem.Allocator) void {
if (self.owned) allocator.free(self.red);
}

View file

@ -30,7 +30,7 @@ pixels: []u8,
owned: bool,
/// Initializes a new owned image with the given size and pixel_data_len of undefined .pixel values.
pub inline fn init(allocator: *mem.Allocator, width: usize, height: usize, pixel_data_len: usize) !Image {
pub inline fn init(allocator: mem.Allocator, width: usize, height: usize, pixel_data_len: usize) !Image {
const buf = try allocator.alloc(u8, pixel_data_len);
return Image{
.width = width,
@ -67,7 +67,7 @@ pub inline fn toC(self: Image) c.GLFWimage {
}
/// Deinitializes the memory using the allocator iff `.owned = true`.
pub inline fn deinit(self: Image, allocator: *mem.Allocator) void {
pub inline fn deinit(self: Image, allocator: mem.Allocator) void {
if (self.owned) allocator.free(self.pixels);
}

View file

@ -215,7 +215,7 @@ pub inline fn getUserPointer(self: Monitor, comptime T: type) ?*T {
/// @thread_safety This function must only be called from the main thread.
///
/// see also: monitor_modes, glfw.Monitor.getVideoMode
pub inline fn getVideoModes(self: Monitor, allocator: *mem.Allocator) Error![]VideoMode {
pub inline fn getVideoModes(self: Monitor, allocator: mem.Allocator) Error![]VideoMode {
internal_debug.assertInitialized();
var count: c_int = 0;
const modes = c.glfwGetVideoModes(self.handle, &count);
@ -357,7 +357,7 @@ pub inline fn setGammaRamp(self: Monitor, ramp: GammaRamp) Error!void {
/// @thread_safety This function must only be called from the main thread.
///
/// see also: monitor_monitors, monitor_event, glfw.monitor.getPrimary
pub inline fn getAll(allocator: *mem.Allocator) mem.Allocator.Error![]Monitor {
pub inline fn getAll(allocator: mem.Allocator) mem.Allocator.Error![]Monitor {
internal_debug.assertInitialized();
var count: c_int = 0;
const monitors = c.glfwGetMonitors(&count);

View file

@ -540,7 +540,7 @@ pub inline fn setTitle(self: Window, title: [*:0]const u8) Error!void {
/// @thread_safety This function must only be called from the main thread.
///
/// see also: window_icon
pub inline fn setIcon(self: Window, allocator: *mem.Allocator, images: ?[]Image) Error!void {
pub inline fn setIcon(self: Window, allocator: mem.Allocator, images: ?[]Image) Error!void {
internal_debug.assertInitialized();
if (images) |im| {
const tmp = try allocator.alloc(c.GLFWimage, im.len);