z2d context no longer has err return

This commit is contained in:
rhodes-b 2025-04-26 23:51:04 -05:00
parent 0c8339d2da
commit bbbe81efc5
2 changed files with 6 additions and 6 deletions

View File

@ -2239,7 +2239,7 @@ fn draw_branch_node(
@min(float_width - cx, float_height - cy),
);
var ctx = canvas.getContext() catch return;
var ctx = canvas.getContext();
defer ctx.deinit();
ctx.setSource(.{ .opaque_pattern = .{
.pixel = .{ .alpha8 = .{ .a = @intFromEnum(Shade.on) } },
@ -2290,7 +2290,7 @@ fn draw_circle(
};
const r: f64 = 0.5 * @min(float_width, float_height);
var ctx = canvas.getContext() catch return;
var ctx = canvas.getContext();
defer ctx.deinit();
ctx.setSource(.{ .opaque_pattern = .{
.pixel = .{ .alpha8 = .{ .a = @intFromEnum(Shade.on) } },
@ -2680,7 +2680,7 @@ fn draw_arc(
// Fraction away from the center to place the middle control points,
const s: f64 = 0.25;
var ctx = try canvas.getContext();
var ctx = canvas.getContext();
defer ctx.deinit();
ctx.setSource(.{ .opaque_pattern = .{
.pixel = .{ .alpha8 = .{ .a = @intFromEnum(Shade.on) } },
@ -2974,7 +2974,7 @@ fn draw_separated_block_quadrant(self: Box, canvas: *font.sprite.Canvas, comptim
}
}
var ctx = try canvas.getContext();
var ctx = canvas.getContext();
defer ctx.deinit();
ctx.setSource(.{ .opaque_pattern = .{
.pixel = .{ .alpha8 = .{ .a = @intFromEnum(Shade.on) } },

View File

@ -149,8 +149,8 @@ pub const Canvas = struct {
}
/// Acquires a z2d drawing context, caller MUST deinit context.
pub fn getContext(self: *Canvas) Allocator.Error!z2d.Context {
return try z2d.Context.init(self.alloc, &self.sfc);
pub fn getContext(self: *Canvas) z2d.Context {
return z2d.Context.init(self.alloc, &self.sfc);
}
/// Draw and fill a single pixel